CMake refactor (#8168)

* Add option VERBOSE_CONFIGURE + several other minor tweaks.

* Minor refactor and expose version option variables for ROS2 build.

* Remove unneeded option BUILD_PYTHON_API_WHEEL_PACKAGE.

* Make cmake_minimum_required uniform + fix potential linker error.

* Revert ROS2 configure.
This commit is contained in:
MarcelPiNacy-CVC 2024-09-19 17:35:18 +02:00 committed by GitHub
parent 4c1196db44
commit 0bbd239b1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 295 additions and 149 deletions

View File

@ -39,9 +39,9 @@ endif ()
if (WIN32)
add_compile_definitions (_CRT_SECURE_NO_WARNINGS)
check_cxx_compiler_flag(/utf-8 HAS_MSVC_UTF8)
check_cxx_compiler_flag (/utf-8 HAS_MSVC_UTF8)
if (HAS_MSVC_UTF8)
# @TODO This causes warnings with MASM. A better approach should be looked into.
add_compile_options (/utf-8)
endif ()
endif ()
@ -49,7 +49,7 @@ endif ()
set (CARLA_COMMON_DEFINITIONS)
foreach (FORMAT ${LIBCARLA_IMAGE_SUPPORTED_FORMATS})
carla_message ("Enabling CARLA image support for \"${FORMAT}\".")
carla_message_verbose ("Enabling CARLA image support for \"${FORMAT}\".")
string (TOUPPER "${FORMAT}" FORMAT_UPPERCASE)
list (APPEND CARLA_COMMON_DEFINITIONS LIBCARLA_IMAGE_SUPPORT_${FORMAT_UPPERCASE}=1)
endforeach ()
@ -61,6 +61,19 @@ if (WIN32)
list (APPEND CARLA_COMMON_DEFINITIONS _USE_MATH_DEFINES)
endif ()
if (WIN32)
set (EXE_EXT .exe)
set (UE_SYSTEM_NAME Win64)
elseif (LINUX)
set (EXE_EXT)
set (UE_SYSTEM_NAME Linux)
elseif (APPLE)
set (EXE_EXT)
set (UE_SYSTEM_NAME Mac)
else ()
carla_error ("Unknown target system.")
endif ()
# ================================
# Exception Definitions
# ================================

View File

@ -94,8 +94,9 @@ target_link_libraries (
libsqlite3
)
# ==== ZLIB ====
# ==== ZLIB ====
carla_dependency_option (ZLIB_BUILD_EXAMPLES OFF)
carla_dependency_add (
zlib
@ -117,8 +118,9 @@ endif ()
carla_dependency_option (ZLIB_INCLUDE_DIRS ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR})
carla_dependency_option (ZLIB_LIBRARIES ${ZLIB_LIBRARY})
# ==== LIBPNG ====
# ==== LIBPNG ====
carla_dependency_option (PNG_SHARED OFF)
carla_dependency_option (PNG_STATIC ON)
if (APPLE)
@ -143,11 +145,6 @@ include_directories (
# ==== BOOST ====
carla_dependency_option (BOOST_ENABLE_PYTHON ${BUILD_PYTHON_API})
carla_dependency_option (BOOST_ENABLE_MPI OFF)
carla_dependency_option (BOOST_LOCALE_WITH_ICU OFF)
carla_dependency_option (BOOST_LOCALE_WITH_ICONV OFF)
set (
BOOST_INCLUDED_PROJECTS
asio
@ -155,11 +152,22 @@ set (
python
date_time
geometry
gil
container
variant2
gil
)
set (
BOOST_EXCLUDED_PROJECTS
# filesystem # <- Boost.GIL links with Boost.filesystem, so we can't remove the dependency yet.
)
carla_dependency_option (BOOST_INCLUDE_LIBRARIES "${BOOST_INCLUDED_PROJECTS}")
carla_dependency_option (BOOST_EXCLUDE_LIBRARIES "${BOOST_EXCLUDED_PROJECTS}")
carla_dependency_option (BOOST_ENABLE_PYTHON ${BUILD_PYTHON_API})
carla_dependency_option (BOOST_ENABLE_MPI OFF)
carla_dependency_option (BOOST_LOCALE_WITH_ICU OFF)
carla_dependency_option (BOOST_LOCALE_WITH_ICONV OFF)
carla_dependency_option (BOOST_GIL_BUILD_EXAMPLES OFF)
carla_dependency_option (BOOST_GIL_BUILD_HEADER_TESTS OFF)
carla_dependency_add(
boost
${CARLA_BOOST_TAG}
@ -167,8 +175,9 @@ carla_dependency_add(
https://github.com/boostorg/boost.git
)
# ==== EIGEN ====
# ==== EIGEN ====
carla_dependency_option (EIGEN_BUILD_PKGCONFIG OFF)
carla_dependency_option (BUILD_TESTING OFF)
carla_dependency_option (EIGEN_BUILD_DOC OFF)
@ -179,8 +188,9 @@ carla_dependency_add (
https://gitlab.com/libeigen/eigen.git
)
# ==== RPCLIB ====
# ==== RPCLIB ====
carla_dependency_add (
rpclib
${CARLA_RPCLIB_TAG}
@ -188,8 +198,9 @@ carla_dependency_add (
https://github.com/carla-simulator/rpclib.git
)
# ==== RECAST ====
# ==== RECAST ====
carla_dependency_option (RECASTNAVIGATION_BUILDER ON)
carla_dependency_add (
recastnavigation
@ -198,9 +209,10 @@ carla_dependency_add (
https://github.com/carla-simulator/recastnavigation.git
)
# ==== PROJ ====
if (ENABLE_OSM2ODR)
# ==== PROJ ====
carla_dependency_option (BUILD_TESTING OFF)
carla_dependency_option (ENABLE_TIFF OFF)
carla_dependency_option (ENABLE_CURL OFF)
@ -212,9 +224,10 @@ if (ENABLE_OSM2ODR)
)
endif ()
# ==== XERCESC ====
if (ENABLE_OSM2ODR)
# ==== XERCESC ====
carla_dependency_add (
xercesc
${CARLA_XERCESC_TAG}
@ -223,20 +236,18 @@ if (ENABLE_OSM2ODR)
)
endif ()
# ==== LUNASVG ====
if (BUILD_OSM_WORLD_RENDERER)
# ==== LUNASVG ====
carla_dependency_add (
lunasvg
${CARLA_LUNASVG_TAG}
https://github.com/sammycage/lunasvg/archive/refs/tags/${CARLA_LUNASVG_TAG}.zip
https://github.com/sammycage/lunasvg.git
)
endif ()
# ==== LIBOSMSCOUT ====
if (BUILD_OSM_WORLD_RENDERER)
# ==== LIBOSMSCOUT ====
carla_dependency_add (
libosmscout
${CARLA_LIBOSMSCOUT_TAG}
@ -245,9 +256,10 @@ if (BUILD_OSM_WORLD_RENDERER)
)
endif ()
# ==== STREETMAP ====
if (BUILD_CARLA_UNREAL)
# ==== STREETMAP ====
carla_dependency_add (
StreetMap
${CARLA_STREETMAP_TAG}

View File

@ -104,12 +104,6 @@ carla_option (
OFF
)
carla_option (
BUILD_PYTHON_API_WHEEL_PACKAGE
"Whether to build the CARLA python API wheel package."
ON
)
carla_option (
ENABLE_PEP517
"Whether to use PEP 517."
@ -146,6 +140,12 @@ carla_string_option (
/usr/bin/gcc-12
)
carla_option (
VERBOSE_CONFIGURE
"Whether to emit extra messages during CMake configure."
OFF
)
# ================================
@ -198,18 +198,14 @@ carla_string_option (
"${CARLA_UNREAL_RHI_DEFAULT}"
)
if (${BUILD_CARLA_UNREAL})
if (${CARLA_HAS_UNREAL_ENGINE_PATH})
carla_message (
"Carla UE project successfully added to build. (UE path: ${CARLA_UNREAL_ENGINE_PATH})"
)
else ()
carla_error (
"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."
)
endif ()
if (BUILD_CARLA_UNREAL)
if (NOT ${CARLA_HAS_UNREAL_ENGINE_PATH})
carla_error (
"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."
)
endif ()
endif ()
carla_string_option (
@ -380,7 +376,6 @@ carla_string_option (
${CARLA_LIBOSMSCOUT_VERSION}
)
# ==== STREETMAP ====
carla_string_option (
@ -394,3 +389,45 @@ carla_string_option (
"Target StreetMap git tag."
${CARLA_STREETMAP_VERSION}
)
# ==== FASTDDS ====
carla_string_option (
CARLA_FASTDDS_VERSION
"Target Fast-DDS version."
2.11.2
)
carla_string_option (
CARLA_FASTDDS_TAG
"Target Fast-DDS git tag."
${CARLA_FASTDDS_VERSION}
)
# ==== FASTCDR ====
carla_string_option (
CARLA_FASTCDR_VERSION
"Target Fast-CDR version."
2.2.x
)
carla_string_option (
CARLA_FASTCDR_TAG
"Target Fast-CDR git tag."
${CARLA_FASTCDR_VERSION}
)
# ==== FOONATHAN MEMORY VENDOR ====
carla_string_option (
CARLA_FOONATHAN_MEMORY_VENDOR_VERSION
"Target foonathan_memory_vendor version."
master
)
carla_string_option (
CARLA_FOONATHAN_MEMORY_VENDOR_TAG
"Target foonathan_memory_vendor git tag."
${CARLA_FOONATHAN_MEMORY_VENDOR_VERSION}
)

View File

@ -1,20 +1,15 @@
# 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)
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 ()
# message wrapper for normal messages.
function (carla_message)
message (STATUS "CARLA: " ${ARGN})
endfunction ()
# message wrapper for normal messages.
function (carla_message_verbose)
if (VERBOSE_CONFIGURE)
message (STATUS "CARLA: " ${ARGN})
endif ()
endfunction ()
# message() wrapper for warnings.
@ -39,7 +34,7 @@ endfunction ()
macro (carla_option NAME DESCRIPTION VALUE)
option (${NAME} ${DESCRIPTION} ${VALUE})
carla_message ("(option) ${NAME} : ${${NAME}}")
carla_message_verbose ("(option) ${NAME} : ${${NAME}}")
get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS)
string (
APPEND
@ -55,7 +50,7 @@ endmacro ()
macro (carla_string_option NAME DESCRIPTION VALUE)
set (${NAME} "${VALUE}")
carla_message ("(option) ${NAME} : \"${${NAME}}\"")
carla_message_verbose ("(option) ${NAME} : \"${${NAME}}\"")
get_property (DOCS GLOBAL PROPERTY CARLA_OPTION_DOCS)
string (
APPEND
@ -69,6 +64,18 @@ endmacro ()
# 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)
carla_message_verbose ("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 ()
# If, for some reason, CARLA is configured with CMake<3.5, this is necessary:
if (${CMAKE_VERSION} VERSION_LESS 3.5)
include (CMakeParseArguments)
@ -139,6 +146,34 @@ endfunction ()
if (VERBOSE_CONFIGURE)
macro (carla_print_cmake_variable NAME)
carla_message ("${NAME}: \'${${NAME}}\'")
endmacro ()
carla_print_cmake_variable (CMAKE_C_COMPILER)
carla_print_cmake_variable (CMAKE_CXX_COMPILER)
carla_print_cmake_variable (CMAKE_ASM_COMPILER)
carla_print_cmake_variable (CMAKE_AR)
carla_print_cmake_variable (CMAKE_C_COMPILER_AR)
carla_print_cmake_variable (CMAKE_CXX_COMPILER_AR)
carla_print_cmake_variable (CMAKE_OBJCOPY)
carla_print_cmake_variable (CMAKE_ADDR2LINE)
carla_print_cmake_variable (CMAKE_C_COMPILER_RANLIB)
carla_print_cmake_variable (CMAKE_CXX_COMPILER_RANLIB)
carla_print_cmake_variable (CMAKE_LINKER)
carla_print_cmake_variable (CMAKE_NM)
carla_print_cmake_variable (CMAKE_OBJDUMP)
carla_print_cmake_variable (CMAKE_RANLIB)
carla_print_cmake_variable (CMAKE_READELF)
carla_print_cmake_variable (CMAKE_STRIP)
carla_print_cmake_variable (COVERAGE_COMMAND)
carla_print_cmake_variable (CMAKE_CXX_STANDARD_LIBRARIES)
carla_print_cmake_variable (CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
endif ()
carla_add_target_docs (
NAME clean
TYPE Builtin

View File

@ -8,9 +8,14 @@
]]
set (
CARLA_CMAKE_MINIMUM_REQUIRED_VERSION
3.27.2
)
cmake_minimum_required (
VERSION
3.27.2
${CARLA_CMAKE_MINIMUM_REQUIRED_VERSION}
)
cmake_policy (SET CMP0097 NEW)

View File

@ -11,11 +11,6 @@ set (
${CARLA_WORKSPACE_PATH}/LibCarla/source
)
set (
LIBCARLA_THIRD_PARTY_SOURCE_PATH
${LIBCARLA_SOURCE_PATH}/third-party
)
carla_two_step_configure_file (
${LIBCARLA_SOURCE_PATH}/carla/Version.h
${LIBCARLA_SOURCE_PATH}/carla/Version.h.in
@ -59,9 +54,9 @@ if (BUILD_CARLA_SERVER)
file (
GLOB
LIBCARLA_SERVER_SOURCES_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp
${LIBCARLA_SOURCE_PATH}/third-party/odrSpiral/*.cpp
${LIBCARLA_SOURCE_PATH}/third-party/moodycamel/*.cpp
${LIBCARLA_SOURCE_PATH}/third-party/pugixml/*.cpp
)
file (
@ -107,9 +102,9 @@ if (BUILD_CARLA_SERVER)
file (
GLOB
LIBCARLA_SERVER_HEADERS_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp
${LIBCARLA_SOURCE_PATH}/third-party/odrSpiral/*.h
${LIBCARLA_SOURCE_PATH}/third-party/moodycamel/*.h
${LIBCARLA_SOURCE_PATH}/third-party/pugixml/*.hpp
)
carla_add_library (
@ -206,10 +201,10 @@ if (BUILD_CARLA_CLIENT)
file (
GLOB
LIBCARLA_CLIENT_HEADERS_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/moodycamel/*.h
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.hpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.h
${LIBCARLA_SOURCE_PATH}/third-party/odrSpiral/*.h
${LIBCARLA_SOURCE_PATH}/third-party/moodycamel/*.h
${LIBCARLA_SOURCE_PATH}/third-party/pugixml/*.hpp
${LIBCARLA_SOURCE_PATH}/third-party/pugixml/*.h
)
file (
@ -257,8 +252,8 @@ if (BUILD_CARLA_CLIENT)
file (
GLOB
LIBCARLA_CLIENT_SOURCES_THIRD_PARTY
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp
${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp
${LIBCARLA_SOURCE_PATH}/third-party/odrSpiral/*.cpp
${LIBCARLA_SOURCE_PATH}/third-party/pugixml/*.cpp
)
carla_add_library (

View File

@ -23,13 +23,47 @@ set (
RecastNavigation::DetourCrowd
)
get_target_property (Boost_asio_TARGET_NAME Boost::asio ALIASED_TARGET)
get_target_property (Boost_python_TARGET_NAME Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR} ALIASED_TARGET)
get_target_property (Boost_geometry_TARGET_NAME Boost::geometry ALIASED_TARGET)
get_target_property (Boost_gil_TARGET_NAME Boost::gil ALIASED_TARGET)
get_target_property (RecastNavigation_Recast_TARGET_NAME RecastNavigation::Recast ALIASED_TARGET)
get_target_property (RecastNavigation_Detour_TARGET_NAME RecastNavigation::Detour ALIASED_TARGET)
get_target_property (RecastNavigation_DetourCrowd_TARGET_NAME RecastNavigation::DetourCrowd ALIASED_TARGET)
get_target_property (
Boost_asio_TARGET_NAME
Boost::asio
ALIASED_TARGET
)
get_target_property (
Boost_python_TARGET_NAME
Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}
ALIASED_TARGET
)
get_target_property (
Boost_geometry_TARGET_NAME
Boost::geometry
ALIASED_TARGET
)
get_target_property (
Boost_gil_TARGET_NAME
Boost::gil
ALIASED_TARGET
)
get_target_property (
RecastNavigation_Recast_TARGET_NAME
RecastNavigation::Recast
ALIASED_TARGET
)
get_target_property (
RecastNavigation_Detour_TARGET_NAME
RecastNavigation::Detour
ALIASED_TARGET
)
get_target_property (
RecastNavigation_DetourCrowd_TARGET_NAME
RecastNavigation::DetourCrowd
ALIASED_TARGET
)
set (
CARLA_PYTHON_API_CARLA_PATH

View File

@ -1,6 +1,6 @@
cmake_minimum_required (
VERSION
@CMAKE_MAJOR_VERSION@.@CMAKE_MINOR_VERSION@.@CMAKE_PATCH_VERSION@
@CARLA_CMAKE_MINIMUM_REQUIRED_VERSION@
)
project (
@ -47,7 +47,7 @@ set (
${CMAKE_CURRENT_SOURCE_DIR}
)
carla_message (
carla_message_verbose (
"Selected Python executable: ${Python3_EXECUTABLE} (Interpreter ID: ${Python3_INTERPRETER_ID})"
)

View File

@ -1,10 +1,14 @@
cmake_minimum_required (VERSION 3.28.0)
cmake_minimum_required (
VERSION
${CARLA_CMAKE_MINIMUM_REQUIRED_VERSION}
)
project (carla-ros2-native-project)
include (ExternalProject)
set (PROJECT_INSTALL_PATH ${CMAKE_CURRENT_BINARY_DIR}/install)
set (PROJECT_CMAKE_FLAGS
-DCMAKE_CXX_COMPILER=${GXX_COMPILER}
-DCMAKE_C_COMPILER=${GCC_COMPILER}
@ -15,13 +19,13 @@ set (PROJECT_CMAKE_FLAGS
ExternalProject_add (
foonathan_memory
URL https://github.com/eProsima/foonathan_memory_vendor/archive/refs/heads/master.zip
URL https://github.com/eProsima/foonathan_memory_vendor/archive/refs/heads/${CARLA_FOONATHAN_MEMORY_VENDOR_TAG}.zip
CMAKE_ARGS ${PROJECT_CMAKE_FLAGS} -DBUILD_SHARED_LIBS=ON -DFOONATHAN_MEMORY_FORCE_VENDORED_BUILD=ON
)
ExternalProject_add (
fastcdr
URL https://github.com/eProsima/Fast-CDR/archive/refs/heads/1.1.x.zip
URL https://github.com/eProsima/Fast-CDR/archive/refs/heads/${CARLA_FASTCDR_TAG}.zip
CMAKE_ARGS ${PROJECT_CMAKE_FLAGS}
)
@ -30,7 +34,7 @@ ExternalProject_add (
ExternalProject_add (
fastdds
GIT_REPOSITORY https://github.com/eProsima/Fast-DDS.git
GIT_TAG 2.11.2
GIT_TAG ${CARLA_FASTDDS_TAG}
CMAKE_ARGS ${PROJECT_CMAKE_FLAGS} -DTHIRDPARTY_Asio=FORCE -DTHIRDPARTY_TinyXML2=FORCE -DCOMPILE_TOOLS=OFF
DEPENDS foonathan_memory fastcdr
)

View File

@ -1,44 +1,63 @@
cmake_minimum_required (VERSION 3.28.0)
cmake_minimum_required (
VERSION
3.27.2
)
project(carla-ros2-native)
project (
carla-ros2-native
)
set (LIBCARLA_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../LibCarla/source)
file (
GLOB
LIBCARLA_ROS2_SOURCES
${LIBCARLA_SOURCE_PATH}/carla/ros2/publishers/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/subscribers/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/listeners/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.cpp
set (
LIBCARLA_SOURCE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/../../LibCarla/source
)
file (
GLOB
LIBCARLA_ROS2_HEADERS
${LIBCARLA_SOURCE_PATH}/carla/ros2/publishers/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/subscribers/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/listeners/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.h
GLOB
LIBCARLA_ROS2_SOURCES
${LIBCARLA_SOURCE_PATH}/carla/ros2/publishers/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/subscribers/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/listeners/*.cpp
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.cpp
)
file (
GLOB
LIBCARLA_ROS2_HEADERS
${LIBCARLA_SOURCE_PATH}/carla/ros2/publishers/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/subscribers/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/listeners/*.h
${LIBCARLA_SOURCE_PATH}/carla/ros2/types/*.h
)
add_library (
carla-ros2-native
SHARED
${LIBCARLA_ROS2_HEADERS}
${LIBCARLA_ROS2_SOURCES}
carla-ros2-native
SHARED
${LIBCARLA_ROS2_HEADERS}
${LIBCARLA_ROS2_SOURCES}
)
target_include_directories (carla-ros2-native SYSTEM PRIVATE
${LIBCARLA_SOURCE_PATH}
${CMAKE_INSTALL_PREFIX}/include
target_include_directories (
carla-ros2-native
SYSTEM PRIVATE
${LIBCARLA_SOURCE_PATH}
${CMAKE_INSTALL_PREFIX}/include
)
target_compile_definitions (carla-ros2-native PUBLIC
BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
target_compile_definitions (
carla-ros2-native
PUBLIC
BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
)
target_link_libraries(carla-ros2-native
${CMAKE_INSTALL_PREFIX}/lib/libfastrtps.so)
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

@ -66,19 +66,6 @@ if (ENABLE_ROS2_DEMO)
set (LAUNCH_ARGS ${LAUNCH_ARGS} --ros2-demo)
endif()
if (WIN32)
set (EXE_EXT .exe)
set (UE_SYSTEM_NAME Win64)
elseif (LINUX)
set (EXE_EXT)
set (UE_SYSTEM_NAME Linux)
elseif (APPLE)
set (EXE_EXT)
set (UE_SYSTEM_NAME Mac)
else ()
carla_error ("Unknown target system.")
endif ()
set (
UNREAL_EDITOR_PATH
${CARLA_UNREAL_ENGINE_PATH}/Engine/Binaries/${UE_SYSTEM_NAME}/UnrealEditor${EXE_EXT}
@ -86,9 +73,8 @@ set (
set (CARLA_UE_CONTENT_CHECK_PATH ${CARLA_UE_PATH}/Content/Carla/Blueprints)
if (IS_DIRECTORY ${CARLA_UE_CONTENT_CHECK_PATH})
carla_message ("CARLA Unreal Content - FOUND")
carla_message_verbose ("CARLA Unreal Content - FOUND")
else ()
carla_message ("CARLA Unreal Content - MISSING")
carla_warning ("Could not find CARLA Content, download it or running the editor will result in a crash.")
endif ()
@ -380,8 +366,11 @@ function (
set (PACKAGE_CONFIGURATION "default (shipping)")
endif ()
set (TARGET_NAME_SHORT package${TARGET_NAME_SUFFIX})
set (TARGET_NAME carla-unreal-${TARGET_NAME_SHORT})
carla_add_custom_target (
carla-unreal-package${TARGET_NAME_SUFFIX}
${TARGET_NAME}
"Create a CARLA package in ${PACKAGE_CONFIGURATION} mode."
COMMAND
${CARLA_UE_BUILD_COMMAND_PREFIX}
@ -413,9 +402,9 @@ function (
USES_TERMINAL
VERBATIM
)
add_custom_command (
TARGET carla-unreal-package${TARGET_NAME_SUFFIX}
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "********** PACKAGE CREATING VERSION FILE UNREAL PACKAGE EXTRA FILES STARTED **********"
COMMAND ${CMAKE_COMMAND}
@ -449,21 +438,24 @@ function (
)
add_dependencies (
carla-unreal-package${TARGET_NAME_SUFFIX}
${TARGET_NAME}
carla-unreal-editor
)
carla_add_custom_target (
package${TARGET_NAME_SUFFIX}
${TARGET_NAME_SHORT}
"Create a CARLA package in ${PACKAGE_CONFIGURATION} mode."
)
add_dependencies (
package${TARGET_NAME_SUFFIX}
carla-unreal-package${TARGET_NAME_SUFFIX}
${TARGET_NAME_SHORT}
${TARGET_NAME}
)
endfunction()
# Docs for UE5 build configurations:
# https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/DevelopmentSetup/BuildConfigurations/
add_carla_ue_package_target("" Shipping)
@ -488,12 +480,6 @@ set (
VERBATIM
)
carla_add_custom_target (
launch
"Build and open CARLA in the Unreal Editor."
${CARLA_LAUNCH_TARGET_OPTIONS}
)
if (WIN32)
set (
PRELAUNCH_CONTENT_CHECK_COMMAND
@ -517,12 +503,6 @@ carla_add_custom_target (
VERBATIM
)
add_dependencies (
launch
carla-unreal-editor
check-unreal-content
)
carla_add_custom_target (
launch-only
"Open CARLA in the Unreal Editor. This will not rebuild outdated targets."
@ -534,6 +514,18 @@ add_dependencies (
check-unreal-content
)
carla_add_custom_target (
launch
"Build and open CARLA in the Unreal Editor."
${CARLA_LAUNCH_TARGET_OPTIONS}
)
add_dependencies (
launch
carla-unreal-editor
check-unreal-content
)
set_property (
DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
"${CARLA_UE_PATH}/Binaries"