UE-side build system progress + disable PhysX preemtively.

This commit is contained in:
Marcel Pi 2023-11-24 17:35:38 +01:00
parent 19680dcc1d
commit fb3d37fc50
18 changed files with 921 additions and 747 deletions

View File

@ -133,7 +133,7 @@ endif ()
if (BUILD_LIBCARLA_SERVER) if (BUILD_LIBCARLA_SERVER)
project (libcarla-server) project (carla-server)
set (LIBCARLA_SERVER_INCLUDE_PATHS set (LIBCARLA_SERVER_INCLUDE_PATHS
${LIBCARLA_SOURCE_PATH} ${LIBCARLA_SOURCE_PATH}
@ -141,73 +141,107 @@ if (BUILD_LIBCARLA_SERVER)
${RPCLIB_INCLUDE_PATH} ${RPCLIB_INCLUDE_PATH}
) )
file(GLOB LIBCARLA_SERVER_SOURCES file (
${LIBCARLA_SOURCE_PATH}/carla/*.h GLOB
LIBCARLA_SERVER_SOURCES
${LIBCARLA_SOURCE_PATH}/carla/Buffer.cpp ${LIBCARLA_SOURCE_PATH}/carla/Buffer.cpp
${LIBCARLA_SOURCE_PATH}/carla/Exception.cpp ${LIBCARLA_SOURCE_PATH}/carla/Exception.cpp
${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/geom/*.h
${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h
${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h
${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/SensorHeaderSerializer.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp
)
file (
GLOB
LIBCARLA_SERVER_SOURCES_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp
)
file (
GLOB
LIBCARLA_SERVER_HEADERS
${LIBCARLA_SOURCE_PATH}/carla/*.h
${LIBCARLA_SOURCE_PATH}/carla/geom/*.h
${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h
${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h
${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h
${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h
${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h
${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h
${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/SensorHeaderSerializer.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h
${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h
${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp
)
file (
GLOB
LIBCARLA_SERVER_HEADERS_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp
) )
add_library ( add_library (
libcarla-server STATIC ${LIBCARLA_SERVER_SOURCES} carla-server STATIC
${LIBCARLA_SERVER_HEADERS}
${LIBCARLA_SERVER_SOURCES}
${LIBCARLA_SERVER_HEADERS_THIRD_PARTY}
${LIBCARLA_SERVER_SOURCES_THIRD_PARTY}
) )
target_compile_options ( target_compile_options (
libcarla-server PRIVATE /EHsc carla-server PRIVATE
/EHsc
) )
target_include_directories ( target_include_directories (
libcarla-server PRIVATE ${LIBCARLA_SERVER_INCLUDE_PATHS} carla-server PRIVATE
${LIBCARLA_SERVER_INCLUDE_PATHS}
) )
target_compile_definitions ( target_compile_definitions (
libcarla-server PRIVATE carla-server PRIVATE
${CARLA_COMMON_DEFINITIONS} ${CARLA_COMMON_DEFINITIONS}
) )
install (TARGETS carla-server DESTINATION lib)
foreach (HEADER ${LIBCARLA_SERVER_HEADERS})
cmake_path (GET HEADER PARENT_PATH HEADER_PARENT)
cmake_path (RELATIVE_PATH HEADER_PARENT BASE_DIRECTORY ${LIBCARLA_SOURCE_PATH}/carla OUTPUT_VARIABLE HEADER_RELATIVE)
install (FILES ${HEADER} DESTINATION include/carla/${HEADER_RELATIVE})
endforeach ()
endif () endif ()
if (BUILD_LIBCARLA_CLIENT) if (BUILD_LIBCARLA_CLIENT)
project (libcarla-client) project (carla-client)
set (LIBCARLA_CLIENT_INCLUDE_PATHS set (
LIBCARLA_CLIENT_INCLUDE_PATHS
${LIBCARLA_SOURCE_PATH} ${LIBCARLA_SOURCE_PATH}
${BOOST_INCLUDE_PATH} ${BOOST_INCLUDE_PATH}
${RPCLIB_INCLUDE_PATH} ${RPCLIB_INCLUDE_PATH}
@ -215,80 +249,109 @@ if (BUILD_LIBCARLA_CLIENT)
${LIBPNG_INCLUDE_PATH} ${LIBPNG_INCLUDE_PATH}
) )
file (GLOB LIBCARLA_CLIENT_SOURCES file (
GLOB
LIBCARLA_CLIENT_HEADERS
${LIBCARLA_SOURCE_PATH}/carla/*.h ${LIBCARLA_SOURCE_PATH}/carla/*.h
${LIBCARLA_SOURCE_PATH}/carla/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/client/*.h ${LIBCARLA_SOURCE_PATH}/carla/client/*.h
${LIBCARLA_SOURCE_PATH}/carla/client/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/client/detail/*.h
${LIBCARLA_SOURCE_PATH}carla/client/detail/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/geom/*.h
${LIBCARLA_SOURCE_PATH}carla/client/detail/*.h ${LIBCARLA_SOURCE_PATH}/carla/image/*.h
${LIBCARLA_SOURCE_PATH}carla/geom/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/nav/*.h
${LIBCARLA_SOURCE_PATH}carla/geom/*.h ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h
${LIBCARLA_SOURCE_PATH}carla/image/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h
${LIBCARLA_SOURCE_PATH}carla/image/*.h ${LIBCARLA_SOURCE_PATH}/carla/pointcloud/*.h
${LIBCARLA_SOURCE_PATH}carla/nav/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/profiler/*.h
${LIBCARLA_SOURCE_PATH}carla/nav/*.h ${LIBCARLA_SOURCE_PATH}/carla/road/*.h
${LIBCARLA_SOURCE_PATH}carla/opendrive/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h
${LIBCARLA_SOURCE_PATH}carla/opendrive/*.h ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h
${LIBCARLA_SOURCE_PATH}carla/opendrive/parser/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h
${LIBCARLA_SOURCE_PATH}carla/opendrive/parser/*.h ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h
${LIBCARLA_SOURCE_PATH}carla/pointcloud/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h
${LIBCARLA_SOURCE_PATH}carla/pointcloud/*.h ${LIBCARLA_SOURCE_PATH}/carla/rss/*.h
${LIBCARLA_SOURCE_PATH}carla/profiler/*.h ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h
${LIBCARLA_SOURCE_PATH}carla/road/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/sensor/data/*.h
${LIBCARLA_SOURCE_PATH}carla/road/*.h ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h
${LIBCARLA_SOURCE_PATH}carla/road/element/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h
${LIBCARLA_SOURCE_PATH}carla/road/element/*.h ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h
${LIBCARLA_SOURCE_PATH}carla/road/general/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.h
${LIBCARLA_SOURCE_PATH}carla/road/general/*.h ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h
${LIBCARLA_SOURCE_PATH}carla/road/object/*.cpp ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h
${LIBCARLA_SOURCE_PATH}carla/road/object/*.h ${LIBCARLA_SOURCE_PATH}/carla/trafficmanager/*.h
${LIBCARLA_SOURCE_PATH}carla/road/signal/*.cpp )
${LIBCARLA_SOURCE_PATH}carla/road/signal/*.h
${LIBCARLA_SOURCE_PATH}carla/rpc/*.cpp
${LIBCARLA_SOURCE_PATH}carla/rpc/*.h
${LIBCARLA_SOURCE_PATH}carla/rss/*.cpp
${LIBCARLA_SOURCE_PATH}carla/rss/*.h
${LIBCARLA_SOURCE_PATH}carla/sensor/*.cpp
${LIBCARLA_SOURCE_PATH}carla/sensor/*.h
${LIBCARLA_SOURCE_PATH}carla/sensor/data/*.cpp
${LIBCARLA_SOURCE_PATH}carla/sensor/data/*.h
${LIBCARLA_SOURCE_PATH}carla/sensor/s11n/*.cpp
${LIBCARLA_SOURCE_PATH}carla/sensor/s11n/*.h
${LIBCARLA_SOURCE_PATH}carla/streaming/*.cpp
${LIBCARLA_SOURCE_PATH}carla/streaming/*.h
${LIBCARLA_SOURCE_PATH}carla/streaming/detail/*.cpp
${LIBCARLA_SOURCE_PATH}carla/streaming/detail/*.h
${LIBCARLA_SOURCE_PATH}carla/streaming/detail/tcp/*.cpp
${LIBCARLA_SOURCE_PATH}carla/streaming/detail/tcp/*.h
${LIBCARLA_SOURCE_PATH}carla/streaming/low_level/*.cpp
${LIBCARLA_SOURCE_PATH}carla/streaming/low_level/*.h
${LIBCARLA_SOURCE_PATH}carla/multigpu/*.cpp
${LIBCARLA_SOURCE_PATH}carla/multigpu/*.h
${LIBCARLA_SOURCE_PATH}carla/trafficmanager/*.cpp
${LIBCARLA_SOURCE_PATH}carla/trafficmanager/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp file (
GLOB
LIBCARLA_CLIENT_HEADERS_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.h ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.h
) )
file (
GLOB
LIBCARLA_CLIENT_SOURCES
${LIBCARLA_SOURCE_PATH}/carla/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/client/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/client/detail/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/image/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/nav/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/pointcloud/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/rss/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/sensor/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/sensor/data/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/trafficmanager/*.cpp
)
file (
GLOB
LIBCARLA_CLIENT_SOURCES_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp
)
add_library ( add_library (
libcarla-client STATIC ${LIBCARLA_CLIENT_SOURCES} carla-client STATIC
${LIBCARLA_CLIENT_HEADERS}
${LIBCARLA_CLIENT_SOURCES}
${LIBCARLA_CLIENT_HEADERS_THIRD_PARTY}
${LIBCARLA_CLIENT_SOURCES_THIRD_PARTY}
) )
target_include_directories ( target_include_directories (
libcarla-client PRIVATE ${LIBCARLA_CLIENT_INCLUDE_PATHS} carla-client PRIVATE
${LIBCARLA_CLIENT_INCLUDE_PATHS}
) )
target_compile_definitions ( target_compile_definitions (
libcarla-client PRIVATE carla-client PRIVATE
${CARLA_COMMON_DEFINITIONS} ${CARLA_COMMON_DEFINITIONS}
) )
install (TARGETS carla-client DESTINATION lib)
foreach (HEADER ${LIBCARLA_CLIENT_HEADERS})
cmake_path (GET HEADER PARENT_PATH HEADER_PARENT)
cmake_path (RELATIVE_PATH HEADER_PARENT BASE_DIRECTORY ${LIBCARLA_SOURCE_PATH}/carla OUTPUT_VARIABLE HEADER_RELATIVE)
install (FILES ${HEADER} DESTINATION include/carla/${HEADER_RELATIVE})
endforeach ()
endif () endif ()

View File

@ -4,6 +4,7 @@ import subprocess, tarfile, zipfile, argparse, requests, psutil, shutil, glob, j
# Constants: # Constants:
EXE_EXT = '.exe' if os.name == 'nt' else '' EXE_EXT = '.exe' if os.name == 'nt' else ''
LIB_PREFIX = '' if os.name == 'nt' else 'lib'
LIB_EXT = '.lib' if os.name == 'nt' else '.a' LIB_EXT = '.lib' if os.name == 'nt' else '.a'
OBJ_EXT = '.obj' if os.name == 'nt' else '.o' OBJ_EXT = '.obj' if os.name == 'nt' else '.o'
SHELL_EXT = '.bat' if os.name == 'nt' else '' SHELL_EXT = '.bat' if os.name == 'nt' else ''
@ -153,6 +154,15 @@ AddDirective(
AddDirective( AddDirective(
'chrono', 'chrono',
'Whether to enable Chrono.') 'Whether to enable Chrono.')
AddDirective(
'carsim',
'Whether to enable CarSim')
AddDirective(
'ros2',
'Whether to enable ROS2')
AddDirective(
'unity-build',
'Whether to enable Unity Build for Unreal Engine projects.')
AddDirective( AddDirective(
'osm2odr', 'osm2odr',
'Whether to enable OSM2ODR.') 'Whether to enable OSM2ODR.')
@ -229,7 +239,6 @@ def SyncArgs():
ARGV = SyncArgs() ARGV = SyncArgs()
SEQUENTIAL = ARGV.configure_sequential SEQUENTIAL = ARGV.configure_sequential
ENABLE_CHRONO = ARGV.chrono
ENABLE_OSM2ODR = ARGV.osm2odr or ARGV.python_api ENABLE_OSM2ODR = ARGV.osm2odr or ARGV.python_api
ENABLE_OSM_WORLD_RENDERER = ARGV.osm_world_renderer ENABLE_OSM_WORLD_RENDERER = ARGV.osm_world_renderer
ENABLE_PYTHON_API = ARGV.python_api ENABLE_PYTHON_API = ARGV.python_api
@ -240,7 +249,14 @@ ENABLE_LIBCARLA = any([
ENABLE_LIBCARLA_CLIENT, ENABLE_LIBCARLA_CLIENT,
ENABLE_LIBCARLA_SERVER, ENABLE_LIBCARLA_SERVER,
]) ])
ENABLE_CARSIM = ARGV.carsim
ENABLE_CHRONO = ARGV.chrono
ENABLE_ROS2 = ARGV.ros2
ENABLE_UNITY_BUILD = ARGV.unity_build
ENABLE_NVIDIA_OMNIVERSE = ARGV.nv_omniverse ENABLE_NVIDIA_OMNIVERSE = ARGV.nv_omniverse
ENABLE_RSS = ARGV.rss
UPDATE_DEPENDENCIES = ARGV.update_deps UPDATE_DEPENDENCIES = ARGV.update_deps
BUILD_DEPENDENCIES = ARGV.build_deps BUILD_DEPENDENCIES = ARGV.build_deps
PARALLELISM = ARGV.parallelism PARALLELISM = ARGV.parallelism
@ -249,8 +265,8 @@ CARLA_VERSION_STRING = ARGV.version
BUILD_PATH = Path(ARGV.build_path) BUILD_PATH = Path(ARGV.build_path)
LOG_PATH = BUILD_PATH / 'BuildLogs' LOG_PATH = BUILD_PATH / 'BuildLogs'
DEPENDENCIES_PATH = BUILD_PATH / 'Dependencies' DEPENDENCIES_PATH = BUILD_PATH / 'Dependencies'
LIBCARLA_BUILD_PATH = BUILD_PATH / 'libcarla-build' LIBCARLA_BUILD_PATH = BUILD_PATH / 'LibCarla'
LIBCARLA_INSTALL_PATH = BUILD_PATH / 'libcarla-install' LIBCARLA_INSTALL_PATH = WORKSPACE_PATH / 'Install' / 'LibCarla'
# Language options # Language options
C_COMPILER = ARGV.c_compiler C_COMPILER = ARGV.c_compiler
CPP_COMPILER = ARGV.cpp_compiler CPP_COMPILER = ARGV.cpp_compiler
@ -302,7 +318,7 @@ ZLIB_BUILD_PATH = DEPENDENCIES_PATH / 'zlib-build'
ZLIB_INSTALL_PATH = DEPENDENCIES_PATH / 'zlib-install' ZLIB_INSTALL_PATH = DEPENDENCIES_PATH / 'zlib-install'
ZLIB_INCLUDE_PATH = ZLIB_INSTALL_PATH / 'include' ZLIB_INCLUDE_PATH = ZLIB_INSTALL_PATH / 'include'
ZLIB_LIBRARY_PATH = ZLIB_INSTALL_PATH / 'lib' ZLIB_LIBRARY_PATH = ZLIB_INSTALL_PATH / 'lib'
ZLIB_LIB_PATH = ZLIB_LIBRARY_PATH / f'zlib{LIB_EXT}' ZLIB_LIB_PATH = ZLIB_LIBRARY_PATH / f'{LIB_PREFIX}zlib{LIB_EXT}'
# LibPNG # LibPNG
LIBPNG_SOURCE_PATH = DEPENDENCIES_PATH / 'libpng-source' LIBPNG_SOURCE_PATH = DEPENDENCIES_PATH / 'libpng-source'
LIBPNG_BUILD_PATH = DEPENDENCIES_PATH / 'libpng-build' LIBPNG_BUILD_PATH = DEPENDENCIES_PATH / 'libpng-build'
@ -314,7 +330,7 @@ SQLITE_SOURCE_PATH = DEPENDENCIES_PATH / 'sqlite-source'
SQLITE_BUILD_PATH = DEPENDENCIES_PATH / 'sqlite-build' SQLITE_BUILD_PATH = DEPENDENCIES_PATH / 'sqlite-build'
SQLITE_LIBRARY_PATH = SQLITE_BUILD_PATH SQLITE_LIBRARY_PATH = SQLITE_BUILD_PATH
SQLITE_INCLUDE_PATH = SQLITE_SOURCE_PATH SQLITE_INCLUDE_PATH = SQLITE_SOURCE_PATH
SQLITE_LIB_PATH = SQLITE_BUILD_PATH / f'sqlite{LIB_EXT}' SQLITE_LIB_PATH = SQLITE_BUILD_PATH / f'{LIB_PREFIX}sqlite{LIB_EXT}'
SQLITE_EXE_PATH = SQLITE_BUILD_PATH / f'sqlite{EXE_EXT}' SQLITE_EXE_PATH = SQLITE_BUILD_PATH / f'sqlite{EXE_EXT}'
# Proj # Proj
PROJ_SOURCE_PATH = DEPENDENCIES_PATH / 'proj-source' PROJ_SOURCE_PATH = DEPENDENCIES_PATH / 'proj-source'
@ -361,7 +377,13 @@ SUMO_LIBRARY_PATH = SUMO_INSTALL_PATH / 'lib'
# Nvidia Omniverse # Nvidia Omniverse
NV_OMNIVERSE_PLUGIN_PATH = UNREAL_ENGINE_PATH / 'Engine' / 'Plugins' / 'Marketplace' / 'NVIDIA' / 'Omniverse' NV_OMNIVERSE_PLUGIN_PATH = UNREAL_ENGINE_PATH / 'Engine' / 'Plugins' / 'Marketplace' / 'NVIDIA' / 'Omniverse'
NV_OMNIVERSE_PATCH_PATH = PATCHES_PATH / 'omniverse_4.26' NV_OMNIVERSE_PATCH_PATH = PATCHES_PATH / 'omniverse_4.26'
ENABLE_RSS = ARGV.rss
CARLA_UE_OPTIONAL_MODULES = (
f'CarSim {"ON" if ENABLE_CARSIM else "OFF"}\n'
f'Chrono {"ON" if ENABLE_CHRONO else "OFF"}\n'
f'Ros2 {"ON" if ENABLE_ROS2 else "OFF"}\n'
f'Unity {"ON" if ENABLE_UNITY_BUILD else "OFF"}\n'
)
# Basic IO functions: # Basic IO functions:
@ -784,23 +806,6 @@ def BuildLibCarlaMain(task_graph : TaskGraph):
LIBCARLA_BUILD_PATH, LIBCARLA_BUILD_PATH,
LIBCARLA_INSTALL_PATH)) LIBCARLA_INSTALL_PATH))
def BuildCarlaUEMain():
assert UNREAL_ENGINE_PATH.exists()
if os.name == 'nt':
LaunchSubprocessImmediate([
UNREAL_ENGINE_PATH / 'Engine' / 'Build' / 'BatchFiles' / 'Build.bat',
'CarlaUE4', 'Win64', 'Development', '-WaitMutex', '-FromMsBuild',
CARLA_UE_PATH / 'CarlaUE4.uproject'
])
else:
pass
def BuildCarlaUE(task_graph : TaskGraph):
Log('Building Carla Unreal Engine Editor')
if ENABLE_NVIDIA_OMNIVERSE:
task_graph.Add(Task('install-nv-omniverse', [], InstallNVIDIAOmniverse))
task_graph.Add(Task('build-carla-ue', [], BuildCarlaUEMain))
def BuildPythonAPIMain(): def BuildPythonAPIMain():
content = '' content = ''
with open(PYTHON_API_PATH / 'setup.py.in', 'r') as file: with open(PYTHON_API_PATH / 'setup.py.in', 'r') as file:
@ -818,7 +823,47 @@ def BuildPythonAPI(task_graph : TaskGraph):
task_graph.Add(Task('build-python-api', [ 'install-libcarla' ], BuildPythonAPIMain)) task_graph.Add(Task('build-python-api', [ 'install-libcarla' ], BuildPythonAPIMain))
def SetupUnrealEngine(task_graph : TaskGraph): def SetupUnrealEngine(task_graph : TaskGraph):
Log('Setting up Unreal Engine.') pass
def BuildCarlaUEMain():
assert UNREAL_ENGINE_PATH.exists()
unreal_build_tool_args = []
if ENABLE_CARSIM:
unreal_build_tool_args.append('-carsim')
if ENABLE_CHRONO:
unreal_build_tool_args.append('-chrono')
if ENABLE_ROS2:
unreal_build_tool_args.append('-ros2')
if ENABLE_UNITY_BUILD:
unreal_build_tool_args.append('-unity-build')
if ENABLE_NVIDIA_OMNIVERSE:
unreal_build_tool_args.append('-nv-omniverse')
if os.name == 'nt':
LaunchSubprocessImmediate([
UNREAL_ENGINE_PATH / 'Engine' / 'Build' / 'BatchFiles' / 'Build.bat',
'CarlaUE4Editor',
'Win64',
'Development',
'-WaitMutex',
'-FromMsBuild',
CARLA_UE_PATH / 'CarlaUE4.uproject',
], log_name = 'build-carla-ue-editor')
LaunchSubprocessImmediate([
UNREAL_ENGINE_PATH / 'Engine' / 'Build' / 'BatchFiles' / 'Build.bat',
'CarlaUE4',
'Win64',
'Development',
'-WaitMutex',
'-FromMsBuild',
CARLA_UE_PATH / 'CarlaUE4.uproject',
], log_name = 'build-carla-ue')
else:
pass
def BuildCarlaUE(task_graph : TaskGraph):
if ENABLE_NVIDIA_OMNIVERSE:
task_graph.Add(Task('install-nv-omniverse', [], InstallNVIDIAOmniverse))
task_graph.Add(Task('build-carla-ue', [ 'build-python-api' ], BuildCarlaUEMain))
def InstallNVIDIAOmniverse(): def InstallNVIDIAOmniverse():
filename = 'USDCarlaInterface' filename = 'USDCarlaInterface'
@ -967,7 +1012,7 @@ def BuildSQLite():
LaunchSubprocessImmediate(cmd, log_name = 'build-sqlite-lib') LaunchSubprocessImmediate(cmd, log_name = 'build-sqlite-lib')
def FindXercesC(): def FindXercesC():
return glob.glob(f'{XERCESC_INSTALL_PATH}/**/xerces-c*{LIB_EXT}', recursive=True)[0] return glob.glob(f'{XERCESC_INSTALL_PATH}/**/{LIB_PREFIX}xerces-c*{LIB_EXT}', recursive=True)[0]
def ConfigureSUMO(): def ConfigureSUMO():
cmd = Task.CreateCMakeConfigureDefaultCommandLine( cmd = Task.CreateCMakeConfigureDefaultCommandLine(
@ -979,7 +1024,7 @@ def ConfigureSUMO():
f'-DZLIB_INCLUDE_DIR={ZLIB_INCLUDE_PATH}', f'-DZLIB_INCLUDE_DIR={ZLIB_INCLUDE_PATH}',
f'-DZLIB_LIBRARY={ZLIB_LIBRARY_PATH}', f'-DZLIB_LIBRARY={ZLIB_LIBRARY_PATH}',
f'-DPROJ_INCLUDE_DIR={PROJ_INSTALL_PATH}/include', f'-DPROJ_INCLUDE_DIR={PROJ_INSTALL_PATH}/include',
f'-DPROJ_LIBRARY={PROJ_INSTALL_PATH}/lib/proj{LIB_EXT}', f'-DPROJ_LIBRARY={PROJ_INSTALL_PATH}/lib/{LIB_PREFIX}proj{LIB_EXT}',
f'-DXercesC_INCLUDE_DIR={XERCESC_INSTALL_PATH}/include', f'-DXercesC_INCLUDE_DIR={XERCESC_INSTALL_PATH}/include',
f'-DXercesC_LIBRARY={FindXercesC()}', f'-DXercesC_LIBRARY={FindXercesC()}',
'-DSUMO_LIBRARIES=OFF', '-DSUMO_LIBRARIES=OFF',

View File

@ -1,4 +1,5 @@
*.egg-info *.egg-info
setup.py
build build
dependencies dependencies
dist dist

View File

@ -1,6 +1,6 @@
{ {
"FileVersion": 3, "FileVersion": 3,
"EngineAssociation": "4.26", "EngineAssociation": "{503B4C24-4B4B-4C8C-53F3-8AB2AC13D07B}",
"Category": "", "Category": "",
"Description": "", "Description": "",
"Modules": [ "Modules": [
@ -10,7 +10,7 @@
"LoadingPhase": "Default", "LoadingPhase": "Default",
"AdditionalDependencies": [ "AdditionalDependencies": [
"Engine", "Engine",
"PhysXVehicles", "ChaosVehicles",
"Carla", "Carla",
"CoreUObject" "CoreUObject"
] ]

View File

@ -98,7 +98,7 @@ MaxSubstepDeltaTime=0.010000
MaxSubsteps=10 MaxSubsteps=10
SyncSceneSmoothingFactor=0.000000 SyncSceneSmoothingFactor=0.000000
InitialAverageFrameRate=0.016667 InitialAverageFrameRate=0.016667
PhysXTreeRebuildRate=10 # PhysXTreeRebuildRate=10
DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2) DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2)
[/Script/WindowsTargetPlatform.WindowsTargetSettings] [/Script/WindowsTargetPlatform.WindowsTargetSettings]

View File

@ -13,19 +13,22 @@
"CanContainContent": true, "CanContainContent": true,
"IsBetaVersion": true, "IsBetaVersion": true,
"Installed": true, "Installed": true,
"Modules": [ "Modules":
[
{ {
"Name": "Carla", "Name": "Carla",
"Type": "Runtime", "Type": "Runtime",
"LoadingPhase": "PreDefault", "LoadingPhase": "PreDefault",
"AdditionalDependencies": [ "AdditionalDependencies":
[
"Engine" "Engine"
] ]
} }
], ],
"Plugins": [ "Plugins":
[
{ {
"Name": "PhysXVehicles", "Name": "ChaosVehicles",
"Enabled": true "Enabled": true
}, },
{ {

View File

@ -2,80 +2,103 @@
using System; using System;
using System.IO; using System.IO;
using System.Linq;
using UnrealBuildTool; using UnrealBuildTool;
using EpicGames.Core;
using System.Diagnostics;
public class Carla : ModuleRules public class Carla :
ModuleRules
{ {
bool UsingCarSim = false; [CommandLine("-carsim")]
bool UsingChrono = false; bool EnableCarSim = false;
bool UsingPytorch = false;
bool UsingRos2 = false; [CommandLine("-chrono")]
private bool IsWindows(ReadOnlyTargetRules Target) bool EnableChrono = false;
[CommandLine("-pytorch")]
bool EnablePytorch = false;
[CommandLine("-ros2")]
bool EnableRos2 = false;
[CommandLine("-carla-install-path")]
string CarlaInstallPath = null;
[CommandLine("-carla-dependencies-path")]
string CarlaDependenciesPath = null;
public static string FindLibrary(string SearchPath, params string[] Patterns)
{ {
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32); foreach (var Pattern in Patterns)
{
var Candidates = Directory.GetFiles(SearchPath, Pattern);
if (Candidates.Length == 0)
continue;
Array.Sort(Candidates);
return Candidates[0];
}
return null;
} }
public Carla(ReadOnlyTargetRules Target) : base(Target) public Carla(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(Directory.Exists(WorkspacePath));
if (CarlaInstallPath == null)
{
Console.WriteLine("-carla-install-path was not specified, inferring...");
CarlaInstallPath = Path.Combine(WorkspacePath, "Install", "libcarla");
Debug.Assert(Directory.Exists(CarlaInstallPath), "Could not infer CARLA install directory.");
}
if (CarlaDependenciesPath == null)
{
Console.WriteLine("-carla-dependencies-path was not specified, inferring...");
CarlaDependenciesPath = Path.Combine(WorkspacePath, "Build", "Dependencies");
Debug.Assert(Directory.Exists(CarlaDependenciesPath), "Could not infer CARLA dependencies directory.");
}
bool IsWindows = Target.Platform == UnrealTargetPlatform.Win64;
bEnableExceptions = bEnableExceptions || IsWindows;
PrivatePCHHeaderFile = "Carla.h"; PrivatePCHHeaderFile = "Carla.h";
if (IsWindows(Target)) if (EnableCarSim)
{ {
bEnableExceptions = true;
}
// Read config about carsim
string CarlaPluginPath = Path.GetFullPath( ModuleDirectory );
string ConfigDir = Path.GetFullPath(Path.Combine(CarlaPluginPath, "../../../../Config/"));
string OptionalModulesFile = Path.Combine(ConfigDir, "OptionalModules.ini");
string[] text = System.IO.File.ReadAllLines(OptionalModulesFile);
foreach (string line in text)
{
if (line.Contains("CarSim ON"))
{
Console.WriteLine("Enabling carsim");
UsingCarSim = true;
PublicDefinitions.Add("WITH_CARSIM"); PublicDefinitions.Add("WITH_CARSIM");
PrivateDefinitions.Add("WITH_CARSIM"); PrivateDefinitions.Add("WITH_CARSIM");
} }
if (line.Contains("Chrono ON"))
if (EnableChrono)
{ {
Console.WriteLine("Enabling chrono");
UsingChrono = true;
PublicDefinitions.Add("WITH_CHRONO"); PublicDefinitions.Add("WITH_CHRONO");
PrivateDefinitions.Add("WITH_CHRONO"); PrivateDefinitions.Add("WITH_CHRONO");
} }
if (line.Contains("Pytorch ON"))
if (EnablePytorch)
{ {
Console.WriteLine("Enabling pytorch");
UsingPytorch = true;
PublicDefinitions.Add("WITH_PYTORCH"); PublicDefinitions.Add("WITH_PYTORCH");
PrivateDefinitions.Add("WITH_PYTORCH"); PrivateDefinitions.Add("WITH_PYTORCH");
} }
if (line.Contains("Ros2 ON")) if (EnableRos2)
{ {
Console.WriteLine("Enabling ros2");
UsingRos2 = true;
PublicDefinitions.Add("WITH_ROS2"); PublicDefinitions.Add("WITH_ROS2");
PrivateDefinitions.Add("WITH_ROS2"); PrivateDefinitions.Add("WITH_ROS2");
} }
}
PublicIncludePaths.AddRange( // PublicIncludePaths.AddRange(new string[] { });
new string[] { // PrivateIncludePaths.AddRange(new string[] { });
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange( PublicDependencyModuleNames.AddRange(new string[]
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{ {
"Core", "Core",
"RenderCore", "RenderCore",
@ -83,21 +106,19 @@ public class Carla : ModuleRules
"Renderer", "Renderer",
"ProceduralMeshComponent", "ProceduralMeshComponent",
"MeshDescription" "MeshDescription"
// ... add other public dependencies that you statically link with here ... });
}
); if (EnableCarSim)
if (UsingCarSim)
{ {
PublicDependencyModuleNames.AddRange(new string[] { "CarSim" }); PublicDependencyModuleNames.Add("CarSim");
} }
if (Target.Type == TargetType.Editor) if (Target.Type == TargetType.Editor)
{ {
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd" }); PublicDependencyModuleNames.Add("UnrealEd");
} }
PrivateDependencyModuleNames.AddRange( PrivateDependencyModuleNames.AddRange(new string[]
new string[]
{ {
"AIModule", "AIModule",
"AssetRegistry", "AssetRegistry",
@ -110,53 +131,120 @@ public class Carla : ModuleRules
"Json", "Json",
"JsonUtilities", "JsonUtilities",
"Landscape", "Landscape",
"PhysX", "Chaos",
"PhysXVehicles", "ChaosVehicles",
"PhysXVehicleLib", "ChaosVehicleLib",
"Slate", "Slate",
"SlateCore", "SlateCore",
"PhysicsCore" "PhysicsCore"
// ... add private dependencies that you statically link with here ... });
}
); if (EnableCarSim)
if (UsingCarSim)
{ {
PrivateDependencyModuleNames.AddRange(new string[] { "CarSim" }); PrivateDependencyModuleNames.Add("CarSim");
PrivateIncludePathModuleNames.AddRange(new string[] { "CarSim" }); PrivateIncludePathModuleNames.Add("CarSim");
} }
// DynamicallyLoadedModuleNames.AddRange(new string[] { });
DynamicallyLoadedModuleNames.AddRange( var LibraryPrefix = IsWindows ? "" : "lib";
new string[] var LibrarySuffix = IsWindows ? ".lib" : ".a";
{
// ... add any modules that your module loads dynamically here ...
}
);
AddCarlaServerDependency(Target); Func<string, string> GetLibraryName = name =>
} {
return LibraryPrefix + name + LibrarySuffix;
};
private bool UseDebugLibs(ReadOnlyTargetRules Target) var LibCarlaInstallPath = CarlaInstallPath;
var DependenciesInstallPath = CarlaDependenciesPath;
// 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
var BoostInstallPath = Path.Combine(DependenciesInstallPath, "boost-install");
var BoostLibPath = Path.Combine(BoostInstallPath, "lib");
var BoostLibraryPatterns = new string[]
{ {
if (IsWindows(Target)) GetLibraryName("*boost_asio*"),
GetLibraryName("*boost_python*"),
};
var BoostLibraries =
from Pattern in BoostLibraryPatterns
select FindLibrary(BoostLibPath, Pattern);
// Chrono
var ChronoInstallPath = Path.Combine(DependenciesInstallPath, "chrono-install");
var ChronoLibPath = Path.Combine(ChronoInstallPath, "lib");
var ChronoLibraryNames = new string[]
{ {
// In Windows, Unreal uses the Release C++ Runtime (CRT) even in debug "ChronoEngine",
// mode, so unless we recompile the engine we cannot link the debug "ChronoEngine_vehicle",
// libraries. "ChronoModels_vehicle",
return false; "ChronoModels_robot",
} };
else var ChronoLibraries =
from Name in ChronoLibraryNames
select FindLibrary(Name);
// SQLite
var SQLiteBuildPath = Path.Combine(DependenciesInstallPath, "sqlite-build");
var SQLiteLibrary = FindLibrary(SQLiteBuildPath, GetLibraryName("sqlite*"));
// RPCLib
var RPCLibInstallPath = Path.Combine(DependenciesInstallPath, "rpclib-install");
var RPCLibPath = Path.Combine(RPCLibInstallPath, "lib");
var RPCLibraryPath = FindLibrary(RPCLibPath, "rpc");
// Xerces-C
var XercesCInstallPath = Path.Combine(DependenciesInstallPath, "xercesc-install");
var XercesCLibPath = Path.Combine(XercesCInstallPath, "lib");
var XercesCLibrary = FindLibrary(XercesCLibPath, "xercesc*");
// Proj
var ProjInstallPath = Path.Combine(DependenciesInstallPath, "proj-install");
var ProjLibPath = Path.Combine(ProjInstallPath, "lib");
var ProjLibrary = FindLibrary(ProjLibPath, "proj*");
// SUMO (OSM2ODR)
var SUMOInstallPath = Path.Combine(DependenciesInstallPath, "sumo-install");
var SUMOLibPath = Path.Combine(SUMOInstallPath, "lib");
var SUMOLibrary = FindLibrary(SUMOLibPath, "sumo*");
// ZLib
var ZLibInstallPath = Path.Combine(DependenciesInstallPath, "zlib-install");
var ZLibLibPath = Path.Combine(ZLibInstallPath, "lib");
var ZLibLibrary = FindLibrary(ZLibLibPath, "zlib*");
PublicAdditionalLibraries.AddRange(BoostLibraries);
PublicAdditionalLibraries.AddRange(ChronoLibraries);
PublicAdditionalLibraries.AddRange(new string[]
{ {
return false; SQLiteLibrary,
RPCLibraryPath,
XercesCLibrary,
ProjLibrary,
SUMOLibrary,
ZLibLibrary,
});
PublicIncludePaths.Add(LibCarlaIncludePath);
PrivateIncludePaths.Add(LibCarlaIncludePath);
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
if (!bEnableExceptions)
{
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
} }
} }
#if false
private void AddDynamicLibrary(string library) private void AddDynamicLibrary(string library)
{ {
PublicAdditionalLibraries.Add(library); PublicAdditionalLibraries.Add(library);
RuntimeDependencies.Add(library); RuntimeDependencies.Add(library);
PublicDelayLoadDLLs.Add(library); PublicDelayLoadDLLs.Add(library);
} }
private void AddDllDependency(string PathToFolder, string DllName) private void AddDllDependency(string PathToFolder, string DllName)
{ {
string Source = Path.Combine(PathToFolder, DllName); string Source = Path.Combine(PathToFolder, DllName);
@ -164,33 +252,16 @@ public class Carla : ModuleRules
RuntimeDependencies.Add(Destination, Source); RuntimeDependencies.Add(Destination, Source);
} }
delegate string ADelegate(string s);
private void AddBoostLibs(string LibPath)
{
string [] files = Directory.GetFiles(LibPath, "*boost*.lib");
foreach (string file in files) PublicAdditionalLibraries.Add(file);
}
private void AddCarlaServerDependency(ReadOnlyTargetRules Target) private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
{ {
string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies")); string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../CarlaDependencies"));
ADelegate GetLibName = (string BaseName) => {
if (IsWindows(Target))
{
return BaseName + ".lib";
}
else
{
return "lib" + BaseName + ".a";
}
};
// Link dependencies. // Link dependencies.
if (IsWindows(Target)) if (IsWindows)
{ {
AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib")); foreach (string file in Directory.GetFiles(Path.Combine(LibCarlaInstallPath, "lib"), "*boost*.lib"))
PublicAdditionalLibraries.Add(file);
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc")));
if (UseDebugLibs(Target)) if (UseDebugLibs(Target))
@ -201,7 +272,7 @@ public class Carla : ModuleRules
{ {
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
} }
if (UsingChrono) if (EnableChrono)
{ {
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine")));
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine_vehicle"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("ChronoEngine_vehicle")));
@ -232,7 +303,7 @@ public class Carla : ModuleRules
{ {
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
} }
if (UsingChrono) if (EnableChrono)
{ {
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine.so")); AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine.so"));
AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine_vehicle.so")); AddDynamicLibrary(Path.Combine(LibCarlaInstallPath, "lib", "libChronoEngine_vehicle.so"));
@ -242,7 +313,7 @@ public class Carla : ModuleRules
bUseRTTI = true; bUseRTTI = true;
} }
if (UsingPytorch) if (EnablePytorch)
{ {
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_pytorch"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_pytorch")));
@ -316,7 +387,7 @@ public class Carla : ModuleRules
PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libpython3.9.so"); PublicAdditionalLibraries.Add("/usr/lib/x86_64-linux-gnu/libpython3.9.so");
} }
if (UsingRos2) if (EnableRos2)
{ {
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_fastdds"))); PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_fastdds")));
@ -351,4 +422,5 @@ public class Carla : ModuleRules
PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS"); PublicDefinitions.Add("BOOST_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY"); PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
} }
#endif
} }

View File

@ -13,8 +13,7 @@
#include "DrawDebugHelpers.h" #include "DrawDebugHelpers.h"
#include "Kismet/KismetSystemLibrary.h" #include "Kismet/KismetSystemLibrary.h"
#include "PhysXPublic.h" #if 0 // @CARLAUE5
#include "PhysXVehicleManager.h"
#include "TireConfig.h" #include "TireConfig.h"
#include "VehicleWheel.h" #include "VehicleWheel.h"
@ -1134,3 +1133,4 @@ void ACarlaWheeledVehicle::SetPhysicsConstraintAngle(
{ {
Component->ConstraintInstance.AngularRotationOffset = NewAngle; Component->ConstraintInstance.AngularRotationOffset = NewAngle;
} }
#endif

View File

@ -6,14 +6,12 @@
#include "WheeledVehicleMovementComponentNW.h" #include "WheeledVehicleMovementComponentNW.h"
#include "PhysicsPublic.h" #include "PhysicsPublic.h"
#include "PhysXPublic.h"
#include "PhysXVehicleManager.h"
#include "Components/PrimitiveComponent.h" #include "Components/PrimitiveComponent.h"
#include "Logging/MessageLog.h" #include "Logging/MessageLog.h"
UWheeledVehicleMovementComponentNW::UWheeledVehicleMovementComponentNW(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) UWheeledVehicleMovementComponentNW::UWheeledVehicleMovementComponentNW(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{ {
// grab default values from physx #if 0 // @CARLAUE5
PxVehicleEngineData DefEngineData; PxVehicleEngineData DefEngineData;
EngineSetup.MOI = DefEngineData.mMOI; EngineSetup.MOI = DefEngineData.mMOI;
EngineSetup.MaxRPM = OmegaToRPM(DefEngineData.mMaxOmega); EngineSetup.MaxRPM = OmegaToRPM(DefEngineData.mMaxOmega);
@ -65,11 +63,13 @@ UWheeledVehicleMovementComponentNW::UWheeledVehicleMovementComponentNW(const FOb
DifferentialSetup.SetNum(NbrWheels); DifferentialSetup.SetNum(NbrWheels);
IdleBrakeInput = 10; IdleBrakeInput = 10;
#endif
} }
#if WITH_EDITOR #if WITH_EDITOR
void UWheeledVehicleMovementComponentNW::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) void UWheeledVehicleMovementComponentNW::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{ {
#if 0 // @CARLAUE5
Super::PostEditChangeProperty(PropertyChangedEvent); Super::PostEditChangeProperty(PropertyChangedEvent);
const FName PropertyName = PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() : NAME_None; const FName PropertyName = PropertyChangedEvent.Property ? PropertyChangedEvent.Property->GetFName() : NAME_None;
@ -99,9 +99,11 @@ void UWheeledVehicleMovementComponentNW::PostEditChangeProperty(struct FProperty
SteeringCurve.GetRichCurve()->UpdateOrAddKey(SteerKeys[KeyIdx].Time, NewValue); SteeringCurve.GetRichCurve()->UpdateOrAddKey(SteerKeys[KeyIdx].Time, NewValue);
} }
} }
#endif
} }
#endif #endif
#if 0 // @CARLAUE5
static void GetVehicleDifferentialNWSetup(const TArray<FVehicleNWWheelDifferentialData>& Setup, PxVehicleDifferentialNWData& PxSetup) static void GetVehicleDifferentialNWSetup(const TArray<FVehicleNWWheelDifferentialData>& Setup, PxVehicleDifferentialNWData& PxSetup)
{ {
for (int32 i = 0; i < Setup.Num(); ++i) for (int32 i = 0; i < Setup.Num(); ++i)
@ -109,9 +111,11 @@ static void GetVehicleDifferentialNWSetup(const TArray<FVehicleNWWheelDifferenti
PxSetup.setDrivenWheel(i, Setup[i].bDriven); PxSetup.setDrivenWheel(i, Setup[i].bDriven);
} }
} }
#endif
float FVehicleNWEngineData::FindPeakTorque() const float FVehicleNWEngineData::FindPeakTorque() const
{ {
#if 0 // @CARLAUE5
// Find max torque // Find max torque
float PeakTorque = 0.0f; float PeakTorque = 0.0f;
TArray<FRichCurveKey> TorqueKeys = TorqueCurve.GetRichCurveConst()->GetCopyOfKeys(); TArray<FRichCurveKey> TorqueKeys = TorqueCurve.GetRichCurveConst()->GetCopyOfKeys();
@ -121,8 +125,10 @@ float FVehicleNWEngineData::FindPeakTorque() const
PeakTorque = FMath::Max(PeakTorque, Key.Value); PeakTorque = FMath::Max(PeakTorque, Key.Value);
} }
return PeakTorque; return PeakTorque;
#endif
} }
#if 0 // @CARLAUE5
static void GetVehicleEngineSetup(const FVehicleNWEngineData& Setup, PxVehicleEngineData& PxSetup) static void GetVehicleEngineSetup(const FVehicleNWEngineData& Setup, PxVehicleEngineData& PxSetup)
{ {
PxSetup.mMOI = M2ToCm2(Setup.MOI); PxSetup.mMOI = M2ToCm2(Setup.MOI);
@ -169,12 +175,18 @@ static void GetVehicleAutoBoxSetup(const FVehicleNWTransmissionData& Setup, PxVe
PxSetup.setLatency(Setup.GearAutoBoxLatency); PxSetup.setLatency(Setup.GearAutoBoxLatency);
} }
#endif
int32 UWheeledVehicleMovementComponentNW::GetCustomGearBoxNumForwardGears() const int32 UWheeledVehicleMovementComponentNW::GetCustomGearBoxNumForwardGears() const
{ {
#if 0 // @CARLAUE5
return TransmissionSetup.ForwardGears.Num(); return TransmissionSetup.ForwardGears.Num();
#else
return 0;
#endif
} }
#if 0 // @CARLAUE5
void SetupDriveHelper(const UWheeledVehicleMovementComponentNW* VehicleData, const PxVehicleWheelsSimData* PWheelsSimData, PxVehicleDriveSimDataNW& DriveData) void SetupDriveHelper(const UWheeledVehicleMovementComponentNW* VehicleData, const PxVehicleWheelsSimData* PWheelsSimData, PxVehicleDriveSimDataNW& DriveData)
{ {
PxVehicleDifferentialNWData DifferentialSetup; PxVehicleDifferentialNWData DifferentialSetup;
@ -198,9 +210,11 @@ void SetupDriveHelper(const UWheeledVehicleMovementComponentNW* VehicleData, con
GetVehicleAutoBoxSetup(VehicleData->TransmissionSetup, AutoBoxSetup); GetVehicleAutoBoxSetup(VehicleData->TransmissionSetup, AutoBoxSetup);
DriveData.setAutoBoxData(AutoBoxSetup); DriveData.setAutoBoxData(AutoBoxSetup);
} }
#endif
void UWheeledVehicleMovementComponentNW::SetupVehicle() void UWheeledVehicleMovementComponentNW::SetupVehicle()
{ {
#if 0 // @CARLAUE5
if (!UpdatedPrimitive) if (!UpdatedPrimitive)
{ {
return; return;
@ -267,11 +281,12 @@ void UWheeledVehicleMovementComponentNW::SetupVehicle()
PVehicleDrive = PVehicleDriveNW; PVehicleDrive = PVehicleDriveNW;
SetUseAutoGears(TransmissionSetup.bUseGearAutoBox); SetUseAutoGears(TransmissionSetup.bUseGearAutoBox);
#endif
} }
void UWheeledVehicleMovementComponentNW::UpdateSimulation(float DeltaTime) void UWheeledVehicleMovementComponentNW::UpdateSimulation(float DeltaTime)
{ {
#if 0 // @CARLAUE5
if (PVehicleDrive == nullptr) if (PVehicleDrive == nullptr)
return; return;
@ -309,10 +324,12 @@ void UWheeledVehicleMovementComponentNW::UpdateSimulation(float DeltaTime)
PxVehicleDriveNW* PVehicleDriveNW = (PxVehicleDriveNW*)PVehicleDrive; PxVehicleDriveNW* PVehicleDriveNW = (PxVehicleDriveNW*)PVehicleDrive;
PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs(SmoothData, SpeedSteerLookup, RawInputData, DeltaTime, false, *PVehicleDriveNW); PxVehicleDriveNWSmoothAnalogRawInputsAndSetAnalogInputs(SmoothData, SpeedSteerLookup, RawInputData, DeltaTime, false, *PVehicleDriveNW);
}); });
#endif
} }
void UWheeledVehicleMovementComponentNW::UpdateEngineSetup(const FVehicleNWEngineData& NewEngineSetup) void UWheeledVehicleMovementComponentNW::UpdateEngineSetup(const FVehicleNWEngineData& NewEngineSetup)
{ {
#if 0 // @CARLAUE5
if (PVehicleDrive) if (PVehicleDrive)
{ {
PxVehicleEngineData EngineData; PxVehicleEngineData EngineData;
@ -321,10 +338,12 @@ void UWheeledVehicleMovementComponentNW::UpdateEngineSetup(const FVehicleNWEngin
PxVehicleDriveNW* PVehicleDriveNW = (PxVehicleDriveNW*)PVehicleDrive; PxVehicleDriveNW* PVehicleDriveNW = (PxVehicleDriveNW*)PVehicleDrive;
PVehicleDriveNW->mDriveSimData.setEngineData(EngineData); PVehicleDriveNW->mDriveSimData.setEngineData(EngineData);
} }
#endif
} }
void UWheeledVehicleMovementComponentNW::UpdateDifferentialSetup(const TArray<FVehicleNWWheelDifferentialData>& NewDifferentialSetup) void UWheeledVehicleMovementComponentNW::UpdateDifferentialSetup(const TArray<FVehicleNWWheelDifferentialData>& NewDifferentialSetup)
{ {
#if 0 // @CARLAUE5
if (PVehicleDrive) if (PVehicleDrive)
{ {
PxVehicleDifferentialNWData DifferentialData; PxVehicleDifferentialNWData DifferentialData;
@ -333,10 +352,12 @@ void UWheeledVehicleMovementComponentNW::UpdateDifferentialSetup(const TArray<FV
PxVehicleDriveNW* PVehicleDriveNW = (PxVehicleDriveNW*)PVehicleDrive; PxVehicleDriveNW* PVehicleDriveNW = (PxVehicleDriveNW*)PVehicleDrive;
PVehicleDriveNW->mDriveSimData.setDiffData(DifferentialData); PVehicleDriveNW->mDriveSimData.setDiffData(DifferentialData);
} }
#endif
} }
void UWheeledVehicleMovementComponentNW::UpdateTransmissionSetup(const FVehicleNWTransmissionData& NewTransmissionSetup) void UWheeledVehicleMovementComponentNW::UpdateTransmissionSetup(const FVehicleNWTransmissionData& NewTransmissionSetup)
{ {
#if 0 // @CARLAUE5
if (PVehicleDrive) if (PVehicleDrive)
{ {
PxVehicleGearsData GearData; PxVehicleGearsData GearData;
@ -349,8 +370,10 @@ void UWheeledVehicleMovementComponentNW::UpdateTransmissionSetup(const FVehicleN
PVehicleDriveNW->mDriveSimData.setGearsData(GearData); PVehicleDriveNW->mDriveSimData.setGearsData(GearData);
PVehicleDriveNW->mDriveSimData.setAutoBoxData(AutoBoxData); PVehicleDriveNW->mDriveSimData.setAutoBoxData(AutoBoxData);
} }
#endif
} }
#if 0 // @CARLAUE5
void BackwardsConvertCm2ToM2NW(float& val, float defaultValue) void BackwardsConvertCm2ToM2NW(float& val, float defaultValue)
{ {
if (val != defaultValue) if (val != defaultValue)
@ -358,9 +381,11 @@ void BackwardsConvertCm2ToM2NW(float& val, float defaultValue)
val = Cm2ToM2(val); val = Cm2ToM2(val);
} }
} }
#endif
void UWheeledVehicleMovementComponentNW::Serialize(FArchive& Ar) void UWheeledVehicleMovementComponentNW::Serialize(FArchive& Ar)
{ {
#if 0 // @CARLAUE5
Super::Serialize(Ar); Super::Serialize(Ar);
if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_VEHICLES_UNIT_CHANGE) if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_VEHICLES_UNIT_CHANGE)
{ {
@ -383,14 +408,18 @@ void UWheeledVehicleMovementComponentNW::Serialize(FArchive& Ar)
BackwardsConvertCm2ToM2NW(EngineSetup.MOI, DefEngineData.mMOI); BackwardsConvertCm2ToM2NW(EngineSetup.MOI, DefEngineData.mMOI);
BackwardsConvertCm2ToM2NW(TransmissionSetup.ClutchStrength, DefClutchData.mStrength); BackwardsConvertCm2ToM2NW(TransmissionSetup.ClutchStrength, DefClutchData.mStrength);
} }
#endif
} }
void UWheeledVehicleMovementComponentNW::ComputeConstants() void UWheeledVehicleMovementComponentNW::ComputeConstants()
{ {
Super::ComputeConstants(); Super::ComputeConstants();
#if 0 // @CARLAUE5
MaxEngineRPM = EngineSetup.MaxRPM; MaxEngineRPM = EngineSetup.MaxRPM;
#endif
} }
#if 0 // @CARLAUE5
const void* UWheeledVehicleMovementComponentNW::GetTireData(physx::PxVehicleWheels* InWheels, UVehicleWheel* InWheel) const void* UWheeledVehicleMovementComponentNW::GetTireData(physx::PxVehicleWheels* InWheels, UVehicleWheel* InWheel)
{ {
const void* realShaderData = &InWheels->mWheelsSimData.getTireData((PxU32)InWheel->WheelIndex); const void* realShaderData = &InWheels->mWheelsSimData.getTireData((PxU32)InWheel->WheelIndex);
@ -408,3 +437,4 @@ const physx::PxVehicleWheelData UWheeledVehicleMovementComponentNW::GetWheelData
const physx::PxVehicleWheelData WheelData = InWheels->mWheelsSimData.getWheelData((physx::PxU32)InWheel); const physx::PxVehicleWheelData WheelData = InWheels->mWheelsSimData.getWheelData((physx::PxU32)InWheel);
return WheelData; return WheelData;
} }
#endif

View File

@ -9,11 +9,6 @@
#include "Curves/CurveFloat.h" #include "Curves/CurveFloat.h"
#include "WheeledVehicleMovementComponentNW.generated.h" #include "WheeledVehicleMovementComponentNW.generated.h"
namespace physx
{
class PxVehicleWheelData;
}
USTRUCT() USTRUCT()
struct FVehicleNWWheelDifferentialData struct FVehicleNWWheelDifferentialData
{ {
@ -145,9 +140,11 @@ class CARLA_API UWheeledVehicleMovementComponentNW : public UWheeledVehicleMovem
protected: protected:
#if 0 // @CARLAUE5
virtual const void* GetTireData(physx::PxVehicleWheels* Wheels, UVehicleWheel* Wheel); virtual const void* GetTireData(physx::PxVehicleWheels* Wheels, UVehicleWheel* Wheel);
virtual const int32 GetWheelShapeMapping(physx::PxVehicleWheels* Wheels, uint32 Wheel); virtual const int32 GetWheelShapeMapping(physx::PxVehicleWheels* Wheels, uint32 Wheel);
virtual const physx::PxVehicleWheelData GetWheelData(physx::PxVehicleWheels* Wheels, uint32 Wheel); virtual const physx::PxVehicleWheelData GetWheelData(physx::PxVehicleWheels* Wheels, uint32 Wheel);
#endif
/** Allocate and setup the PhysX vehicle */ /** Allocate and setup the PhysX vehicle */
virtual void SetupVehicle() override; virtual void SetupVehicle() override;

View File

@ -6,37 +6,24 @@
using UnrealBuildTool; using UnrealBuildTool;
public class CarlaExporter : ModuleRules public class CarlaExporter :
ModuleRules
{ {
public CarlaExporter(ReadOnlyTargetRules Target) : base(Target) public CarlaExporter(ReadOnlyTargetRules Target) :
base(Target)
{ {
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange( // PublicIncludePaths.AddRange(new string[] { });
new string[] {
// ... add public include paths required here ...
}
);
// PrivateIncludePaths.AddRange(new string[] { });
PrivateIncludePaths.AddRange( PublicDependencyModuleNames.AddRange(new string[]
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{ {
"Core", "Core",
// ... add other public dependencies that you statically link with here ... });
}
);
PrivateDependencyModuleNames.AddRange(new string[]
PrivateDependencyModuleNames.AddRange(
new string[]
{ {
"Projects", "Projects",
"InputCore", "InputCore",
@ -46,18 +33,10 @@ public class CarlaExporter : ModuleRules
"Engine", "Engine",
"Slate", "Slate",
"SlateCore", "SlateCore",
"Physx", "Chaos",
"EditorStyle" "EditorStyle",
// ... add private dependencies that you statically link with here ... });
}
);
// DynamicallyLoadedModuleNames.AddRange(new string[] { });
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
} }
} }

View File

@ -15,14 +15,9 @@
#include "Components/InstancedStaticMeshComponent.h" #include "Components/InstancedStaticMeshComponent.h"
#include "PhysicsEngine/BodySetup.h" #include "PhysicsEngine/BodySetup.h"
#include "PhysicsEngine/ConvexElem.h" #include "PhysicsEngine/ConvexElem.h"
#include "PxTriangleMesh.h"
#include "PxVec3.h"
#include "LevelEditor.h" #include "LevelEditor.h"
#include "EngineUtils.h" #include "EngineUtils.h"
#include "PhysXPublic.h"
#include "PhysicsPublic.h" #include "PhysicsPublic.h"
#include "PhysXIncludes.h"
#include "PxSimpleTypes.h"
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>

View File

@ -31,7 +31,7 @@
"Enabled": true "Enabled": true
}, },
{ {
"Name": "PhysXVehicles", "Name": "ChaosVehicles",
"Enabled": true "Enabled": true
}, },
{ {

View File

@ -3,71 +3,81 @@
using System; using System;
using System.IO; using System.IO;
using UnrealBuildTool; using UnrealBuildTool;
using EpicGames.Core;
using System.Linq;
using System.Diagnostics;
public class CarlaTools : ModuleRules public class CarlaTools :
ModuleRules
{ {
bool UsingHoudini = true; [CommandLine("-houdini")]
bool bUsingOmniverseConnector = false; bool EnableHoudini = false;
private bool IsWindows(ReadOnlyTargetRules Target)
[CommandLine("-nv-omniverse")]
bool EnableNVIDIAOmniverse = false;
[CommandLine("-carla-install-path")]
string CarlaInstallPath = null;
[CommandLine("-carla-dependencies-install-path")]
string CarlaDependenciesPath = null;
public static string FindLibrary(string SearchPath, params string[] Patterns)
{ {
return (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32); foreach (var Pattern in Patterns)
{
var Candidates = Directory.GetFiles(SearchPath, Pattern);
if (Candidates.Length == 0)
continue;
Array.Sort(Candidates);
return Candidates[0];
}
return null;
} }
public CarlaTools(ReadOnlyTargetRules Target) : base(Target) public CarlaTools(ReadOnlyTargetRules Target) :
base(Target)
{ {
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; bool IsWindows = Target.Platform == UnrealTargetPlatform.Win64;
var DirectoryInfo = new DirectoryInfo(ModuleDirectory);
for (int i = 0; i != 6; ++i)
DirectoryInfo = DirectoryInfo.Parent;
var WorkspacePath = DirectoryInfo.ToString();
Debug.Assert(Directory.Exists(WorkspacePath));
if (CarlaInstallPath == null)
{
Console.WriteLine("-carla-install-path was not specified, inferring...");
CarlaInstallPath = Path.Combine(WorkspacePath, "Install", "libcarla");
Debug.Assert(Directory.Exists(CarlaInstallPath), "Could not infer CARLA install directory.");
}
if (CarlaDependenciesPath == null)
{
Console.WriteLine("-carla-dependencies-path was not specified, inferring...");
CarlaDependenciesPath = Path.Combine(WorkspacePath, "Build", "Dependencies");
Debug.Assert(Directory.Exists(CarlaDependenciesPath), "Could not infer CARLA dependencies directory.");
}
bEnableExceptions = bEnableExceptions || IsWindows;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
// PrivatePCHHeaderFile = "Carla.h"; // PrivatePCHHeaderFile = "Carla.h";
if (IsWindows(Target)) // PublicIncludePaths.AddRange(new string[] { });
{ // PrivateIncludePaths.AddRange(new string[] { });
bEnableExceptions = true;
}
string CarlaPluginPath = Path.GetFullPath( ModuleDirectory ); PublicDependencyModuleNames.AddRange(new string[]
string ConfigDir = Path.GetFullPath(Path.Combine(CarlaPluginPath, "../../../../Config/"));
string OptionalModulesFile = Path.Combine(ConfigDir, "OptionalModules.ini");
string[] text = System.IO.File.ReadAllLines(OptionalModulesFile);
foreach (string line in text)
{
if (line.Contains("Omniverse ON"))
{
Console.WriteLine("Enabling OmniverseConnector");
bUsingOmniverseConnector = true;
PublicDefinitions.Add("WITH_OMNIVERSE");
PrivateDefinitions.Add("WITH_OMNIVERSE");
}
}
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{ {
"Core", "Core",
"ProceduralMeshComponent", "ProceduralMeshComponent",
"MeshDescription", "MeshDescription",
"RawMesh", "RawMesh",
"AssetTools" "AssetTools"
// ... add other public dependencies that you statically link with here ... });
}
);
PrivateDependencyModuleNames.AddRange(new string[]
PrivateDependencyModuleNames.AddRange(
new string[]
{ {
"CoreUObject", "CoreUObject",
"Engine", "Engine",
@ -83,7 +93,7 @@ public class CarlaTools : ModuleRules
"MeshMergeUtilities", "MeshMergeUtilities",
"Carla", "Carla",
"StaticMeshDescription", "StaticMeshDescription",
"PhysXVehicles", "ChaosVehicles",
"Json", "Json",
"JsonUtilities", "JsonUtilities",
"Networking", "Networking",
@ -94,118 +104,107 @@ public class CarlaTools : ModuleRules
"MeshMergeUtilities", "MeshMergeUtilities",
"StreetMapImporting", "StreetMapImporting",
"StreetMapRuntime" "StreetMapRuntime"
// ... add private dependencies that you statically link with here ... });
}
); if (EnableHoudini)
if(UsingHoudini)
{ {
PrivateDependencyModuleNames.AddRange( PrivateDependencyModuleNames.AddRange(new string[]
new string[]
{ {
"HoudiniEngine", "HoudiniEngine",
"HoudiniEngineEditor", "HoudiniEngineEditor",
"HoudiniEngineRuntime" "HoudiniEngineRuntime"
}); });
} }
if(bUsingOmniverseConnector)
if (EnableNVIDIAOmniverse)
{ {
PrivateDependencyModuleNames.AddRange( PrivateDependencyModuleNames.AddRange(new string[]
new string[]
{ {
"OmniverseUSD", "OmniverseUSD",
"OmniverseRuntime" "OmniverseRuntime"
}); });
} }
DynamicallyLoadedModuleNames.AddRange( // DynamicallyLoadedModuleNames.AddRange(new string[] { });
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
AddCarlaServerDependency(Target);
}
private bool UseDebugLibs(ReadOnlyTargetRules Target) var LibraryPrefix = IsWindows ? "" : "lib";
{ var LibrarySuffix = IsWindows ? ".lib" : ".a";
if (IsWindows(Target))
{
// In Windows, Unreal uses the Release C++ Runtime (CRT) even in debug
// mode, so unless we recompile the engine we cannot link the debug
// libraries.
return false;
}
else
{
return false;
}
}
delegate string ADelegate(string s); Func<string, string> GetLibraryName = name =>
private void AddBoostLibs(string LibPath)
{ {
string [] files = Directory.GetFiles(LibPath, "*boost*.lib"); return LibraryPrefix + name + LibrarySuffix;
foreach (string file in files)
{
PublicAdditionalLibraries.Add(file);
}
}
private void AddCarlaServerDependency(ReadOnlyTargetRules Target)
{
string LibCarlaInstallPath = Path.GetFullPath(Path.Combine(ModuleDirectory, "../../../Carla/CarlaDependencies"));
ADelegate GetLibName = (string BaseName) => {
if (IsWindows(Target))
{
return BaseName + ".lib";
}
else
{
return "lib" + BaseName + ".a";
}
}; };
// Link dependencies. var LibCarlaInstallPath = CarlaInstallPath;
if (IsWindows(Target)) var DependenciesInstallPath = CarlaDependenciesPath;
// 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
var BoostInstallPath = Path.Combine(DependenciesInstallPath, "boost-install");
var BoostLibPath = Path.Combine(BoostInstallPath, "lib");
var BoostLibraryPatterns = new string[]
{ {
AddBoostLibs(Path.Combine(LibCarlaInstallPath, "lib")); GetLibraryName("*boost_asio*"),
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("rpc"))); GetLibraryName("*boost_python*"),
};
var BoostLibraries =
from Pattern in BoostLibraryPatterns
select FindLibrary(BoostLibPath, Pattern);
// Chrono
var ChronoInstallPath = Path.Combine(DependenciesInstallPath, "chrono-install");
var ChronoLibPath = Path.Combine(ChronoInstallPath, "lib");
var ChronoLibraryNames = new string[]
{
"ChronoEngine",
"ChronoEngine_vehicle",
"ChronoModels_vehicle",
"ChronoModels_robot",
};
var ChronoLibraries =
from Name in ChronoLibraryNames
select FindLibrary(Name);
// SQLite
var SQLiteBuildPath = Path.Combine(DependenciesInstallPath, "sqlite-build");
var SQLiteLibrary = FindLibrary(SQLiteBuildPath, GetLibraryName("sqlite*"));
// RPCLib
var RPCLibInstallPath = Path.Combine(DependenciesInstallPath, "rpclib-install");
var RPCLibPath = Path.Combine(RPCLibInstallPath, "lib");
var RPCLibraryPath = FindLibrary(RPCLibPath, "rpc");
// Xerces-C
var XercesCInstallPath = Path.Combine(DependenciesInstallPath, "xercesc-install");
var XercesCLibPath = Path.Combine(XercesCInstallPath, "lib");
var XercesCLibrary = FindLibrary(XercesCLibPath, "xercesc*");
// Proj
var ProjInstallPath = Path.Combine(DependenciesInstallPath, "proj-install");
var ProjLibPath = Path.Combine(ProjInstallPath, "lib");
var ProjLibrary = FindLibrary(ProjLibPath, "proj*");
// SUMO (OSM2ODR)
var SUMOInstallPath = Path.Combine(DependenciesInstallPath, "sumo-install");
var SUMOLibPath = Path.Combine(SUMOInstallPath, "lib");
var SUMOLibrary = FindLibrary(SUMOLibPath, "sumo*");
// ZLib
var ZLibInstallPath = Path.Combine(DependenciesInstallPath, "zlib-install");
var ZLibLibPath = Path.Combine(ZLibInstallPath, "lib");
var ZLibLibrary = FindLibrary(ZLibLibPath, "zlib*");
if (UseDebugLibs(Target)) PublicAdditionalLibraries.Add(LibCarlaServerPath);
{ PublicAdditionalLibraries.Add(LibCarlaClientPath);
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server_debug"))); PublicAdditionalLibraries.Add(RPCLibraryPath);
} PublicAdditionalLibraries.AddRange(BoostLibraries);
else
{
PublicAdditionalLibraries.Add(Path.Combine(LibCarlaInstallPath, "lib", GetLibName("carla_server")));
}
}
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")));
}
}
// Include path.
string LibCarlaIncludePath = Path.Combine(LibCarlaInstallPath, "include");
PublicIncludePaths.Add(LibCarlaIncludePath); 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_DISABLE_ABI_HEADERS");
PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY"); PublicDefinitions.Add("BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY");
if (!bEnableExceptions)
{
PublicDefinitions.Add("ASIO_NO_EXCEPTIONS");
PublicDefinitions.Add("BOOST_NO_EXCEPTIONS");
PublicDefinitions.Add("PUGIXML_NO_EXCEPTIONS");
PublicDefinitions.Add("LIBCARLA_NO_EXCEPTIONS");
}
} }
} }

View File

@ -4,32 +4,24 @@ using UnrealBuildTool;
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using System.IO; using System.IO;
using EpicGames.Core;
public class CarlaUE4Target : TargetRules public class CarlaUE4Target :
TargetRules
{ {
public CarlaUE4Target(TargetInfo Target) : base(Target) [CommandLine("-unity-build")]
bool EnableUnityBuild = false;
public CarlaUE4Target(TargetInfo Target) :
base(Target)
{ {
Type = TargetType.Game; Type = TargetType.Game;
ExtraModuleNames.Add("CarlaUE4"); ExtraModuleNames.Add("CarlaUE4");
string ConfigDir = Path.GetDirectoryName(ProjectFile.ToString()) + "/Config/"; Console.WriteLine("Unity build is disabled.");
string OptionalModulesFile = Path.Combine(ConfigDir, "OptionalModules.ini"); bUseUnityBuild = EnableUnityBuild;
string[] text = System.IO.File.ReadAllLines(OptionalModulesFile); bForceUnityBuild = EnableUnityBuild;
bUseAdaptiveUnityBuild = EnableUnityBuild;
bool UnityOn = true;
foreach (string line in text) {
if (line.Contains("Unity OFF"))
{
UnityOn = false;
}
}
if (!UnityOn) {
Console.WriteLine("Disabling unity");
bUseUnityBuild = false;
bForceUnityBuild = false;
bUseAdaptiveUnityBuild = false;
}
} }
} }

View File

@ -8,12 +8,16 @@ public class CarlaUE4 : ModuleRules
{ {
PrivatePCHHeaderFile = "CarlaUE4.h"; PrivatePCHHeaderFile = "CarlaUE4.h";
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); PublicDependencyModuleNames.AddRange(new string[]
{
"Core",
"CoreUObject",
"Engine",
"InputCore"
});
if (Target.Type == TargetType.Editor) if (Target.Type == TargetType.Editor)
{ PublicDependencyModuleNames.Add("UnrealEd");
PublicDependencyModuleNames.AddRange(new string[] { "UnrealEd" });
}
PrivateDependencyModuleNames.AddRange(new string[] { }); PrivateDependencyModuleNames.AddRange(new string[] { });

View File

@ -4,32 +4,24 @@ using UnrealBuildTool;
using System.Collections.Generic; using System.Collections.Generic;
using System; using System;
using System.IO; using System.IO;
using EpicGames.Core;
public class CarlaUE4EditorTarget : TargetRules public class CarlaUE4EditorTarget :
TargetRules
{ {
public CarlaUE4EditorTarget(TargetInfo Target) : base(Target) [CommandLine("-unity-build")]
bool EnableUnityBuild = false;
public CarlaUE4EditorTarget(TargetInfo Target) :
base(Target)
{ {
Type = TargetType.Editor; Type = TargetType.Editor;
ExtraModuleNames.Add("CarlaUE4"); ExtraModuleNames.Add("CarlaUE4");
string ConfigDir = Path.GetDirectoryName(ProjectFile.ToString()) + "/Config/"; Console.WriteLine("Unity build is disabled.");
string OptionalModulesFile = Path.Combine(ConfigDir, "OptionalModules.ini"); bUseUnityBuild = EnableUnityBuild;
string[] text = System.IO.File.ReadAllLines(OptionalModulesFile); bForceUnityBuild = EnableUnityBuild;
bUseAdaptiveUnityBuild = EnableUnityBuild;
bool UnityOn = true;
foreach (string line in text) {
if (line.Contains("Unity OFF"))
{
UnityOn = false;
}
}
if (!UnityOn) {
Console.WriteLine("Disabling unity");
bUseUnityBuild = false;
bForceUnityBuild = false;
bUseAdaptiveUnityBuild = false;
}
} }
} }

View File

@ -53,6 +53,7 @@ TArray<FUSDCARLALight> UUSDCARLAInterface::GetUSDLights(const FString& Path)
TArray<FUSDCARLAWheelData> UUSDCARLAInterface::GetUSDWheelData(const FString& Path) TArray<FUSDCARLAWheelData> UUSDCARLAInterface::GetUSDWheelData(const FString& Path)
{ {
#if 0 // @CARLAUE5
pxr::UsdStageRefPtr Stage = pxr::UsdStageRefPtr Stage =
FOmniverseUSDHelper::LoadUSDStageFromPath(Path); FOmniverseUSDHelper::LoadUSDStageFromPath(Path);
@ -171,4 +172,5 @@ TArray<FUSDCARLAWheelData> UUSDCARLAInterface::GetUSDWheelData(const FString& Pa
ParseWheelData("wheel_3", Wheel3); ParseWheelData("wheel_3", Wheel3);
return {Wheel0, Wheel1, Wheel2, Wheel3}; return {Wheel0, Wheel1, Wheel2, Wheel3};
#endif
} }