Fix RTTI error.

This commit is contained in:
Marcel Pi 2024-01-24 09:45:50 +01:00
parent 04c8c31584
commit a6e32afbe1
4 changed files with 262 additions and 452 deletions

View File

@ -1,4 +1,6 @@
cmake_minimum_required (VERSION 3.12.0)
cmake_minimum_required (VERSION 3.20.0)
cmake_policy (SET CMP0117 NEW)
set (CARLA_VERSION_MAJOR 0)
set (CARLA_VERSION_MINOR 9)
@ -124,6 +126,7 @@ endif ()
if (ENABLE_RTTI)
else ()
list (APPEND CARLA_COMMON_DEFINITIONS BOOST_NO_RTTI)
list (APPEND CARLA_COMMON_DEFINITIONS BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY)
endif ()
@ -217,7 +220,7 @@ if (BUILD_LIBCARLA_SERVER)
)
target_include_directories (
carla-server PRIVATE
carla-server PUBLIC
${LIBCARLA_SERVER_INCLUDE_PATHS}
)
@ -364,7 +367,7 @@ if (BUILD_LIBCARLA_CLIENT)
)
target_include_directories (
carla-client PRIVATE
carla-client PUBLIC
${LIBCARLA_CLIENT_INCLUDE_PATHS}
)

View File

@ -59,16 +59,16 @@ def FindExecutable(candidates : list):
return None
DEFAULT_C_COMPILER = FindExecutable([
'clang-cl',
'cl',
'clang-cl',
] if os.name == 'nt' else [
'clang',
'gcc',
])
DEFAULT_CPP_COMPILER = FindExecutable([
'clang-cl',
'cl',
'clang-cl',
] if os.name == 'nt' else [
'clang++',
'g++',
@ -311,7 +311,7 @@ UNREAL_ENGINE_PATH = Path(ARGV.ue_path)
# Dependencies:
# Boost
BOOST_USE_SUPERPROJECT = True
BOOST_VERSION = (1, 83, 0)
BOOST_VERSION = (1, 84, 0)
BOOST_VERSION_MAJOR, BOOST_VERSION_MINOR, BOOST_VERSION_PATCH = BOOST_VERSION
BOOST_VERSION_STRING = f'{BOOST_VERSION_MAJOR}.{BOOST_VERSION_MINOR}.{BOOST_VERSION_PATCH}'
BOOST_TOOLSET = ARGV.boost_toolset
@ -548,9 +548,8 @@ DEFAULT_DEPENDENCIES = [
GitRepository('https://github.com/carla-simulator/recastnavigation.git', tag_or_branch = 'carla')),
] + [
Dependency(
'boost',
Download(f'https://boostorg.jfrog.io/artifactory/main/release/{BOOST_VERSION_STRING}/source/boost_{BOOST_VERSION_MAJOR}_{BOOST_VERSION_MINOR}_{BOOST_VERSION_PATCH}.zip'),
Download(f'https://carla-releases.s3.eu-west-3.amazonaws.com/Backup/boost_{BOOST_VERSION_MAJOR}_{BOOST_VERSION_MINOR}_{BOOST_VERSION_PATCH}.zip')),
'boost',
Download(f'https://github.com/boostorg/boost/releases/download/boost-{BOOST_VERSION_STRING}/boost-{BOOST_VERSION_STRING}.zip')),
] if BOOST_USE_SUPERPROJECT else [
Dependency(
'boost-algorithm',
@ -920,7 +919,6 @@ def BuildAndInstallBoost():
'threading=multi',
'--layout=versioned',
'--with-system',
'--with-filesystem',
'--with-python',
'--with-date_time',
f'--build-dir={BOOST_BUILD_PATH}',

View File

@ -35,8 +35,6 @@ public class Carla :
[CommandLine("-carla-dependencies-path")]
string CarlaDependenciesPath = null;
public Carla(ReadOnlyTargetRules Target) :
base(Target)
{
@ -87,31 +85,31 @@ public class Carla :
if (EnableCarSim)
{
PublicDefinitions.Add("WITH_CARSIM");
PrivateDefinitions.Add("WITH_CARSIM");
PrivateDefinitions.Add("WITH_CARSIM");
}
if (EnableChrono)
{
PublicDefinitions.Add("WITH_CHRONO");
PrivateDefinitions.Add("WITH_CHRONO");
PrivateDefinitions.Add("WITH_CHRONO");
}
if (EnablePytorch)
{
PublicDefinitions.Add("WITH_PYTORCH");
PrivateDefinitions.Add("WITH_PYTORCH");
PrivateDefinitions.Add("WITH_PYTORCH");
}
if (EnableRos2)
{
PublicDefinitions.Add("WITH_ROS2");
PrivateDefinitions.Add("WITH_ROS2");
PrivateDefinitions.Add("WITH_ROS2");
}
if (EnableOSM2ODR)
{
PublicDefinitions.Add("WITH_OSM2ODR");
PrivateDefinitions.Add("WITH_OSM2ODR");
PrivateDefinitions.Add("WITH_OSM2ODR");
}
@ -119,24 +117,20 @@ public class Carla :
// PrivateIncludePaths.AddRange(new string[] { });
PublicDependencyModuleNames.AddRange(new string[]
{
{
"Core",
"RenderCore",
"RHI",
"Renderer",
"ProceduralMeshComponent",
"MeshDescription"
});
});
if (EnableCarSim)
{
PublicDependencyModuleNames.Add("CarSim");
}
if (Target.Type == TargetType.Editor)
{
PublicDependencyModuleNames.Add("UnrealEd");
}
PrivateDependencyModuleNames.AddRange(new string[]
{
@ -194,14 +188,13 @@ public class Carla :
var LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
var LibCarlaLibPath = Path.Combine(LibCarlaInstallPath, "lib");
var LibCarlaServerPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-server"));
var LibCarlaClientPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-client"));
// var LibCarlaClientPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-client"));
Debug.Assert(Directory.Exists(LibCarlaServerPath));
Debug.Assert(Directory.Exists(LibCarlaClientPath));
// Boost
var BoostIncludePath = Path.Combine(DependenciesInstallPath, "boost-install", "include");
var BoostLibraries = new List<string>();
var BoostLibraryPatterns = new string[]
{
@ -217,29 +210,28 @@ public class Carla :
{
for (int i = 0; i != BoostLibraryPatterns.Length; ++i)
{
BoostLibraryPatterns[i] = "lib" + BoostLibraryPatterns[i];
BoostLibraryPatterns[i] = "lib" + BoostLibraryPatterns[i];
}
}
foreach (var Pattern in BoostLibraryPatterns)
{
var Candidates = FindLibraries("boost", Pattern);
if (Candidates.Length != 0)
BoostLibraries.Add(Candidates[0]);
}
var SQLiteBuildPath = Path.Combine(DependenciesInstallPath, "sqlite-build");
var SQLiteLibrary = Directory.GetFiles(SQLiteBuildPath, GetLibraryName("sqlite*"))[0];
var AdditionalLibraries = new List<string>
{
LibCarlaServerPath,
SQLiteLibrary,
FindLibraries("rpclib", "rpc")[0],
FindLibraries("xercesc", "xerces-c*")[0],
FindLibraries("proj", "proj")[0],
FindLibraries("zlib", "zlibstatic*")[0],
};
AdditionalLibraries.AddRange(BoostLibraries);
{
LibCarlaServerPath,
SQLiteLibrary,
FindLibraries("rpclib", "rpc")[0],
FindLibraries("xercesc", "xerces-c*")[0],
FindLibraries("proj", "proj")[0],
FindLibraries("zlib", "zlibstatic*")[0],
};
foreach (var Pattern in BoostLibraryPatterns)
{
var Candidates = FindLibraries("boost", Pattern);
if (Candidates.Length != 0)
AdditionalLibraries.Add(Candidates[0]);
}
if (EnableOSM2ODR)
AdditionalLibraries.Add(FindLibraries("sumo", "*osm2odr")[0]);
@ -262,35 +254,37 @@ public class Carla :
AdditionalLibraries.AddRange(ChronoLibraries);
}
PublicIncludePaths.Add(ModuleDirectory);
PublicIncludePaths.Add(LibCarlaIncludePath);
PublicIncludePaths.AddRange(new string[]
{
GetIncludePath("boost"),
GetIncludePath("rpclib"),
GetIncludePath("xercesc"),
GetIncludePath("sumo"),
GetIncludePath("zlib"),
});
PrivateIncludePaths.AddRange(new string[]
{
ModuleDirectory, // This should probably be removed.
LibCarlaIncludePath,
GetIncludePath("boost"),
GetIncludePath("rpclib"),
GetIncludePath("xercesc"),
GetIncludePath("sumo"),
GetIncludePath("zlib"),
Path.Combine(DependenciesInstallPath, "eigen-source"),
});
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
PublicDefinitions.AddRange(new string[]
{
"ASIO_NO_EXCEPTIONS",
"BOOST_NO_EXCEPTIONS",
"LIBCARLA_NO_EXCEPTIONS",
"PUGIXML_NO_EXCEPTIONS",
"BOOST_DISABLE_ABI_HEADERS",
"BOOST_NO_RTTI",
"BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY",
});
if (IsWindows)
{
PublicDefinitions.Add("NOMINMAX");
PublicDefinitions.Add("VC_EXTRALEAN");
PublicDefinitions.Add("WIN32_LEAN_AND_MEAN");
PublicDefinitions.AddRange(new string[]
{
"NOMINMAX",
"VC_EXTRALEAN",
"WIN32_LEAN_AND_MEAN",
});
}
if (Verbose)
@ -302,191 +296,4 @@ public class Carla :
PublicAdditionalLibraries.AddRange(AdditionalLibraries);
}
#if false
private void AddDynamicLibrary(string library)
{
PublicAdditionalLibraries.Add(library);
RuntimeDependencies.Add(library);
PublicDelayLoadDLLs.Add(library);
}
private void AddDllDependency(string PathToFolder, string DllName)
{
string Source = Path.Combine(PathToFolder, DllName);
string Destination = Path.Combine("$(BinaryOutputDir)", DllName);
RuntimeDependencies.Add(Destination, Source);
}
private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
{
string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies"));
// Link dependencies.
if (IsWindows)
{
foreach (string file in Directory.GetFiles(Path.Combine(LibCarlaInstallPath, "lib"), "*boost*.lib"))
PublicAdditionalLibraries.Add(file);
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
if (UseDebugLibs(Target))
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug")));
}
else
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
}
if (EnableChrono)
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine")));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine_vehicle")));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoModels_vehicle")));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoModels_robot")));
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine.dll");
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoEngine_vehicle.dll");
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_vehicle.dll");
AddDllDependency(Path.Combine(LibCarlaInstallPath, "dll"), "ChronoModels_robot.dll");
bUseRTTI = true;
}
//OsmToODR
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "sqlite3.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "xerces-c_3.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "proj.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "osm2odr.lib"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "zlibstatic.lib"));
}
else
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
if (UseDebugLibs(Target))
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug")));
}
else
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
}
if (EnableChrono)
{
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine.so"));
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine_vehicle.so"));
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoModels_vehicle.so"));
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoModels_robot.so"));
bUseRTTI = true;
}
if (EnablePytorch)
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_pytorch")));
string LibTorchPath = LibCarlaInstallPath;
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libonnx_proto.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libfbgemm.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgloo.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libXNNPACK.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libprotobuf-lite.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libprotobuf.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libasmjit.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libcpuinfo_internals.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libclog.a"));
// PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbreakpad_common.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbenchmark.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libtensorpipe.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libpytorch_qnnpack.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libtensorpipe_cuda.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libnnpack_reference_layers.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgmock.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libdnnl.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libpthreadpool.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libcpuinfo.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libqnnpack.a"));
// PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbreakpad.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libkineto.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libprotoc.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgtest.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgmock_main.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgtest_main.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libbenchmark_main.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libfmt.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libtensorpipe_uv.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libfoxi_loader.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libgloo_cuda.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libnnpack.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libcaffe2_protos.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibTorchPath, "lib", "libonnx.a"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libnnapi_backend.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libbackend_with_compiler.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libcaffe2_nvrtc.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cuda_cpp.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libc10_cuda.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorchbind_test.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libjitbackend_test.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libc10.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cuda.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_global_deps.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cpu.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libshm.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorch_cuda_cu.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorchscatter.so"));
AddDynamicLibrary(Path.Combine(LibTorchPath, "lib", "libtorchcluster.so"));
// AddDynamicLibrary("/usr/local/cuda/lib64/stubs/libcuda.so");
// AddDynamicLibrary("/usr/local/cuda/lib64/libnvrtc.so");
// AddDynamicLibrary("/usr/local/cuda/lib64/libnvToolsExt.so");
// AddDynamicLibrary("/usr/local/cuda/lib64/libcudart.so");
// AddDynamicLibrary("/usr/lib/llvm-10/lib/libgomp.so");
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/stubs/libcuda.so");
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/libnvrtc.so");
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/libnvToolsExt.so");
PublicAdditionalLibraries.Add("/usr/local/cuda/lib64/libcudart.so");
PublicAdditionalLibraries.Add("/usr/lib/llvm-10/lib/libgomp.so");
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libcudart-a7b20f20.so.11.0"));
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libgomp-a34b3233.so.1"));
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libnvrtc-builtins-4730a239.so.11.3"));
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libnvrtc-1ea278b5.so.11.2"));
RuntimeDependencies.Add(Path.Combine(LibTorchPath, "lib", "libnvToolsExt-24de1d56.so.1"));
PublicAdditionalLibraries.Add("stdc++");
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libpython3.9.so");
}
if (EnableRos2)
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_fastdds")));
string LibFastDDSPath = LibCarlaInstallPath;
AddDynamicLibrary(Path.Combine(LibFastDDSPath, "lib", "libfoonathan_memory-0.7.3.so"));
AddDynamicLibrary(Path.Combine(LibFastDDSPath, "lib", "libfastcdr.so"));
AddDynamicLibrary(Path.Combine(LibFastDDSPath, "lib", "libfastrtps.so"));
PublicAdditionalLibraries.Add("stdc++");
}
//OsmToODR
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libc.so");
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libsqlite3.so"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libxerces-c.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libproj.a"));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", "libosm2odr.a"));
}
bEnableExceptions = true;
// Include path.
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
PublicIncludePaths.Add(LibCarlaIncludePath);
PrivateIncludePaths.Add(LibCarlaIncludePath);
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
}
#endif
}

View File

@ -9,265 +9,267 @@ using UnrealBuildTool;
using EpicGames.Core;
public class CarlaTools :
ModuleRules
ModuleRules
{
[CommandLine("-verbose")]
bool Verbose = true;
[CommandLine("-verbose")]
bool Verbose = true;
[CommandLine("-houdini")]
bool EnableHoudini = false;
[CommandLine("-houdini")]
bool EnableHoudini = false;
[CommandLine("-nv-omniverse")]
bool EnableNVIDIAOmniverse = false;
[CommandLine("-nv-omniverse")]
bool EnableNVIDIAOmniverse = false;
[CommandLine("-osm2odr")]
bool EnableOSM2ODR = true;
[CommandLine("-osm2odr")]
bool EnableOSM2ODR = true;
[CommandLine("-carla-install-path")]
string CarlaInstallPath = null;
[CommandLine("-carla-install-path")]
string CarlaInstallPath = null;
[CommandLine("-carla-dependencies-install-path")]
string CarlaDependenciesPath = null;
[CommandLine("-carla-dependencies-install-path")]
string CarlaDependenciesPath = null;
private static void LogFlagStatus(string name, bool value)
private static void LogFlagStatus(string name, bool value)
{
var state = value ? "enabled" : "disabled";
Console.WriteLine(string.Format("{0} is {1}.", name, state));
}
public CarlaTools(ReadOnlyTargetRules Target) :
base(Target)
{
LogFlagStatus("Houdini support", EnableHoudini);
LogFlagStatus("NVIDIA Omniverse support", EnableNVIDIAOmniverse);
if (EnableOSM2ODR)
{
var state = value ? "enabled" : "disabled";
Console.WriteLine(string.Format("{0} is {1}.", name, state));
PrivateDefinitions.Add("WITH_OSM2ODR");
PrivateDefinitions.Add("WITH_OSM2ODR");
}
public CarlaTools(ReadOnlyTargetRules Target) :
base(Target)
var DirectoryInfo = new DirectoryInfo(ModuleDirectory);
for (int i = 0; i != 6; ++i)
DirectoryInfo = DirectoryInfo.Parent;
var WorkspacePath = DirectoryInfo.ToString();
Debug.Assert(WorkspacePath != null && !Directory.Exists(WorkspacePath));
if (CarlaInstallPath == null)
{
LogFlagStatus("Houdini support", EnableHoudini);
LogFlagStatus("NVIDIA Omniverse support", EnableNVIDIAOmniverse);
Console.WriteLine("\"-carla-install-path\" was not specified, inferring...");
CarlaInstallPath = Path.Combine(WorkspacePath, "Install");
if (!Directory.Exists(CarlaInstallPath))
throw new DirectoryNotFoundException("Could not infer CARLA install directory.");
Console.WriteLine("Using \"" + CarlaInstallPath + "\" as the CARLA install path.");
}
if (EnableOSM2ODR)
{
PublicDefinitions.Add("WITH_OSM2ODR");
PrivateDefinitions.Add("WITH_OSM2ODR");
}
if (CarlaDependenciesPath == null)
{
Console.WriteLine("\"-carla-dependencies-path\" was not specified, inferring...");
CarlaDependenciesPath = Path.Combine(WorkspacePath, "Build", "Dependencies");
if (!Directory.Exists(CarlaDependenciesPath))
throw new DirectoryNotFoundException("Could not infer CARLA dependencies directory.");
Console.WriteLine("Using \"" + CarlaDependenciesPath + "\" as the CARLA depenencies install path.");
}
var DirectoryInfo = new DirectoryInfo(ModuleDirectory);
for (int i = 0; i != 6; ++i)
DirectoryInfo = DirectoryInfo.Parent;
var WorkspacePath = DirectoryInfo.ToString();
Debug.Assert(WorkspacePath != null && !Directory.Exists(WorkspacePath));
Console.WriteLine("Current module directory: " + ModuleDirectory);
if (CarlaInstallPath == null)
{
Console.WriteLine("\"-carla-install-path\" was not specified, inferring...");
CarlaInstallPath = Path.Combine(WorkspacePath, "Install");
if (!Directory.Exists(CarlaInstallPath))
throw new DirectoryNotFoundException("Could not infer CARLA install directory.");
Console.WriteLine("Using \"" + CarlaInstallPath + "\" as the CARLA install path.");
}
bool IsWindows = Target.Platform == UnrealTargetPlatform.Win64;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bEnableExceptions = bEnableExceptions || IsWindows;
if (CarlaDependenciesPath == null)
{
Console.WriteLine("\"-carla-dependencies-path\" was not specified, inferring...");
CarlaDependenciesPath = Path.Combine(WorkspacePath, "Build", "Dependencies");
if (!Directory.Exists(CarlaDependenciesPath))
throw new DirectoryNotFoundException("Could not infer CARLA dependencies directory.");
Console.WriteLine("Using \"" + CarlaDependenciesPath + "\" as the CARLA depenencies install path.");
}
Console.WriteLine("Current module directory: " + ModuleDirectory);
bool IsWindows = Target.Platform == UnrealTargetPlatform.Win64;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bEnableExceptions = bEnableExceptions || IsWindows;
PublicDependencyModuleNames.AddRange(new string[]
{
PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"ProceduralMeshComponent",
"MeshDescription",
"RawMesh",
"AssetTools",
});
});
PrivateDependencyModuleNames.AddRange(new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"UnrealEd",
"Blutility",
"UMG",
"EditorScriptingUtilities",
"Landscape",
"Foliage",
PrivateDependencyModuleNames.AddRange(new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
"UnrealEd",
"Blutility",
"UMG",
"EditorScriptingUtilities",
"Landscape",
"Foliage",
"FoliageEdit",
"MeshMergeUtilities",
"Carla",
"StaticMeshDescription",
"Json",
"JsonUtilities",
"Networking",
"Sockets",
"HTTP",
"RHI",
"RenderCore",
"MeshMergeUtilities",
"StreetMapImporting",
"StreetMapRuntime",
"Carla",
"StaticMeshDescription",
"Json",
"JsonUtilities",
"Networking",
"Sockets",
"HTTP",
"RHI",
"RenderCore",
"MeshMergeUtilities",
"StreetMapImporting",
"StreetMapRuntime",
"Chaos",
"ChaosVehicles"
});
});
if (EnableHoudini)
{
PrivateDependencyModuleNames.AddRange(new string[]
{
"HoudiniEngine",
"HoudiniEngineEditor",
"HoudiniEngineRuntime"
});
}
if (EnableHoudini)
{
PrivateDependencyModuleNames.AddRange(new string[]
{
"HoudiniEngine",
"HoudiniEngineEditor",
"HoudiniEngineRuntime"
});
}
if (EnableNVIDIAOmniverse)
{
PublicDefinitions.Add("WITH_OMNIVERSE");
PrivateDefinitions.Add("WITH_OMNIVERSE");
if (EnableNVIDIAOmniverse)
{
PrivateDefinitions.Add("WITH_OMNIVERSE");
PrivateDefinitions.Add("WITH_OMNIVERSE");
PrivateDependencyModuleNames.AddRange(new string[]
{
"OmniverseUSD",
"OmniverseRuntime"
});
}
PrivateDependencyModuleNames.AddRange(new string[]
{
"OmniverseUSD",
"OmniverseRuntime"
});
}
if (IsWindows)
{
PublicDefinitions.Add("NOMINMAX");
PublicDefinitions.Add("VC_EXTRALEAN");
PublicDefinitions.Add("WIN32_LEAN_AND_MEAN");
}
if (IsWindows)
{
PrivateDefinitions.Add("NOMINMAX");
PrivateDefinitions.Add("VC_EXTRALEAN");
PrivateDefinitions.Add("WIN32_LEAN_AND_MEAN");
}
PrivateDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PrivateDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
PrivateDefinitions.Add("ASIO_NO_EXCEPTIONS");
PrivateDefinitions.Add("BOOST_NO_EXCEPTIONS");
PrivateDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PrivateDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_NO_RTTI");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
var LibraryPrefix = IsWindows ? "" : "lib";
var LibrarySuffix = IsWindows ? ".lib" : ".a";
var LibraryPrefix = IsWindows ? "" : "lib";
var LibrarySuffix = IsWindows ? ".lib" : ".a";
var LibCarlaInstallPath = Path.Combine(CarlaInstallPath, "LibCarla");
var DependenciesInstallPath = CarlaDependenciesPath;
var LibCarlaInstallPath = Path.Combine(CarlaInstallPath, "LibCarla");
var DependenciesInstallPath = CarlaDependenciesPath;
Func<string, string> GetLibraryName = name =>
{
return LibraryPrefix + name + LibrarySuffix;
};
Func<string, string> GetLibraryName = name =>
{
return LibraryPrefix + name + LibrarySuffix;
};
Func<string, string, string[]> FindLibraries = (name, pattern) =>
{
var InstallPath = Path.Combine(DependenciesInstallPath, name + "-install");
var LibPath = Path.Combine(InstallPath, "lib");
var Candidates = Directory.GetFiles(LibPath, GetLibraryName(pattern));
if (Candidates.Length == 0)
throw new FileNotFoundException(string.Format("Could not find any matching libraries for \"{0}\" using pattern \"{1}\"", name, pattern));
Array.Sort(Candidates);
return Candidates;
};
Func<string, string, string[]> FindLibraries = (name, pattern) =>
{
var InstallPath = Path.Combine(DependenciesInstallPath, name + "-install");
var LibPath = Path.Combine(InstallPath, "lib");
var Candidates = Directory.GetFiles(LibPath, GetLibraryName(pattern));
if (Candidates.Length == 0)
throw new FileNotFoundException(string.Format("Could not find any matching libraries for \"{0}\" using pattern \"{1}\"", name, pattern));
Array.Sort(Candidates);
return Candidates;
};
Func<string, string> GetIncludePath = name => Path.Combine(DependenciesInstallPath, name + "-install", "include");
Func<string, string> GetIncludePath = name => Path.Combine(DependenciesInstallPath, name + "-install", "include");
// LibCarla
var LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
var LibCarlaLibPath = Path.Combine(LibCarlaInstallPath, "lib");
var LibCarlaServerPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-server"));
var LibCarlaClientPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-client"));
// LibCarla
var LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
var LibCarlaLibPath = Path.Combine(LibCarlaInstallPath, "lib");
var LibCarlaServerPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-server"));
var LibCarlaClientPath = Path.Combine(LibCarlaLibPath, GetLibraryName("carla-client"));
// Boost
// Boost
var BoostIncludePath = Path.Combine(DependenciesInstallPath, "boost-install", "include");
var BoostLibraries = new List<string>();
var BoostIncludePath = Path.Combine(DependenciesInstallPath, "boost-install", "include");
var BoostLibraries = new List<string>();
var BoostLibraryPatterns = new string[]
{
var BoostLibraryPatterns = new string[]
{
"boost_atomic*",
"boost_date_time*",
"boost_filesystem*",
"boost_numpy*",
"boost_python*",
"boost_system*",
};
if (IsWindows)
{
for (int i = 0; i != BoostLibraryPatterns.Length; ++i)
{
BoostLibraryPatterns[i] = "lib" + BoostLibraryPatterns[i];
}
}
};
if (IsWindows)
{
for (int i = 0; i != BoostLibraryPatterns.Length; ++i)
{
BoostLibraryPatterns[i] = "lib" + BoostLibraryPatterns[i];
}
}
foreach (var Pattern in BoostLibraryPatterns)
{
var Candidates = FindLibraries("boost", Pattern);
if (Candidates.Length != 0)
BoostLibraries.Add(Candidates[0]);
}
foreach (var Pattern in BoostLibraryPatterns)
{
var Candidates = FindLibraries("boost", Pattern);
if (Candidates.Length != 0)
BoostLibraries.Add(Candidates[0]);
}
var SQLiteBuildPath = Path.Combine(DependenciesInstallPath, "sqlite-build");
var SQLiteLibraryCandidates = Directory.GetFiles(SQLiteBuildPath, GetLibraryName("sqlite*"));
if (SQLiteLibraryCandidates.Length == 0)
throw new FileNotFoundException("Could not find any matching libraries for SQLite");
var RPCLibCandidates = FindLibraries("rpclib", "rpc");
var XercesCCandidates = FindLibraries("xercesc", "xerces-c*");
var PROJCandidates = FindLibraries("proj", "proj");
var ZlibCandidates = FindLibraries("zlib", "zlibstatic*");
var SQLiteBuildPath = Path.Combine(DependenciesInstallPath, "sqlite-build");
var SQLiteLibraryCandidates = Directory.GetFiles(SQLiteBuildPath, GetLibraryName("sqlite*"));
if (SQLiteLibraryCandidates.Length == 0)
throw new FileNotFoundException("Could not find any matching libraries for SQLite");
var RPCLibCandidates = FindLibraries("rpclib", "rpc");
var XercesCCandidates = FindLibraries("xercesc", "xerces-c*");
var PROJCandidates = FindLibraries("proj", "proj");
var ZlibCandidates = FindLibraries("zlib", "zlibstatic*");
var AdditionalLibraries = new List<string>
{
SQLiteLibraryCandidates[0],
RPCLibCandidates[0],
XercesCCandidates[0],
PROJCandidates[0],
ZlibCandidates[0],
};
var AdditionalLibraries = new List<string>
{
SQLiteLibraryCandidates[0],
RPCLibCandidates[0],
XercesCCandidates[0],
PROJCandidates[0],
ZlibCandidates[0],
};
if (EnableOSM2ODR)
AdditionalLibraries.Add(FindLibraries("sumo", "*osm2odr")[0]);
if (EnableOSM2ODR)
AdditionalLibraries.Add(FindLibraries("sumo", "*osm2odr")[0]);
PublicIncludePaths.Add(ModuleDirectory);
PublicIncludePaths.Add(LibCarlaIncludePath);
PublicIncludePaths.Add(ModuleDirectory);
PublicIncludePaths.Add(LibCarlaIncludePath);
PublicIncludePaths.AddRange(new string[]
{
PublicIncludePaths.AddRange(new string[]
{
BoostIncludePath,
GetIncludePath("boost"),
GetIncludePath("rpclib"),
GetIncludePath("xercesc"),
GetIncludePath("sumo"),
GetIncludePath("zlib"),
});
});
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
PrivateDefinitions.Add("ASIO_NO_EXCEPTIONS");
PrivateDefinitions.Add("BOOST_NO_EXCEPTIONS");
PrivateDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PrivateDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
PrivateDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PrivateDefinitions.Add("BOOST_NO_RTTI");
PrivateDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
if (IsWindows)
{
PublicDefinitions.Add("NOMINMAX");
PublicDefinitions.Add("VC_EXTRALEAN");
PublicDefinitions.Add("WIN32_LEAN_AND_MEAN");
}
if (Verbose)
{
Console.WriteLine("Additional CARLA libraries:");
foreach (var e in AdditionalLibraries)
Console.WriteLine(" - " + e);
}
PublicAdditionalLibraries.AddRange(AdditionalLibraries);
if (IsWindows)
{
PrivateDefinitions.Add("NOMINMAX");
PrivateDefinitions.Add("VC_EXTRALEAN");
PrivateDefinitions.Add("WIN32_LEAN_AND_MEAN");
}
if (Verbose)
{
Console.WriteLine("Additional CARLA libraries:");
foreach (var e in AdditionalLibraries)
Console.WriteLine(" - " + e);
}
PublicAdditionalLibraries.AddRange(AdditionalLibraries);
}
}