Fix additional issues with escape characters in carla_string_option. (#7293)

* Fix string option escape character errors.

* Additional string option escape character fixes.

* Minor formatting change.

* More fixes.

* Revert back to file copy for *.def.

* Fix build order issue related to carla-unreal-configure.

* Update CMakeLists.txt

* Update CMakeLists.txt

* Switch to using file(GENERATE ...)
This commit is contained in:
Marcel Pi 2024-03-25 17:23:16 +01:00 committed by GitHub
parent 43fbdf6d84
commit d07a623c9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 66 additions and 38 deletions

View File

@ -106,7 +106,7 @@ option (
carla_string_option (
LIBCARLA_IMAGE_SUPPORTED_FORMATS
"Semicolon-separated list of supported image formats by LibCarla. Available formats: png, jpeg, tiff"
"Semicolon-separated list of supported image formats by LibCarla. Available formats: png, jpeg, tiff."
png
)

View File

@ -121,12 +121,14 @@ carla_string_option (
carla_string_option (
CARLA_ZLIB_VERSION
"Target zlib git tag."
1.3.1)
1.3.1
)
carla_string_option (
CARLA_ZLIB_TAG
"Target zlib git tag."
v${CARLA_ZLIB_VERSION})
v${CARLA_ZLIB_VERSION}
)
# ==== LUNASVG ====

View File

@ -51,7 +51,7 @@ endif ()
carla_string_option (
CARLA_UNREAL_RHI
"Target CARLA Unreal Engine RHI."
${CARLA_UNREAL_RHI_DEFAULT}
"${CARLA_UNREAL_RHI_DEFAULT}"
)
if (${BUILD_CARLA_UNREAL} AND ${CARLA_HAS_UNREAL_ENGINE_PATH})
@ -68,13 +68,12 @@ 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."
""
)
carla_string_option (
CARLA_UNREAL_BUILD_TYPE
"Carla Unreal-style build type (Debug/Development/Shipping)."
Development
"Development"
)

View File

@ -1,15 +1,36 @@
macro (carla_message)
message (STATUS "CARLA: " ${ARGN})
# Similar to configure_file, but also expands variables
# that are set at generate time, like generator expressions.
macro (carla_two_step_configure_file DESTINATION SOURCE)
carla_message ("Configuring file ${DESTINATION}")
# Configure-time step; evaluate variables:
configure_file (${SOURCE} ${DESTINATION})
# Generate-time step; evaluate generator expressions:
file (GENERATE OUTPUT ${DESTINATION} INPUT ${DESTINATION})
endmacro ()
# message wrapper for normal messages.
function (carla_message)
message (STATUS "CARLA: " ${ARGN})
endfunction ()
# message wrapper for warnings.
macro (carla_warning)
message (WARNING ${ARGN})
endmacro ()
macro (carla_error)
# message wrapper for errors.
function (carla_error)
message (FATAL_ERROR ${ARGN})
endmacro ()
endfunction ()
macro (carla_string_option NAME DESCRIPTION VALUE)
set (${NAME} ${VALUE} CACHE STRING ${DESCRIPTION})
set (${NAME} "${VALUE}" CACHE STRING ${DESCRIPTION})
endmacro ()

View File

@ -81,16 +81,6 @@ if (LINUX)
endif ()
endif ()
# Similar to configure_file, but also expands variables
# that are set at generate time, like generator expressions.
macro (carla_two_step_configure_file DESTINATION SOURCE)
carla_message ("Configuring file ${DESTINATION}")
# Configure-time step; evaluate variables:
configure_file (${SOURCE} ${DESTINATION})
# Generate-time step; evaluate generator expressions:
file (GENERATE OUTPUT ${DESTINATION} INPUT ${DESTINATION})
endmacro ()
set (CMAKE_POSITION_INDEPENDENT_CODE ON)

View File

@ -210,25 +210,41 @@ set (
${CARLA_UE_CARLA_TOOLS_PATH}/Options.def
)
file (
GENERATE
OUTPUT
${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
CONTENT
"${CARLA_UNREAL_INCLUDE_PATHS}"
)
file (
GENERATE
OUTPUT
${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
CONTENT
"${CARLA_UNREAL_LIBRARIES}"
)
file (
GENERATE
OUTPUT
${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH}
CONTENT
"${CARLA_UNREAL_OPTIONS}"
)
add_custom_command (
OUTPUT
${CARLA_UNREAL_CONFIGURE_OUTPUTS}
COMMAND ${CMAKE_COMMAND} -E rm -f ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E echo "${CARLA_UNREAL_INCLUDE_PATHS}" >> ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Includes.def
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Includes.def
COMMAND ${CMAKE_COMMAND} -E rm -f ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E echo "${CARLA_UNREAL_LIBRARIES}" >> ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Libraries.def
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Libraries.def
COMMAND ${CMAKE_COMMAND} -E rm -f ${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E echo "${CARLA_UNREAL_OPTIONS}" >> ${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH}
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Options.def
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Options.def
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Includes.def
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${CARLA_UNREAL_INCLUDE_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Includes.def
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Libraries.def
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${CARLA_UNREAL_LIBRARIES_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Libraries.def
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH} ${CARLA_UE_CARLA_PATH}/Options.def
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink ${CARLA_UNREAL_OPTIONS_PATHS_FILE_PATH} ${CARLA_UE_CARLA_TOOLS_PATH}/Options.def
USES_TERMINAL
VERBATIM
)