Remove preference for Ninja for UE.

This commit is contained in:
Marcel Pi 2024-03-12 11:01:37 +01:00
parent 1be3ea50b1
commit 8e70cfe0c6
2 changed files with 62 additions and 25 deletions

View File

@ -18,17 +18,19 @@ cmake_path (
CONVERT
"$ENV{CARLA_UNREAL_ENGINE_PATH}"
TO_CMAKE_PATH_LIST
CARLA_UNREAL_ENGINE_PATH_DEFAULT
CARLA_UNREAL_ENGINE_PATH_INFERRED
NORMALIZE
)
carla_string_option (
CARLA_UNREAL_ENGINE_PATH
"Path to the CARLA fork of Unreal Engine."
"${CARLA_UNREAL_ENGINE_PATH_DEFAULT}"
"${CARLA_UNREAL_ENGINE_PATH_INFERRED}"
)
message ("Using \"${CARLA_UNREAL_ENGINE_PATH}\" as Unreal Engine root path.")
message (
"Using \"${CARLA_UNREAL_ENGINE_PATH}\" as Unreal Engine root path."
)
if (EXISTS ${CARLA_UNREAL_ENGINE_PATH})
set (CARLA_HAS_UNREAL_ENGINE_PATH ON)
@ -54,18 +56,21 @@ carla_string_option (
"${CARLA_UNREAL_RHI_DEFAULT}"
)
if (${BUILD_CARLA_UNREAL})
if (${CARLA_HAS_UNREAL_ENGINE_PATH})
message ("Carla UE project successfully added to build. (UE path: ${CARLA_UNREAL_ENGINE_PATH})")
else ()
message (
FATAL_ERROR
"Could not add UE project to build since the option CARLA_UNREAL_ENGINE_PATH is not set to a valid path (\"${CARLA_UNREAL_ENGINE_PATH}\"). Please set it to point to the root path of your CARLA Unreal Engine installation.")
endif ()
if (${BUILD_CARLA_UNREAL} AND ${CARLA_HAS_UNREAL_ENGINE_PATH})
message (
"Carla UE project successfully added to build. (UE path: ${CARLA_UNREAL_ENGINE_PATH})")
else ()
message (
FATAL_ERROR
"Could not add UE project to build since the option CARLA_UNREAL_ENGINE_PATH"
"is not set to a valid path (\"${CARLA_UNREAL_ENGINE_PATH}\")."
"Please set it to point to the root path of your CARLA Unreal Engine installation."
)
endif ()
carla_string_option (
CARLA_LAUNCH_ARGS
"CMake-style semicolon-separated list of arguments to pass when launching the Unreal Editor with CARLA."
"CMake-style semicolon-separated list of arguments to pass"
"when launching the Unreal Editor with CARLA."
""
)

View File

@ -25,6 +25,7 @@ if (WIN32)
-CMakefile
-game
-engine
-progress
)
else ()
set (
@ -34,22 +35,25 @@ else ()
-CMakefile
-game
-engine
-progress
)
endif ()
set (CMAKE_NINJA_FORCE_RESPONSE_FILE ON)
add_custom_command (
OUTPUT ${CARLA_UE_PATH}/CMakeLists.txt
OUTPUT
${CARLA_UE_PATH}/CMakeLists.txt
COMMENT
"Generating UE project files for CARLA..."
DEPENDS
carla-server
COMMAND
${CARLA_UE_GENERATE_PROJECT_FILES_COMMAND}
# Remember to add this on most Unreal-related commands,
# otherwise nothing is printed while running the command:
USES_TERMINAL
VERBATIM
)
add_custom_target (
@ -58,6 +62,11 @@ add_custom_target (
${CARLA_UE_PATH}/CMakeLists.txt
)
add_dependencies (
carla-ue-generate-project-files
carla-server
)
if (CMAKE_TOOLCHAIN_FILE)
@ -75,21 +84,20 @@ endif ()
add_custom_command (
OUTPUT carla-ue-configure.stamp
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/carla-ue-configure.stamp
COMMENT
"Configuring Carla Unreal..."
DEPENDS
carla-ue-generate-project-files
COMMAND
${CMAKE_COMMAND}
-S ${CARLA_UE_PATH}
-G ${CMAKE_GENERATOR}
-B ${CMAKE_CURRENT_BINARY_DIR}
${TOOLCHAIN_FILE_OPTION}
COMMAND
${CMAKE_COMMAND}
-E touch carla-ue-configure.stamp
USES_TERMINAL
VERBATIM
)
add_custom_target (
@ -98,14 +106,18 @@ add_custom_target (
carla-ue-configure.stamp
)
add_dependencies (
carla-ue-configure
carla-ue-generate-project-files
)
add_custom_command (
OUTPUT carla-ue.stamp
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/carla-ue.stamp
COMMENT
"Building Carla Unreal..."
DEPENDS
carla-ue-configure
COMMAND
${CMAKE_COMMAND}
--build ${CMAKE_CURRENT_BINARY_DIR}
@ -114,6 +126,7 @@ add_custom_command (
${CMAKE_COMMAND}
-E touch carla-ue.stamp
USES_TERMINAL
VERBATIM
)
add_custom_target (
@ -122,6 +135,11 @@ add_custom_target (
carla-ue.stamp
)
add_dependencies (
carla-ue
carla-ue-configure
)
if (WIN32)
@ -139,21 +157,35 @@ endif ()
add_custom_target (
launch-only
COMMENT
"Launching Carla Unreal..."
COMMAND
${CARLA_UNREAL_ENGINE_PATH}/Engine/Binaries/${UE_SYSTEM_NAME}/UnrealEditor${EXE_EXT}
${CARLA_UE_PROJECT_PATH}
-${CARLA_UNREAL_RHI}
${LAUNCH_ARGS}
USES_TERMINAL
VERBATIM
)
add_custom_target (
launch
DEPENDS
carla-ue
launch-only
COMMENT
"Launching Carla Unreal..."
COMMAND
${CARLA_UNREAL_ENGINE_PATH}/Engine/Binaries/${UE_SYSTEM_NAME}/UnrealEditor${EXE_EXT}
${CARLA_UE_PROJECT_PATH}
-${CARLA_UNREAL_RHI}
${LAUNCH_ARGS}
USES_TERMINAL
VERBATIM
)
add_dependencies (
launch
carla-ue
)