Fix build system
This commit is contained in:
parent
3fc7245a46
commit
2b062bbb8b
|
@ -48,7 +48,7 @@ public class Carla : ModuleRules
|
|||
|
||||
AddBoostDependency(Target);
|
||||
AddProtobufDependency(Target);
|
||||
AddTurboJPEGDependency(Target);
|
||||
AddLibPNGDependency(Target);
|
||||
AddCarlaServerDependency(Target);
|
||||
|
||||
if (Target.Platform == UnrealTargetPlatform.Linux)
|
||||
|
@ -138,16 +138,11 @@ public class Carla : ModuleRules
|
|||
}
|
||||
}
|
||||
|
||||
private void AddTurboJPEGDependency(TargetInfo Target)
|
||||
private void AddLibPNGDependency(TargetInfo Target)
|
||||
{
|
||||
if (Target.Platform == UnrealTargetPlatform.Linux)
|
||||
{
|
||||
string TurboJPEGLibPath = System.Environment.GetEnvironmentVariable("TURBOJPEG_LIB_PATH");
|
||||
if (string.IsNullOrEmpty(TurboJPEGLibPath) || !System.IO.Directory.Exists(TurboJPEGLibPath))
|
||||
{
|
||||
throw new System.Exception("TURBOJPEG_LIB_PATH is not defined, or points to a non-existant directory, please set this environment variable.");
|
||||
}
|
||||
PublicAdditionalLibraries.Add(Path.Combine(TurboJPEGLibPath, "libturbojpeg.a"));
|
||||
PublicAdditionalLibraries.Add("png");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -93,28 +93,12 @@ endif (UNIX)
|
|||
# ==============================================================================
|
||||
|
||||
if (UNIX)
|
||||
set(png_LIBRARY png)
|
||||
|
||||
elseif (WIN32)
|
||||
message( WARNING "Not linked in windows yet")
|
||||
endif (UNIX)
|
||||
|
||||
# ==============================================================================
|
||||
# -- TurboJPEG -----------------------------------------------------------------
|
||||
# ==============================================================================
|
||||
|
||||
if (UNIX)
|
||||
|
||||
if (EXISTS $ENV{TURBOJPEG_LIB_PATH})
|
||||
set(TurboJPEG_LIBRARIES ${TurboJPEG_LIBRARIES} $ENV{TURBOJPEG_LIB_PATH}/libturbojpeg.a)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_TURBOJPEG")
|
||||
else (EXISTS $ENV{TURBOJPEG_LIB_PATH})
|
||||
message(FATAL_ERROR "TURBOJPEG_LIB_PATH is not defined, or points to a non-existant directory, please set this environment variable.")
|
||||
endif (EXISTS $ENV{TURBOJPEG_LIB_PATH})
|
||||
set(Png_LIBRARY png)
|
||||
|
||||
elseif (WIN32)
|
||||
|
||||
message(WARNING "TurboJPEG not available for Windows yet")
|
||||
message(WARNING "libpng not available for Windows yet")
|
||||
|
||||
endif (UNIX)
|
||||
|
||||
|
@ -123,7 +107,7 @@ endif (UNIX)
|
|||
# ==============================================================================
|
||||
|
||||
set(CarlaServer_Deps_LIBRARIES
|
||||
${png_LIBRARY}
|
||||
${Png_LIBRARY}
|
||||
${Protobuf_LIBRARIES}
|
||||
${Boost_DATE_TIME_LIBRARY}
|
||||
${Boost_REGEX_LIBRARY}
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace server {
|
|||
}
|
||||
|
||||
|
||||
static bool getJPEGImages(const std::vector<Image> &images, Reward &rwd){
|
||||
static bool getPNGImages(const std::vector<Image> &images, Reward &rwd) {
|
||||
std::string image_data;
|
||||
std::string depth_data;
|
||||
std::string image_size_data;
|
||||
|
@ -214,7 +214,7 @@ static bool getJPEGImages(const std::vector<Image> &images, Reward &rwd){
|
|||
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
|
||||
cout << "Time to encode the image: " << elapsed_secs << " sec" << endl;
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
if (!GetImage(img, compressedImage)) {
|
||||
std::cerr << "Error while encoding image" << std::endl;
|
||||
|
@ -271,16 +271,9 @@ static bool getJPEGImages(const std::vector<Image> &images, Reward &rwd){
|
|||
reward.set_speed(values.forward_speed);
|
||||
reward.set_timestamp(values.timestamp);
|
||||
|
||||
#ifdef WITH_TURBOJPEG
|
||||
|
||||
//constexpr int JPEG_QUALITY = 75;
|
||||
|
||||
if (!getJPEGImages(values.images, reward)) {
|
||||
std::cerr << "Error compressing image to JPEG" << std::endl;
|
||||
if (!getPNGImages(values.images, reward)) {
|
||||
std::cerr << "Error compressing image to PNG" << std::endl;
|
||||
}
|
||||
|
||||
#endif // WITH_TURBOJPEG
|
||||
|
||||
}
|
||||
|
||||
void Protocol::LoadScene(Scene &scene, const Scene_Values &values) {
|
||||
|
|
Loading…
Reference in New Issue