Revert "Introduce several helper macros and utilities for improved usability.…" (#7635)

This reverts commit 321082ed0b.

Co-authored-by: Marcel Pi <marcelpi97@gmail.com>
This commit is contained in:
Xavier Solé Nogués 2024-05-13 11:45:53 +02:00 committed by GitHub
parent 321082ed0b
commit 08c06a01df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 66 additions and 180 deletions

2
.gitignore vendored
View File

@ -9,5 +9,3 @@ Dist/
out/
CMakeSettings.json
Help.md

View File

@ -125,7 +125,13 @@ carla_option (
carla_string_option (
LIBCARLA_IMAGE_SUPPORTED_FORMATS
"Semicolon-separated list of supported image formats by LibCarla. Available formats: png, jpeg, tiff."
"png"
png
)
carla_string_option (
GCC_COMPILER
"gcc compiler used by some CARLA extensions."
/usr/bin/gcc-7
)
@ -186,7 +192,7 @@ if (${BUILD_CARLA_UNREAL} AND ${CARLA_HAS_UNREAL_ENGINE_PATH})
)
else ()
carla_error (
"Could not add UE project to build since the carla_option CARLA_UNREAL_ENGINE_PATH "
"Could not add UE project to build since the carla_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."
)

View File

@ -1,12 +1,12 @@
# Similar to configure_file, but also expands variables
# that are set at generate time, like generator expressions.
function (carla_two_step_configure_file DESTINATION SOURCE)
macro (carla_two_step_configure_file DESTINATION SOURCE)
carla_message ("Configuring file ${DESTINATION}")
# Configure-time step; evaluate variables:
configure_file (${SOURCE} ${DESTINATION} @ONLY)
# Generate-time step; evaluate generator expressions:
file (GENERATE OUTPUT ${DESTINATION} INPUT ${DESTINATION})
endfunction ()
endmacro ()
@ -17,104 +17,26 @@ endfunction ()
# message() wrapper for warnings.
function (carla_warning)
# message wrapper for warnings.
macro (carla_warning)
message (WARNING ${ARGN})
endfunction ()
endmacro ()
# message() wrapper for errors.
# message wrapper for errors.
function (carla_error)
message (FATAL_ERROR ${ARGN})
endfunction ()
function (carla_get_option_docs OUT_VAR)
get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS)
set (${OUT_VAR} ${DOCS})
return (PROPAGATE ${OUT_VAR})
endfunction ()
macro (carla_option NAME DESCRIPTION VALUE)
option (${NAME} ${DESCRIPTION} ${VALUE})
carla_message ("(option) ${NAME} : ${VALUE}")
get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS)
string (
APPEND
DOCS
"- ${NAME}\n"
"\t- Description: ${DESCRIPTION}\n"
"\t- Default: ${VALUE}\n"
)
set_property (GLOBAL PROPERTY CARLA_OPTION_DOCS ${DOCS})
endmacro ()
macro (carla_string_option NAME DESCRIPTION VALUE)
set (${NAME} "${VALUE}")
carla_message ("(option) ${NAME} : \"${VALUE}\"")
get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS)
string (
APPEND
DOCS
"- ${NAME}\n"
"\t- Description: ${DESCRIPTION}\n"
"\t- Default: \"${VALUE}\"\n"
)
set_property (GLOBAL PROPERTY CARLA_OPTION_DOCS ${DOCS})
endmacro ()
function (carla_get_target_docs OUT_VAR)
get_property (DOCS GLOBAL PROPERTY CARLA_TARGET_DOCS)
set (${OUT_VAR} ${DOCS})
return (PROPAGATE ${OUT_VAR})
endfunction ()
function (carla_add_library NAME DESCRIPTION)
get_property (DOCS GLOBAL PROPERTY CARLA_TARGET_DOCS)
string (
APPEND
DOCS
"- ${NAME}\n"
"\t- Type: Library\n"
"\t- Description: ${DESCRIPTION}\n"
)
add_library (${NAME} ${ARGN})
set_property (GLOBAL PROPERTY CARLA_TARGET_DOCS ${DOCS})
endfunction ()
function (carla_add_executable NAME DESCRIPTION)
get_property (DOCS GLOBAL PROPERTY CARLA_TARGET_DOCS)
string (
APPEND
DOCS
"- ${NAME}\n"
"\t- Type: Executable\n"
"\t- Description: ${DESCRIPTION}\n"
)
add_executable (${NAME} ${ARGN})
set_property (GLOBAL PROPERTY CARLA_TARGET_DOCS ${DOCS})
endfunction ()
function (carla_add_custom_target NAME DESCRIPTION)
get_property (DOCS GLOBAL PROPERTY CARLA_TARGET_DOCS)
string (
APPEND
DOCS
"- ${NAME}\n"
"\t- Type: CustomTarget\n"
"\t- Description: ${DESCRIPTION}\n"
)
add_custom_target (${NAME} ${ARGN})
set_property (GLOBAL PROPERTY CARLA_TARGET_DOCS ${DOCS})
endfunction ()

View File

@ -73,6 +73,8 @@ include (${CARLA_WORKSPACE_PATH}/CMake/Options.cmake)
include (${CARLA_WORKSPACE_PATH}/CMake/Common.cmake)
include (${CARLA_WORKSPACE_PATH}/CMake/Dependencies.cmake)
if (BUILD_CARLA_CLIENT OR BUILD_CARLA_SERVER)
add_subdirectory (LibCarla)
endif ()
@ -97,28 +99,3 @@ endif ()
if (BUILD_EXAMPLES)
add_subdirectory (Examples)
endif ()
carla_add_custom_target (
carla-help
"Display this message."
COMMAND ${CMAKE_COMMAND} -E cat "${CMAKE_CURRENT_BINARY_DIR}/Help.md"
)
carla_get_option_docs (CARLA_OPTION_DOCS)
carla_get_target_docs (CARLA_TARGET_DOCS)
set (CARLA_CMAKE_HELP_MESSAGE)
string (
APPEND
CARLA_CMAKE_HELP_MESSAGE
"# CARLA - CMake Help\n"
"## CMake Targets\n"
"${CARLA_TARGET_DOCS}\n"
"## CMake Options\n"
"${CARLA_OPTION_DOCS}\n"
)
file (
WRITE
${CMAKE_CURRENT_BINARY_DIR}/Help.md
${CARLA_CMAKE_HELP_MESSAGE}
)

View File

@ -1,8 +1,7 @@
project (carla-example-cpp-client)
carla_add_executable (
add_executable (
carla-example-cpp-client
"Build the CARLA C++ client example."
main.cpp
)

View File

@ -108,9 +108,8 @@ if (BUILD_CARLA_SERVER)
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp
)
carla_add_library (
add_library (
carla-server
"Build the CARLA server."
${LIBCARLA_SERVER_HEADERS}
${LIBCARLA_SERVER_SOURCES}
${LIBCARLA_SERVER_HEADERS_THIRD_PARTY}
@ -265,9 +264,8 @@ if (BUILD_CARLA_CLIENT)
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp
)
carla_add_library (
add_library (
carla-client
"Build the CARLA client."
${LIBCARLA_CLIENT_HEADERS}
${LIBCARLA_CLIENT_SOURCES}
${LIBCARLA_CLIENT_HEADERS_THIRD_PARTY}
@ -302,3 +300,12 @@ if (BUILD_CARLA_CLIENT)
)
endif ()
add_custom_target (
carla-server-package
)
add_dependencies (
carla-server-package
carla-server
)

View File

@ -81,9 +81,8 @@ else ()
)
endif ()
carla_add_custom_target (
add_custom_target (
carla-python-api
"Build the CARLA Python API."
COMMAND
${CMAKE_COMMAND}
-E copy
@ -97,9 +96,8 @@ carla_add_custom_target (
USES_TERMINAL
)
carla_add_custom_target (
add_custom_target (
carla-python-api-install
"Build & install the CARLA Python API"
COMMAND
${Python3_EXECUTABLE}
-m pip install

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.28.0)
project (carla-ros2-native-project)
project(carla-ros2-native-project)
include (ExternalProject)
@ -29,7 +29,7 @@ ExternalProject_add (
DEPENDS foonathan_memory fastcdr
)
ExternalProject_Add (
ExternalProject_Add(
carla-ros2-native-lib
DEPENDS fastdds
SOURCE_DIR ${PROJECT_SOURCE_DIR}/LibCarlaRos2Native
@ -37,20 +37,16 @@ ExternalProject_Add (
)
set (CARLA_PLUGIN_BINARY_PATH ${CMAKE_SOURCE_DIR}/Unreal/CarlaUnreal/Plugins/Carla/Binaries/Linux)
make_directory (${CARLA_PLUGIN_BINARY_PATH})
add_custom_command (
TARGET carla-ros2-native-lib
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy
${PROJECT_INSTALL_PATH}/lib/*.so*
${CARLA_PLUGIN_BINARY_PATH}
make_directory(${CARLA_PLUGIN_BINARY_PATH})
add_custom_command(
TARGET carla-ros2-native-lib
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_INSTALL_PATH}/lib/*.so*
${CARLA_PLUGIN_BINARY_PATH}
)
carla_add_custom_target (
add_custom_target (
carla-ros2-native
"Build the ROS2-Native CARLA subproject."
DEPENDS carla-ros2-native-lib
)
)

View File

@ -22,10 +22,7 @@ file (
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.h
)
carla_add_library (
carla-ros2-native
"Build the CARLA ROS2-Native subproject."
SHARED
add_library (carla-ros2-native SHARED
${LIBCARLA_ROS2_HEADERS}
${LIBCARLA_ROS2_SOURCES}
)
@ -46,4 +43,4 @@ target_compile_definitions (carla-ros2-native PUBLIC
target_link_libraries(carla-ros2-native
${CMAKE_INSTALL_PREFIX}/lib/libfastrtps.so)
install (TARGETS carla-ros2-native DESTINATION lib)
install (TARGETS carla-ros2-native DESTINATION lib)

View File

@ -8,8 +8,7 @@ project (
"Open-source simulator for autonomous driving research."
)
carla_option (
ENABLE_DIRECTORY_CLEAN
option(ENABLE_DIRECTORY_CLEAN
"Enable ADDITIONAL_CLEAN_FILES on directory level"
ON
)
@ -296,9 +295,8 @@ file (
carla_add_custom_target (
add_custom_target (
carla-unreal
"Build the CarlaUnreal subproject."
COMMAND
${CARLA_UE_BUILD_COMMAND_PREFIX}
CarlaUnreal
@ -318,9 +316,8 @@ add_dependencies (
${UE_DEPENDENCIES_ORDER_ONLY}
)
carla_add_custom_target (
add_custom_target (
carla-unreal-editor
"Build the CarlaUnrealEditor subproject."
COMMAND
${CARLA_UE_BUILD_COMMAND_PREFIX}
CarlaUnrealEditor
@ -340,13 +337,9 @@ add_dependencies (
${UE_DEPENDENCIES_ORDER_ONLY}
)
function (add_carla_ue_package_target PACKAGE_CONFIGURATION UE_BUILD_CONFIGURATION)
if (NOT "${PACKAGE_CONFIGURATION}" STREQUAL "")
set (TARGET_NAME_SUFFIX -${PACKAGE_CONFIGURATION})
endif ()
carla_add_custom_target (
function(add_carla_ue_package_target TARGET_NAME_SUFFIX UE_BUILD_CONFIGURATION)
add_custom_target (
carla-unreal-package${TARGET_NAME_SUFFIX}
"Create a CARLA package in ${PACKAGE_CONFIGURATION} mode."
COMMAND
${CARLA_UE_BUILD_COMMAND_PREFIX}
CarlaUnreal
@ -378,8 +371,8 @@ function (add_carla_ue_package_target PACKAGE_CONFIGURATION UE_BUILD_CONFIGURATI
VERBATIM
)
set (CARLA_TARGET_PACKAGE_PATH ${CARLA_PACKAGE_PATH}/${UE_SYSTEM_NAME})
add_custom_command (
set(CARLA_TARGET_PACKAGE_PATH ${CARLA_PACKAGE_PATH}/${UE_SYSTEM_NAME})
add_custom_command(
TARGET carla-unreal-package${TARGET_NAME_SUFFIX}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE CREATING VERSION FILE UNREAL PACKAGE EXTRA FILES STARTED **********"
@ -418,9 +411,8 @@ function (add_carla_ue_package_target PACKAGE_CONFIGURATION UE_BUILD_CONFIGURATI
${UE_DEPENDENCIES_ORDER_ONLY}
)
carla_add_custom_target (
add_custom_target (
package${TARGET_NAME_SUFFIX}
"Create a CARLA package in ${PACKAGE_CONFIGURATION} mode."
)
add_dependencies (
@ -432,11 +424,11 @@ endfunction()
# Docs for UE5 build configurations:
# https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/DevelopmentSetup/BuildConfigurations/
add_carla_ue_package_target("" Shipping)
add_carla_ue_package_target(Shipping Shipping)
add_carla_ue_package_target(Debug Debug)
add_carla_ue_package_target(DebugGame DebugGame)
add_carla_ue_package_target(Development Development)
add_carla_ue_package_target(Test Test)
add_carla_ue_package_target(-Shipping Shipping)
add_carla_ue_package_target(-Debug Debug)
add_carla_ue_package_target(-DebugGame DebugGame)
add_carla_ue_package_target(-Development Development)
add_carla_ue_package_target(-Test Test)
@ -453,9 +445,8 @@ set (
VERBATIM
)
carla_add_custom_target (
add_custom_target (
launch
"Build and open CARLA in the Unreal Editor."
${CARLA_LAUNCH_TARGET_OPTIONS}
)
@ -471,9 +462,8 @@ else ()
)
endif ()
carla_add_custom_target (
check-unreal-content
"Perform some basic checks to ensure that the CARLA Unreal Editor will not open without its assets."
add_custom_target (
prelaunch-content-check
COMMAND
${PRELAUNCH_CONTENT_CHECK_COMMAND}
COMMENT
@ -485,22 +475,20 @@ carla_add_custom_target (
add_dependencies (
launch
carla-unreal-editor
check-unreal-content
prelaunch-content-check
)
carla_add_custom_target (
add_custom_target (
launch-only
"Open CARLA in the Unreal Editor. This will not rebuild outdated targets."
${CARLA_LAUNCH_TARGET_OPTIONS}
)
add_dependencies (
launch-only
check-unreal-content
prelaunch-content-check
)
set_property (
DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
"${CARLA_UE_PATH}/Binaries"
"${CARLA_UE_PATH}/Intermediate"
"${CARLA_UE_PATH}/Saved"
@ -512,5 +500,5 @@ set_property (
"${CARLA_UE_CARLA_PATH}/Saved"
"${CARLA_BUILD_PATH}/Package"
"${CARLA_BUILD_PATH}/PythonAPI/dist"
)
)

View File

@ -11,9 +11,8 @@ set (
${CARLA_WORKSPACE_PATH}/osm-world-renderer/OsmRenderer
)
carla_add_library (
add_library (
lib-osm-map-renderer
"Build OSM-Map-Renderer."
${OSM_RENDERER_SOURCE_PATH}/src/OsmRenderer.cpp
${OSM_RENDERER_SOURCE_PATH}/src/MapDrawer.cpp
${OSM_RENDERER_SOURCE_PATH}/src/MapRasterizer.cpp
@ -33,9 +32,8 @@ target_include_directories (
${OSM_RENDERER_SOURCE_PATH}/include
)
carla_add_executable (
add_executable (
osm-world-renderer
"Build OSM-World-Renderer."
${OSM_RENDERER_SOURCE_PATH}/main.cpp
)