2024-03-04 20:10:00 +08:00
|
|
|
project (
|
|
|
|
carla-ue
|
|
|
|
)
|
|
|
|
|
|
|
|
set (
|
|
|
|
CARLA_UE_PATH
|
2024-03-04 20:33:51 +08:00
|
|
|
${CARLA_WORKSPACE_PATH}/Unreal/CarlaUnreal
|
2024-03-04 20:10:00 +08:00
|
|
|
)
|
|
|
|
|
2024-03-07 00:20:13 +08:00
|
|
|
set (
|
|
|
|
CARLA_UE_PLUGINS_PATH
|
|
|
|
${CARLA_UE_PATH}/Plugins
|
|
|
|
)
|
|
|
|
|
2024-03-04 20:10:00 +08:00
|
|
|
set (
|
|
|
|
CARLA_UE_PROJECT_PATH
|
2024-03-04 20:33:51 +08:00
|
|
|
${CARLA_UE_PATH}/CarlaUnreal.uproject
|
2024-03-04 20:10:00 +08:00
|
|
|
)
|
|
|
|
|
2024-03-09 03:31:22 +08:00
|
|
|
if (WIN32)
|
|
|
|
set (
|
|
|
|
CARLA_UE_GENERATE_PROJECT_SCRIPT
|
|
|
|
${CARLA_UNREAL_ENGINE_PATH}/GenerateProjectFiles.bat
|
|
|
|
)
|
|
|
|
else ()
|
|
|
|
set (
|
|
|
|
CARLA_UE_GENERATE_PROJECT_SCRIPT
|
|
|
|
${CARLA_UNREAL_ENGINE_PATH}/GenerateProjectFiles.sh
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2024-03-07 00:20:13 +08:00
|
|
|
|
|
|
|
|
2024-03-08 00:11:15 +08:00
|
|
|
add_custom_command (
|
|
|
|
OUTPUT ${CARLA_UE_PATH}/CMakeLists.txt
|
2024-03-07 00:20:13 +08:00
|
|
|
COMMENT
|
|
|
|
"Generating UE project files for CARLA..."
|
2024-03-04 20:10:00 +08:00
|
|
|
COMMAND
|
|
|
|
${CARLA_UE_GENERATE_PROJECT_SCRIPT}
|
|
|
|
-project=${CARLA_UE_PROJECT_PATH}
|
|
|
|
-game
|
|
|
|
-engine
|
2024-03-07 00:20:13 +08:00
|
|
|
-CMakefile
|
2024-03-11 04:42:58 +08:00
|
|
|
# Remember to add this on most Unreal-related commands,
|
|
|
|
# otherwise nothing is printed while running the command:
|
|
|
|
USES_TERMINAL
|
2024-03-04 20:10:00 +08:00
|
|
|
)
|
|
|
|
|
2024-03-07 00:20:13 +08:00
|
|
|
add_custom_target (
|
2024-03-08 00:11:15 +08:00
|
|
|
carla-ue-generate-project-files
|
|
|
|
DEPENDS ${CARLA_UE_PATH}/CMakeLists.txt
|
|
|
|
)
|
|
|
|
|
2024-03-09 03:31:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
if (CMAKE_TOOLCHAIN_FILE)
|
|
|
|
cmake_path (
|
|
|
|
ABSOLUTE_PATH CMAKE_TOOLCHAIN_FILE
|
|
|
|
BASE_DIRECTORY ${CARLA_WORKSPACE_PATH}
|
|
|
|
NORMALIZE
|
|
|
|
OUTPUT_VARIABLE TOOLCHAIN_FILE
|
|
|
|
)
|
|
|
|
set (TOOLCHAIN_FILE_OPTION --toolchain=${TOOLCHAIN_FILE})
|
|
|
|
else ()
|
|
|
|
set (TOOLCHAIN_FILE_OPTION)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-08 00:11:15 +08:00
|
|
|
add_custom_command (
|
|
|
|
OUTPUT carla-ue-configure.stamp
|
|
|
|
COMMENT
|
|
|
|
"Configuring Carla Unreal..."
|
2024-03-09 03:31:22 +08:00
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND} -E touch carla-ue-configure.stamp
|
2024-03-08 00:11:15 +08:00
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND}
|
|
|
|
-S ${CARLA_UE_PATH}
|
|
|
|
-G ${CMAKE_GENERATOR}
|
|
|
|
-B ${CMAKE_CURRENT_BINARY_DIR}
|
2024-03-11 15:55:16 +08:00
|
|
|
${TOOLCHAIN_FILE_OPTION}
|
2024-03-11 04:42:58 +08:00
|
|
|
USES_TERMINAL
|
2024-03-08 00:11:15 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target (
|
|
|
|
carla-ue-configure
|
2024-03-07 00:20:13 +08:00
|
|
|
DEPENDS
|
2024-03-08 00:11:15 +08:00
|
|
|
carla-ue-configure.stamp
|
2024-03-07 00:20:13 +08:00
|
|
|
carla-ue-generate-project-files
|
2024-03-08 00:11:15 +08:00
|
|
|
)
|
|
|
|
|
2024-03-09 03:31:22 +08:00
|
|
|
|
|
|
|
|
2024-03-08 00:11:15 +08:00
|
|
|
add_custom_command (
|
|
|
|
OUTPUT carla-ue.stamp
|
2024-03-07 00:20:13 +08:00
|
|
|
COMMENT
|
2024-03-08 00:11:15 +08:00
|
|
|
"Building Carla Unreal..."
|
2024-03-09 03:31:22 +08:00
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND} -E touch carla-ue.stamp
|
2024-03-07 00:20:13 +08:00
|
|
|
COMMAND
|
|
|
|
${CMAKE_COMMAND}
|
2024-03-08 00:11:15 +08:00
|
|
|
--build ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
--target CarlaUnrealEditor
|
|
|
|
--verbose
|
2024-03-11 04:42:58 +08:00
|
|
|
USES_TERMINAL
|
2024-03-08 00:11:15 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target (
|
|
|
|
carla-ue
|
|
|
|
ALL
|
|
|
|
DEPENDS
|
2024-03-11 15:55:16 +08:00
|
|
|
carla-server
|
2024-03-08 00:11:15 +08:00
|
|
|
carla-ue-configure
|
|
|
|
carla-ue.stamp
|
2024-03-07 00:20:13 +08:00
|
|
|
)
|
2024-03-04 20:10:00 +08:00
|
|
|
|
2024-03-09 03:31:22 +08:00
|
|
|
|
|
|
|
|
2024-03-11 16:13:55 +08:00
|
|
|
if (WIN32)
|
|
|
|
set (UE_SYSTEM_NAME Win64)
|
|
|
|
elseif (LINUX)
|
|
|
|
set (UE_SYSTEM_NAME Linux)
|
|
|
|
else ()
|
|
|
|
endif ()
|
|
|
|
|
2024-03-09 03:31:22 +08:00
|
|
|
add_custom_target (
|
|
|
|
launch-only
|
|
|
|
COMMAND
|
2024-03-11 16:13:55 +08:00
|
|
|
${CARLA_UNREAL_ENGINE_PATH}/Engine/Binaries/${UE_SYSTEM_NAME}/UnrealEditor
|
2024-03-09 03:31:22 +08:00
|
|
|
${CARLA_UE_PROJECT_PATH}
|
|
|
|
-${CARLA_UNREAL_RHI}
|
2024-03-11 04:42:58 +08:00
|
|
|
${LAUNCH_ARGS}
|
|
|
|
USES_TERMINAL
|
2024-03-09 03:31:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_custom_target (
|
|
|
|
launch
|
|
|
|
DEPENDS
|
|
|
|
carla-ue
|
|
|
|
launch-only
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-04 20:10:00 +08:00
|
|
|
file (
|
|
|
|
MAKE_DIRECTORY
|
|
|
|
${CARLA_UE_PATH}/Content/Carla/ExportedMaps
|
2024-03-09 03:31:22 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
carla_two_step_configure_file (
|
|
|
|
${CARLA_UE_PLUGINS_PATH}/Carla/Source/Carla/Carla.Build.cs
|
|
|
|
${CARLA_UE_PLUGINS_PATH}/Carla/Source/Carla/Carla.Build.cs.in
|
|
|
|
)
|
|
|
|
|
|
|
|
carla_two_step_configure_file (
|
|
|
|
${CARLA_UE_PLUGINS_PATH}/CarlaTools/Source/CarlaTools/CarlaTools.Build.cs
|
|
|
|
${CARLA_UE_PLUGINS_PATH}/CarlaTools/Source/CarlaTools/CarlaTools.Build.cs.in
|
2024-03-04 20:10:00 +08:00
|
|
|
)
|