From c00d44d2dc8cbeebcf17f572ac2918a26ccc099c Mon Sep 17 00:00:00 2001 From: Marcel Pi <169088301+MarcelPiNacy-CVC@users.noreply.github.com> Date: Thu, 12 Sep 2024 16:35:45 +0200 Subject: [PATCH] Multiple minor fixes related to build and docs. --- .gitignore | 2 ++ CMake/Dependencies.cmake | 48 +++++++++++++++++++++++----------------- CMake/Util.cmake | 4 ++-- CMakePresets.json | 8 ++++++- LibCarla/CMakeLists.txt | 24 +++++++------------- Unreal/CMakeLists.txt | 16 ++++++++++++-- 6 files changed, 61 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index bff4d8432..c67ec1ca8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ out/ CMakeSettings.json +.clangd + Help.md diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake index becb46c75..4b67723d7 100644 --- a/CMake/Dependencies.cmake +++ b/CMake/Dependencies.cmake @@ -12,29 +12,37 @@ include (FetchContent) set (CARLA_DEPENDENCIES_PENDING) +macro (carla_git_dependency_add NAME TAG ARCHIVE_URL GIT_URL) + carla_message ("Cloning ${NAME}...") + FetchContent_Declare ( + ${NAME} + GIT_REPOSITORY ${GIT_URL} + GIT_TAG ${TAG} + GIT_SUBMODULES_RECURSE ON + GIT_SHALLOW ON + GIT_PROGRESS ON + OVERRIDE_FIND_PACKAGE + ${ARGN} + ) + list (APPEND CARLA_DEPENDENCIES_PENDING ${NAME}) +endmacro () + +macro (carla_download_dependency_add NAME TAG ARCHIVE_URL GIT_URL) + carla_message ("Downloading ${NAME}...") + FetchContent_Declare ( + ${NAME} + URL ${ARCHIVE_URL} + OVERRIDE_FIND_PACKAGE + ${ARGN} + ) + list (APPEND CARLA_DEPENDENCIES_PENDING ${NAME}) +endmacro () + macro (carla_dependency_add NAME TAG ARCHIVE_URL GIT_URL) if (PREFER_CLONE) - carla_message ("Cloning ${NAME}...") - FetchContent_Declare ( - ${NAME} - GIT_REPOSITORY ${GIT_URL} - GIT_TAG ${TAG} - GIT_SUBMODULES_RECURSE ON - GIT_SHALLOW ON - GIT_PROGRESS ON - OVERRIDE_FIND_PACKAGE - ${ARGN} - ) - list (APPEND CARLA_DEPENDENCIES_PENDING ${NAME}) + carla_git_dependency_add (${NAME} ${TAG} ${ARCHIVE_URL} ${GIT_URL}) else () - carla_message ("Downloading ${NAME}...") - FetchContent_Declare ( - ${NAME} - URL ${ARCHIVE_URL} - OVERRIDE_FIND_PACKAGE - ${ARGN} - ) - list (APPEND CARLA_DEPENDENCIES_PENDING ${NAME}) + carla_download_dependency_add (${NAME} ${TAG} ${ARCHIVE_URL} ${GIT_URL}) endif () endmacro () diff --git a/CMake/Util.cmake b/CMake/Util.cmake index dff2b780b..3d2c71735 100644 --- a/CMake/Util.cmake +++ b/CMake/Util.cmake @@ -39,7 +39,7 @@ endfunction () macro (carla_option NAME DESCRIPTION VALUE) option (${NAME} ${DESCRIPTION} ${VALUE}) - carla_message ("(option) ${NAME} : ${VALUE}") + carla_message ("(option) ${NAME} : ${${NAME}}") get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS) string ( APPEND @@ -55,7 +55,7 @@ endmacro () macro (carla_string_option NAME DESCRIPTION VALUE) set (${NAME} "${VALUE}") - carla_message ("(option) ${NAME} : \"${VALUE}\"") + carla_message ("(option) ${NAME} : \"${${NAME}}\"") get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS) string ( APPEND diff --git a/CMakePresets.json b/CMakePresets.json index 4219d0cc4..18f281e80 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,5 +1,11 @@ { - "version": 8, + "version": 4, + "cmakeMinimumRequired": + { + "major": 3, + "minor": 27, + "patch": 2 + }, "configurePresets": [ { diff --git a/LibCarla/CMakeLists.txt b/LibCarla/CMakeLists.txt index 48106eb2d..2dd46d352 100644 --- a/LibCarla/CMakeLists.txt +++ b/LibCarla/CMakeLists.txt @@ -1,3 +1,11 @@ +project ( + libcarla + LANGUAGES + CXX + VERSION + ${CARLA_VERSION} +) + set ( LIBCARLA_SOURCE_PATH ${CARLA_WORKSPACE_PATH}/LibCarla/source @@ -15,14 +23,6 @@ carla_two_step_configure_file ( if (BUILD_CARLA_SERVER) - project ( - carla-server - LANGUAGES - CXX - VERSION - ${CARLA_VERSION} - ) - file ( GLOB LIBCARLA_SERVER_SOURCES @@ -159,14 +159,6 @@ endif () if (BUILD_CARLA_CLIENT) - project ( - carla-client - LANGUAGES - CXX - VERSION - ${CARLA_VERSION} - ) - file ( GLOB LIBCARLA_CLIENT_HEADERS diff --git a/Unreal/CMakeLists.txt b/Unreal/CMakeLists.txt index 120d407e5..c75177750 100644 --- a/Unreal/CMakeLists.txt +++ b/Unreal/CMakeLists.txt @@ -357,10 +357,23 @@ add_dependencies ( ${UE_DEPENDENCIES_ORDER_ONLY} ) -function (add_carla_ue_package_target PACKAGE_CONFIGURATION UE_BUILD_CONFIGURATION) +function ( + add_carla_ue_package_target + PACKAGE_CONFIGURATION + UE_BUILD_CONFIGURATION) + + set ( + CARLA_TARGET_PACKAGE_PATH + ${CARLA_PACKAGE_PATH}/${UE_SYSTEM_NAME} + ) + if (NOT "${PACKAGE_CONFIGURATION}" STREQUAL "") set (TARGET_NAME_SUFFIX -${PACKAGE_CONFIGURATION}) + string (TOLOWER "${TARGET_NAME_SUFFIX}" TARGET_NAME_SUFFIX) + else () + set (PACKAGE_CONFIGURATION "default (shipping)") endif () + carla_add_custom_target ( carla-unreal-package${TARGET_NAME_SUFFIX} "Create a CARLA package in ${PACKAGE_CONFIGURATION} mode." @@ -395,7 +408,6 @@ 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 ( TARGET carla-unreal-package${TARGET_NAME_SUFFIX} POST_BUILD