From 9179489b96491ac7a4b06eef4dafd65b7db19636 Mon Sep 17 00:00:00 2001 From: Marcel Pi <25649656+MarcelPiNacy@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:52:25 +0100 Subject: [PATCH] More progress... --- CMakeLists.txt | 619 +++++++----------------------- LibCarla/CMakeLists.txt | 275 +++++++++++++ PythonAPI/CMakeLists.txt | 106 +++++ osm-world-renderer/CMakeLists.txt | 63 ++- 4 files changed, 565 insertions(+), 498 deletions(-) create mode 100644 LibCarla/CMakeLists.txt create mode 100644 PythonAPI/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f8dcdf79..82cf0be1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,23 +1,35 @@ cmake_minimum_required (VERSION 3.20.0) + cmake_policy (SET CMP0097 NEW) cmake_policy (SET CMP0140 NEW) set (CARLA_VERSION_MAJOR 0) set (CARLA_VERSION_MINOR 9) -set (CARLA_VERSION_PATCH 14) -set (CARLA_VERSION ${CARLA_VERSION_MAJOR}.${CARLA_VERSION_MINOR}.${CARLA_VERSION_PATCH}) +set (CARLA_VERSION_PATCH 15) -set (CARLA_WORKSPACE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) -set (CARLA_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR}) +set ( + CARLA_VERSION + ${CARLA_VERSION_MAJOR}.${CARLA_VERSION_MINOR}.${CARLA_VERSION_PATCH} +) project ( CARLA VERSION ${CARLA_VERSION} LANGUAGES CXX DESCRIPTION "Open-source simulator for autonomous driving research." - HOMEPAGE_URL "https://carla.org" + HOMEPAGE_URL https://carla.org ) +set (CMAKE_CXX_STANDARD 20) +set (CMAKE_CXX_STANDARD_REQUIRED ON) + +include (CheckCCompilerFlag) +include (CheckCXXCompilerFlag) +include (ExternalProject) +include (FetchContent) + +set (CARLA_WORKSPACE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) + macro (carla_string_option NAME DESCRIPTION VALUE) set (${NAME} ${VALUE} CACHE STRING ${DESCRIPTION}) endmacro () @@ -25,45 +37,79 @@ endmacro () carla_string_option ( CARLA_DEPENDENCIES_PATH "Where to build CARLA dependencies." - ${CARLA_BUILD_PATH}/Dependencies) + ${CMAKE_CURRENT_BINARY_DIR}/Dependencies +) carla_string_option ( CARLA_DEPENDENCIES_INSTALL_PREFIX "Where to install CARLA dependencies." - ${CMAKE_CURRENT_SOURCE_DIR}/Install) + ${CMAKE_CURRENT_SOURCE_DIR}/Install +) set ( CMAKE_INSTALL_PREFIX ${CARLA_DEPENDENCIES_INSTALL_PREFIX} ) -option (BUILD_CARLA_CLIENT "Build the LibCarla client." OFF) -option (BUILD_CARLA_SERVER "Build the LibCarla server." OFF) -option (ENABLE_LIBCARLA_PYTORCH "Enable LibCarla-PyTorch." OFF) -option (BUILD_PYTHON_API "Build the CARLA Python API." ON) -option (ENABLE_OSM2ODR "Enable OSM2ODR." ${BUILD_PYTHON_API}) -option (ENABLE_RSS "Enable RSS components (ad-rss-lib)" OFF) -option (INSTALL_LIBCARLA "Install LibCarla and all of its dependencies." ON) -option (BUILD_OSM_WORLD_RENDERER "Build OSM World Renderer." ON) -option (ENABLE_RTTI "Enable C++ RTTI." OFF) -option (ENABLE_EXCEPTIONS "Enable C++ Exceptions." OFF) - -set ( - CMAKE_MODULE_PATH - ${CARLA_WORKSPACE_PATH}/cmake/modules +option ( + BUILD_CARLA_CLIENT + "Build the LibCarla client." + ON ) -include (CheckCCompilerFlag) -include (CheckCXXCompilerFlag) -include (ExternalProject) -include (FetchContent) +option ( + BUILD_CARLA_SERVER + "Build the LibCarla server." + ON +) -set (CMAKE_CXX_STANDARD 20) -set (CMAKE_CXX_STANDARD_REQUIRED ON) +option ( + ENABLE_LIBCARLA_PYTORCH + "Enable LibCarla-PyTorch." + OFF +) -set (LIBCARLA_SOURCE_PATH ${CARLA_WORKSPACE_PATH}/LibCarla/source) -set (LIBCARLA_THIRD_PARTY_SOURCE_PATH ${LIBCARLA_SOURCE_PATH}/third-party) -set (PYTHON_API_PATH ${CARLA_WORKSPACE_PATH}/PythonAPI) +option ( + BUILD_PYTHON_API + "Build the CARLA Python API." + ON +) + +option ( + ENABLE_OSM2ODR + "Enable OSM2ODR." + ${BUILD_PYTHON_API} +) + +option ( + ENABLE_RSS + "Enable RSS components (ad-rss-lib)" + OFF +) + +option ( + INSTALL_LIBCARLA + "Install LibCarla and all of its dependencies." + ON +) + +option ( + BUILD_OSM_WORLD_RENDERER + "Build OSM World Renderer." + ON +) + +option ( + ENABLE_RTTI + "Enable C++ RTTI." + OFF +) + +option ( + ENABLE_EXCEPTIONS + "Enable C++ Exceptions." + OFF +) set (EXTERNAL_DEPENDENCY_LIST) @@ -72,7 +118,8 @@ macro (carla_declare_git_dependency NAME URL TAG) ${NAME} GIT_REPOSITORY ${URL} GIT_TAG ${TAG} - GIT_SHALLOW TRUE + GIT_PROGRESS ON + GIT_SHALLOW ON ${ARGN} ) list (APPEND EXTERNAL_DEPENDENCY_LIST ${NAME}) @@ -83,7 +130,8 @@ macro (carla_declare_download_dependency NAME URL) ${NAME} URL ${URL} DOWNLOAD_EXTRACT_TIMESTAMP TRUE - ${ARGN}) + ${ARGN} + ) FetchContent_MakeAvailable (${NAME}) endmacro () @@ -99,7 +147,8 @@ function (carla_find_library OUT_RESULT PATTERN) GLOB_RECURSE CANDIDATES LIST_DIRECTORIES FALSE - ${PATTERN}) + ${PATTERN} + ) message ("Found ${CANDIDATES}") list (GET CANDIDATES 0 FIRST_VALUE) message ("Selected ${FIRST_VALUE}") @@ -110,16 +159,31 @@ endfunction () set (CARLA_DEFAULT_DEPENDENCY_ARGS) if (CMAKE_C_COMPILER) - list (APPEND CARLA_DEFAULT_DEPENDENCY_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}) + list ( + APPEND CARLA_DEFAULT_DEPENDENCY_ARGS + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + ) endif () + if (CMAKE_INSTALL_PREFIX) - list (APPEND CARLA_DEFAULT_DEPENDENCY_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}) + list ( + APPEND CARLA_DEFAULT_DEPENDENCY_ARGS + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + ) endif () + if (CMAKE_CXX_COMPILER) - list (APPEND CARLA_DEFAULT_DEPENDENCY_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) + list ( + APPEND CARLA_DEFAULT_DEPENDENCY_ARGS + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ) endif () + if (CMAKE_BUILD_TYPE) - list (APPEND CARLA_DEFAULT_DEPENDENCY_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) + list ( + APPEND CARLA_DEFAULT_DEPENDENCY_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + ) endif () # --- BOOST --- @@ -128,6 +192,7 @@ carla_string_option (CARLA_BOOST_TAG "Target boost git tag." boost-1.84.0) set ( REQUIRED_BOOST_LIBRARIES + assert algorithm python iterator @@ -140,12 +205,18 @@ carla_declare_git_dependency ( ${CARLA_BOOST_TAG} INSTALL_COMMAND "" CMAKE_ARGS - ${CARLA_DEFAULT_DEPENDENCY_ARGS} - -DBOOST_INCLUDE_LIBRARIES="${REQUIRED_BOOST_LIBRARIES}" - -DBOOST_ENABLE_PYTHON=ON) - -set (BOOST_INCLUDE_PATH ${CARLA_DEPENDENCIES_PATH}/Install/boost/include) -set (BOOST_LIBRARY_PATH ${CARLA_DEPENDENCIES_PATH}/Install/boost/lib) + ${CARLA_DEFAULT_DEPENDENCY_ARGS} + -DBOOST_INCLUDE_LIBRARIES=${REQUIRED_BOOST_LIBRARIES} + -DBOOST_ENABLE_PYTHON=ON + GIT_SUBMODULES + tools/cmake + libs/core + libs/assert + libs/algorithm + libs/python + libs/iterator + libs/asio +) @@ -161,8 +232,6 @@ carla_declare_git_dependency ( ${CARLA_DEFAULT_DEPENDENCY_ARGS} -DBUILD_SHARED_LIBS=OFF) -set (ZLIB_INCLUDE_PATH ${CARLA_DEPENDENCIES_PATH}/Install/zlib/include) -set (ZLIB_LIBRARY_PATH ${CARLA_DEPENDENCIES_PATH}/Install/zlib/lib) set ( ZLIB_INCLUDE_PATHS ${CARLA_DEPENDENCIES_PATH}/Source/zlib @@ -190,8 +259,15 @@ carla_declare_git_dependency ( add_dependencies (libpng zlib) -set (LIBPNG_INCLUDE_PATH ${CARLA_DEPENDENCIES_PATH}/Install/libpng/include) -set (LIBPNG_LIBRARY_PATH ${CARLA_DEPENDENCIES_PATH}/Install/libpng/lib) +set ( + LIBPNG_INCLUDE_PATH + ${CARLA_DEPENDENCIES_PATH}/Install/libpng/include +) + +set ( + LIBPNG_LIBRARY_PATH + ${CARLA_DEPENDENCIES_PATH}/Install/libpng/lib +) @@ -201,11 +277,17 @@ carla_string_option (CARLA_SQLITE_VERSION_MAJOR "Target SQLite version" 3) carla_string_option (CARLA_SQLITE_VERSION_MINOR "Target SQLite version" 45) carla_string_option (CARLA_SQLITE_VERSION_PATCH "Target SQLite version" 0000) -set (SQLITE_TAG ${CARLA_SQLITE_VERSION_MAJOR}${CARLA_SQLITE_VERSION_MINOR}${CARLA_SQLITE_VERSION_PATCH}) +set (SQLITE_VERSION ${CARLA_SQLITE_VERSION_MAJOR}${CARLA_SQLITE_VERSION_MINOR}${CARLA_SQLITE_VERSION_PATCH}) + +project ( + sqlite-amalgam + LANGUAGES C + VERSION ${SQLITE_VERSION} +) carla_declare_download_dependency ( sqlite3 - https://www.sqlite.org/2024/sqlite-amalgamation-${SQLITE_TAG}.zip + https://www.sqlite.org/2024/sqlite-amalgamation-${SQLITE_VERSION}.zip ) add_library ( @@ -219,7 +301,10 @@ add_executable ( ${sqlite3_SOURCE_DIR}/shell.c ) -target_link_libraries (sqlite3 PRIVATE libsqlite3) +target_link_libraries ( + sqlite3 PRIVATE + libsqlite3 +) @@ -343,23 +428,6 @@ set ( CARLA_COMMON_DEFINITIONS LIBCARLA_IMAGE_WITH_PNG_SUPPORT=true) -set ( - CARLA_COMMON_INCLUDE_PATHS - ${LIBCARLA_SOURCE_PATH} - ${BOOST_INCLUDE_PATH} - ${CHRONO_INCLUDE_PATH} - ${EIGEN_INCLUDE_PATH} - ${GOOGLETEST_INCLUDE_PATH} - ${LIBPNG_INCLUDE_PATH} - ${PROJ_INCLUDE_PATH} - ${RECAST_INCLUDE_PATH} - ${RPCLIB_INCLUDE_PATH} - ${SQLITE_INCLUDE_PATH} - ${XERCESC_INCLUDE_PATH} - ${ZLIB_INCLUDE_PATH}) - - - if (WIN32) # https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170 list (APPEND CARLA_COMMON_DEFINITIONS _WIN32_WINNT=0x0601) # --- Windows 10 --- @@ -367,8 +435,6 @@ if (WIN32) list (APPEND CARLA_COMMON_DEFINITIONS HAVE_SNPRINTF) endif () - - set (CARLA_EXCEPTION_DEFINITIONS) if (ENABLE_EXCEPTIONS) @@ -379,8 +445,6 @@ else () list (APPEND CARLA_EXCEPTION_DEFINITIONS PUGIXML_NO_EXCEPTIONS) endif () - - set (CARLA_RTTI_DEFINITIONS) if (ENABLE_RTTI) @@ -388,419 +452,14 @@ else () list (APPEND CARLA_RTTI_DEFINITIONS BOOST_TYPE_INDEX_FORCE_NO_RTTI_COMPATIBILITY) endif () - - -if (BUILD_CARLA_SERVER OR BUILD_CARLA_CLIENT) - configure_file ( - ${LIBCARLA_SOURCE_PATH}/carla/Version.h.in - ${LIBCARLA_SOURCE_PATH}/carla/Version.h) +if (BUILD_CARLA_CLIENT OR BUILD_CARLA_SERVER) + add_subdirectory (LibCarla) endif () - - -if (BUILD_CARLA_SERVER) - - project (carla-server) - - file ( - GLOB - LIBCARLA_SERVER_SOURCES - ${LIBCARLA_SOURCE_PATH}/carla/Buffer.cpp - ${LIBCARLA_SOURCE_PATH}/carla/Exception.cpp - ${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/SensorHeaderSerializer.cpp - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp - ) - - 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 - ) - - file ( - GLOB - LIBCARLA_SERVER_HEADERS - ${LIBCARLA_SOURCE_PATH}/carla/*.h - ${LIBCARLA_SOURCE_PATH}/carla/geom/*.h - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h - ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h - ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.h - ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h - ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h - ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h - ${LIBCARLA_SOURCE_PATH}/compiler/*.h - ) - - 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 - ) - - add_library ( - carla-server STATIC - ${LIBCARLA_SERVER_HEADERS} - ${LIBCARLA_SERVER_SOURCES} - ${LIBCARLA_SERVER_HEADERS_THIRD_PARTY} - ${LIBCARLA_SERVER_SOURCES_THIRD_PARTY} - ) - - if (EXTERNAL_DEPENDENCY_LIST) - add_dependencies (carla-server ${EXTERNAL_DEPENDENCY_LIST}) - endif () - - # target_compile_options (carla-server PRIVATE /EHsc) - - target_include_directories ( - carla-server PRIVATE - ${CARLA_COMMON_INCLUDE_PATHS} - ) - - target_compile_definitions ( - carla-server PRIVATE - ${CARLA_COMMON_DEFINITIONS} - ${CARLA_EXCEPTION_DEFINITIONS} - ${CARLA_RTTI_DEFINITIONS} - ) - - install (TARGETS carla-server DESTINATION lib) - - foreach (HEADER ${LIBCARLA_SERVER_HEADERS}) - cmake_path (GET HEADER PARENT_PATH HEADER_PARENT) - cmake_path (RELATIVE_PATH HEADER_PARENT BASE_DIRECTORY ${LIBCARLA_SOURCE_PATH}/carla OUTPUT_VARIABLE HEADER_RELATIVE) - install (FILES ${HEADER} DESTINATION include/carla/${HEADER_RELATIVE}) - endforeach () - -endif () - - - -if (BUILD_CARLA_CLIENT) - - project (carla-client) - - file ( - GLOB - LIBCARLA_CLIENT_HEADERS - ${LIBCARLA_SOURCE_PATH}/carla/*.h - ${LIBCARLA_SOURCE_PATH}/carla/client/*.h - ${LIBCARLA_SOURCE_PATH}/carla/client/detail/*.h - ${LIBCARLA_SOURCE_PATH}/carla/geom/*.h - ${LIBCARLA_SOURCE_PATH}/carla/image/*.h - ${LIBCARLA_SOURCE_PATH}/carla/nav/*.h - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h - ${LIBCARLA_SOURCE_PATH}/carla/pointcloud/*.h - ${LIBCARLA_SOURCE_PATH}/carla/profiler/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h - ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h - ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h - ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.h - ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h - ${LIBCARLA_SOURCE_PATH}/carla/sensor/data/*.h - ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.h - ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h - ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h - ${LIBCARLA_SOURCE_PATH}/carla/trafficmanager/*.h - ${LIBCARLA_SOURCE_PATH}/compiler/*.h - ) - - if (ENABLE_RSS) - file ( - GLOB - LIBCARLA_CLIENT_HEADERS_RSS - ${LIBCARLA_SOURCE_PATH}/carla/rss/*.h - ) - list ( - APPEND - LIBCARLA_CLIENT_HEADERS - ${LIBCARLA_CLIENT_HEADERS_RSS} - ) - endif () - - 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 - ) - - file ( - GLOB - LIBCARLA_CLIENT_SOURCES - ${LIBCARLA_SOURCE_PATH}/carla/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/client/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/client/detail/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/image/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/nav/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/pointcloud/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/sensor/data/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp - ${LIBCARLA_SOURCE_PATH}/carla/trafficmanager/*.cpp - ) - - if (ENABLE_RSS) - file ( - GLOB - LIBCARLA_CLIENT_SOURCES_RSS - ${LIBCARLA_SOURCE_PATH}/carla/rss/*.cpp - ) - list ( - APPEND - LIBCARLA_CLIENT_SOURCES - ${LIBCARLA_CLIENT_SOURCES_RSS} - ) - endif () - - file ( - GLOB - LIBCARLA_CLIENT_SOURCES_THIRD_PARTY - ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp - ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp - ) - - add_library ( - carla-client STATIC - ${LIBCARLA_CLIENT_HEADERS} - ${LIBCARLA_CLIENT_SOURCES} - ${LIBCARLA_CLIENT_HEADERS_THIRD_PARTY} - ${LIBCARLA_CLIENT_SOURCES_THIRD_PARTY} - ) - - if (EXTERNAL_DEPENDENCY_LIST) - add_dependencies (carla-client ${EXTERNAL_DEPENDENCY_LIST}) - endif () - - target_include_directories ( - carla-client PRIVATE - ${CARLA_COMMON_INCLUDE_PATHS} - ) - - target_compile_definitions ( - carla-client PRIVATE - ${CARLA_COMMON_DEFINITIONS} - ${CARLA_EXCEPTION_DEFINITIONS} - ${CARLA_RTTI_DEFINITIONS} - ) - - install (TARGETS carla-client DESTINATION lib) - - foreach (HEADER ${LIBCARLA_CLIENT_HEADERS}) - cmake_path (GET HEADER PARENT_PATH HEADER_PARENT) - cmake_path (RELATIVE_PATH HEADER_PARENT BASE_DIRECTORY ${LIBCARLA_SOURCE_PATH}/carla OUTPUT_VARIABLE HEADER_RELATIVE) - install (FILES ${HEADER} DESTINATION include/carla/${HEADER_RELATIVE}) - endforeach () - -endif () - - - if (BUILD_OSM_WORLD_RENDERER) - - project (OsmMapRenderer) - - set (OSM_RENDERER_PATH ${CARLA_WORKSPACE_PATH}/osm-world-renderer) - - add_library ( - LibOSMRenderer - ${OSM_RENDERER_PATH}/OsmRenderer/src/OsmRenderer.cpp - ${OSM_RENDERER_PATH}/OsmRenderer/src/MapDrawer.cpp - ${OSM_RENDERER_PATH}/OsmRenderer/src/MapRasterizer.cpp - ) - - if (EXTERNAL_DEPENDENCY_LIST) - add_dependencies (LibOSMRenderer ${EXTERNAL_DEPENDENCY_LIST}) - endif () - - target_include_directories ( - LibOSMRenderer PUBLIC - ${OSM_RENDERER_PATH}/OsmRenderer/include - ) - - add_executable ( - OSMWorldRenderer - ${OSM_RENDERER_PATH}/OsmRenderer/main.cpp - ) - - target_link_libraries (OSMWorldRenderer PRIVATE LibOSMRenderer) - target_link_libraries (OSMWorldRenderer PRIVATE osmscout) - target_link_libraries (OSMWorldRenderer PRIVATE osmscout_map) - target_link_libraries (OSMWorldRenderer PRIVATE osmscout_map_svg) - target_link_libraries (OSMWorldRenderer PRIVATE lunasvg) - - target_compile_definitions ( - OSMWorldRenderer PRIVATE - _USE_MATH_DEFINES - ${CARLA_COMMON_DEFINITIONS} - ) - + add_subdirectory (osm-world-renderer) endif () - - if (BUILD_PYTHON_API) - - project (carla-python-api) - - set (Python_USE_STATIC_LIBS ON) - - find_package ( - Python - COMPONENTS - Interpreter - Development.Module - REQUIRED) - - set (PYTHON_API_CARLA_PATH ${PYTHON_API_PATH}/carla) - set (PYTHON_API_SOURCE_PATH ${PYTHON_API_CARLA_PATH}/source/libcarla) - - configure_file ( - ${PYTHON_API_PATH}/carla/pyproject.toml.in - ${PYTHON_API_PATH}/carla/pyproject.toml) - - set ( - PYTHON_API_SOURCES - ${PYTHON_API_SOURCE_PATH}/Actor.cpp - ${PYTHON_API_SOURCE_PATH}/Blueprint.cpp - ${PYTHON_API_SOURCE_PATH}/Client.cpp - ${PYTHON_API_SOURCE_PATH}/Commands.cpp - ${PYTHON_API_SOURCE_PATH}/Control.cpp - ${PYTHON_API_SOURCE_PATH}/Exception.cpp - ${PYTHON_API_SOURCE_PATH}/Geom.cpp - ${PYTHON_API_SOURCE_PATH}/LightManager.cpp - ${PYTHON_API_SOURCE_PATH}/Map.cpp - ${PYTHON_API_SOURCE_PATH}/OSM2ODR.cpp - ${PYTHON_API_SOURCE_PATH}/PythonAPI.cpp - ${PYTHON_API_SOURCE_PATH}/PythonAPI.h - ${PYTHON_API_SOURCE_PATH}/Sensor.cpp - ${PYTHON_API_SOURCE_PATH}/SensorData.cpp - ${PYTHON_API_SOURCE_PATH}/Snapshot.cpp - ${PYTHON_API_SOURCE_PATH}/TrafficManager.cpp - ${PYTHON_API_SOURCE_PATH}/Weather.cpp - ${PYTHON_API_SOURCE_PATH}/World.cpp - ) - - if (ENABLE_RSS) - list (APPEND PYTHON_API_SOURCES ${PYTHON_API_SOURCE_PATH}/AdRss.cpp) - endif () - - Python_add_library( - carla-python-api - MODULE - ${PYTHON_API_SOURCES} - WITH_SOABI) - - if (EXTERNAL_DEPENDENCY_LIST) - add_dependencies (carla-python-api ${EXTERNAL_DEPENDENCY_LIST}) - endif () - - target_compile_definitions ( - carla-python-api - PRIVATE - ${CARLA_COMMON_DEFINITIONS} - ${CARLA_RTTI_DEFINITIONS} - # ${CARLA_EXCEPTION_DEFINITIONS} - BOOST_ALL_NO_LIB - BOOST_PYTHON_STATIC_LIB - LIBCARLA_WITH_PYTHON_SUPPORT) - - target_include_directories ( - carla-python-api - PRIVATE - ${CARLA_COMMON_INCLUDE_PATHS} - ${PYTHON_API_SOURCE_PATH} - ${SUMO_INCLUDE_PATH}) - - # carla_find_library (BOOST_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/boost/lib/*boost_python*${LIB_EXT}) - # carla_find_library (RPCLIB_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/rpclib/lib/*rpc*${LIB_EXT}) - # carla_find_library (LIBPNG_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/libpng/lib/*libpng*_static*${LIB_EXT}) - # carla_find_library (ZLIB_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/zlib/lib/*zlib${LIB_EXT}) - # carla_find_library (RECAST_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/recast/lib/*Recast${LIB_EXT}) - # carla_find_library (DETOUR_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/recast/lib/*Detour${LIB_EXT}) - # carla_find_library (DETOURCROWD_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/recast/lib/*DetourCrowd${LIB_EXT}) - # carla_find_library (XERCESC_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/xercesc/lib/*xerces-c*${LIB_EXT}) - # carla_find_library (OSM2ODR_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/sumo/lib/*osm2odr${LIB_EXT}) - # carla_find_library (SQLITE_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Build/sqlite/*sqlite*${LIB_EXT}) - # carla_find_library (PROJ_LIBRARY ${CARLA_DEPENDENCIES_PATH}/Install/proj/lib/*proj${LIB_EXT}) - - set ( - PYTHON_API_LIBRARY_DEPENDENCIES - ${BOOST_LIBRARY} - ${RPCLIB_LIBRARY} - ${LIBPNG_LIBRARY} - ${ZLIB_LIBRARY} - ${RECAST_LIBRARY} - ${DETOUR_LIBRARY} - ${DETOURCROWD_LIBRARY} - ${XERCESC_LIBRARY} - ${OSM2ODR_LIBRARY} - ${SQLITE_LIBRARY} - ${PROJ_LIBRARY}) - - if (WIN32) - list (APPEND PYTHON_API_LIBRARY_DEPENDENCIES Shlwapi.lib) - endif () - - target_link_libraries ( - carla-python-api - PRIVATE - carla-client - ${PYTHON_API_LIBRARY_DEPENDENCIES}) - - #[[ - install ( - TARGETS - carla-python-api - DESTINATION - ${CARLA_BUILD_PATH}/PythonAPI/dist) - ]] + add_subdirectory (PythonAPI) endif () diff --git a/LibCarla/CMakeLists.txt b/LibCarla/CMakeLists.txt new file mode 100644 index 000000000..5b12467ec --- /dev/null +++ b/LibCarla/CMakeLists.txt @@ -0,0 +1,275 @@ +set (LIBCARLA_SOURCE_PATH ${CARLA_WORKSPACE_PATH}/LibCarla/source) +set (LIBCARLA_THIRD_PARTY_SOURCE_PATH ${LIBCARLA_SOURCE_PATH}/third-party) + +configure_file ( + ${LIBCARLA_SOURCE_PATH}/carla/Version.h.in + ${LIBCARLA_SOURCE_PATH}/carla/Version.h +) + +if (BUILD_CARLA_SERVER) + + project ( + carla-server + LANGUAGES CXX + VERSION ${CARLA_VERSION} + ) + + file ( + GLOB + LIBCARLA_SERVER_SOURCES + ${LIBCARLA_SOURCE_PATH}/carla/Buffer.cpp + ${LIBCARLA_SOURCE_PATH}/carla/Exception.cpp + ${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/SensorHeaderSerializer.cpp + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp + ) + + 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 + ) + + file ( + GLOB + LIBCARLA_SERVER_HEADERS + ${LIBCARLA_SOURCE_PATH}/carla/*.h + ${LIBCARLA_SOURCE_PATH}/carla/geom/*.h + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h + ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h + ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.h + ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h + ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h + ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h + ${LIBCARLA_SOURCE_PATH}/compiler/*.h + ) + + 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 + ) + + add_library ( + carla-server STATIC + ${LIBCARLA_SERVER_HEADERS} + ${LIBCARLA_SERVER_SOURCES} + ${LIBCARLA_SERVER_HEADERS_THIRD_PARTY} + ${LIBCARLA_SERVER_SOURCES_THIRD_PARTY} + ) + + if (EXTERNAL_DEPENDENCY_LIST) + add_dependencies (carla-server ${EXTERNAL_DEPENDENCY_LIST}) + endif () + + target_include_directories ( + carla-server PRIVATE + ${LIBCARLA_SOURCE_PATH} + ) + + target_compile_definitions ( + carla-server PRIVATE + ${CARLA_COMMON_DEFINITIONS} + ${CARLA_EXCEPTION_DEFINITIONS} + ${CARLA_RTTI_DEFINITIONS} + ) + + install ( + TARGETS + carla-server + DESTINATION lib + ) + + foreach (HEADER ${LIBCARLA_SERVER_HEADERS}) + cmake_path (GET HEADER PARENT_PATH HEADER_PARENT) + cmake_path ( + RELATIVE_PATH HEADER_PARENT + BASE_DIRECTORY ${LIBCARLA_SOURCE_PATH}/carla + OUTPUT_VARIABLE HEADER_RELATIVE + ) + install ( + FILES ${HEADER} + DESTINATION include/carla/${HEADER_RELATIVE} + ) + endforeach () + +endif () + + + +if (BUILD_CARLA_CLIENT) + + project ( + carla-client + LANGUAGES CXX + VERSION ${CARLA_VERSION} + ) + + file ( + GLOB + LIBCARLA_CLIENT_HEADERS + ${LIBCARLA_SOURCE_PATH}/carla/*.h + ${LIBCARLA_SOURCE_PATH}/carla/client/*.h + ${LIBCARLA_SOURCE_PATH}/carla/client/detail/*.h + ${LIBCARLA_SOURCE_PATH}/carla/geom/*.h + ${LIBCARLA_SOURCE_PATH}/carla/image/*.h + ${LIBCARLA_SOURCE_PATH}/carla/nav/*.h + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.h + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.h + ${LIBCARLA_SOURCE_PATH}/carla/pointcloud/*.h + ${LIBCARLA_SOURCE_PATH}/carla/profiler/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.h + ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.h + ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.h + ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.h + ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.h + ${LIBCARLA_SOURCE_PATH}/carla/sensor/data/*.h + ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.h + ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.h + ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.h + ${LIBCARLA_SOURCE_PATH}/carla/trafficmanager/*.h + ${LIBCARLA_SOURCE_PATH}/compiler/*.h + ) + + if (ENABLE_RSS) + file ( + GLOB + LIBCARLA_CLIENT_HEADERS_RSS + ${LIBCARLA_SOURCE_PATH}/carla/rss/*.h + ) + list ( + APPEND + LIBCARLA_CLIENT_HEADERS + ${LIBCARLA_CLIENT_HEADERS_RSS} + ) + endif () + + 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 + ) + + file ( + GLOB + LIBCARLA_CLIENT_SOURCES + ${LIBCARLA_SOURCE_PATH}/carla/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/client/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/client/detail/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/geom/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/image/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/nav/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/opendrive/parser/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/pointcloud/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/element/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/general/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/object/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/road/signal/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/rpc/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/ros2/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/sensor/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/sensor/data/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/sensor/s11n/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/streaming/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/streaming/detail/tcp/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/streaming/low_level/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/multigpu/*.cpp + ${LIBCARLA_SOURCE_PATH}/carla/trafficmanager/*.cpp + ) + + if (ENABLE_RSS) + file ( + GLOB + LIBCARLA_CLIENT_SOURCES_RSS + ${LIBCARLA_SOURCE_PATH}/carla/rss/*.cpp + ) + list ( + APPEND + LIBCARLA_CLIENT_SOURCES + ${LIBCARLA_CLIENT_SOURCES_RSS} + ) + endif () + + file ( + GLOB + LIBCARLA_CLIENT_SOURCES_THIRD_PARTY + ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/odrSpiral/*.cpp + ${LIBCARLA_THIRD_PARTY_SOURCE_PATH}/pugixml/*.cpp + ) + + add_library ( + carla-client STATIC + ${LIBCARLA_CLIENT_HEADERS} + ${LIBCARLA_CLIENT_SOURCES} + ${LIBCARLA_CLIENT_HEADERS_THIRD_PARTY} + ${LIBCARLA_CLIENT_SOURCES_THIRD_PARTY} + ) + + if (EXTERNAL_DEPENDENCY_LIST) + add_dependencies (carla-client ${EXTERNAL_DEPENDENCY_LIST}) + endif () + + target_include_directories ( + carla-client PRIVATE + ${LIBCARLA_SOURCE_PATH} + ) + + target_compile_definitions ( + carla-client PRIVATE + ${CARLA_COMMON_DEFINITIONS} + ${CARLA_EXCEPTION_DEFINITIONS} + ${CARLA_RTTI_DEFINITIONS} + ) + + install (TARGETS carla-client DESTINATION lib) + + foreach (HEADER ${LIBCARLA_CLIENT_HEADERS}) + cmake_path (GET HEADER PARENT_PATH HEADER_PARENT) + cmake_path ( + RELATIVE_PATH HEADER_PARENT + BASE_DIRECTORY ${LIBCARLA_SOURCE_PATH}/carla + OUTPUT_VARIABLE HEADER_RELATIVE + ) + install ( + FILES ${HEADER} + DESTINATION include/carla/${HEADER_RELATIVE} + ) + endforeach () + +endif () diff --git a/PythonAPI/CMakeLists.txt b/PythonAPI/CMakeLists.txt new file mode 100644 index 000000000..581eb1e1e --- /dev/null +++ b/PythonAPI/CMakeLists.txt @@ -0,0 +1,106 @@ +project ( + carla-python-api + LANGUAGES CXX + VERSION ${CARLA_VERSION} +) + +find_package ( + Python + COMPONENTS + Interpreter + Development.Module + REQUIRED +) + +set (PYTHON_API_PATH ${CARLA_WORKSPACE_PATH}/PythonAPI) +set (PYTHON_API_CARLA_PATH ${PYTHON_API_PATH}/carla) +set (PYTHON_API_SOURCE_PATH ${PYTHON_API_CARLA_PATH}/source/libcarla) + +configure_file ( + ${PYTHON_API_PATH}/carla/pyproject.toml.in + ${PYTHON_API_PATH}/carla/pyproject.toml +) + +set ( + PYTHON_API_SOURCES + ${PYTHON_API_SOURCE_PATH}/Actor.cpp + ${PYTHON_API_SOURCE_PATH}/Blueprint.cpp + ${PYTHON_API_SOURCE_PATH}/Client.cpp + ${PYTHON_API_SOURCE_PATH}/Commands.cpp + ${PYTHON_API_SOURCE_PATH}/Control.cpp + ${PYTHON_API_SOURCE_PATH}/Exception.cpp + ${PYTHON_API_SOURCE_PATH}/Geom.cpp + ${PYTHON_API_SOURCE_PATH}/LightManager.cpp + ${PYTHON_API_SOURCE_PATH}/Map.cpp + ${PYTHON_API_SOURCE_PATH}/OSM2ODR.cpp + ${PYTHON_API_SOURCE_PATH}/PythonAPI.cpp + ${PYTHON_API_SOURCE_PATH}/PythonAPI.h + ${PYTHON_API_SOURCE_PATH}/Sensor.cpp + ${PYTHON_API_SOURCE_PATH}/SensorData.cpp + ${PYTHON_API_SOURCE_PATH}/Snapshot.cpp + ${PYTHON_API_SOURCE_PATH}/TrafficManager.cpp + ${PYTHON_API_SOURCE_PATH}/Weather.cpp + ${PYTHON_API_SOURCE_PATH}/World.cpp +) + +if (ENABLE_RSS) + list (APPEND PYTHON_API_SOURCES ${PYTHON_API_SOURCE_PATH}/AdRss.cpp) +endif () + +Python_add_library( + carla-python-api + MODULE + ${PYTHON_API_SOURCES} + WITH_SOABI +) + +if (EXTERNAL_DEPENDENCY_LIST) + add_dependencies ( + carla-python-api + ${EXTERNAL_DEPENDENCY_LIST} + ) +endif () + +target_compile_definitions ( + carla-python-api + PRIVATE + ${CARLA_COMMON_DEFINITIONS} + ${CARLA_RTTI_DEFINITIONS} + BOOST_ALL_NO_LIB + BOOST_PYTHON_STATIC_LIB + LIBCARLA_WITH_PYTHON_SUPPORT +) + +target_include_directories ( + carla-python-api + PRIVATE + ${PYTHON_API_SOURCE_PATH} + ${SUMO_INCLUDE_PATH} + ${LIBCARLA_SOURCE_PATH} +) + +set ( + PYTHON_API_LIBRARY_DEPENDENCIES + ${BOOST_LIBRARY} + ${RPCLIB_LIBRARY} + ${LIBPNG_LIBRARY} + ${ZLIB_LIBRARY} + ${RECAST_LIBRARY} + ${DETOUR_LIBRARY} + ${DETOURCROWD_LIBRARY} + ${XERCESC_LIBRARY} + ${OSM2ODR_LIBRARY} + ${SQLITE_LIBRARY} + ${PROJ_LIBRARY} +) + +if (WIN32) + list (APPEND PYTHON_API_LIBRARY_DEPENDENCIES Shlwapi.lib) +endif () + +target_link_libraries ( + carla-python-api + PRIVATE + carla-client + ${PYTHON_API_LIBRARY_DEPENDENCIES} +) \ No newline at end of file diff --git a/osm-world-renderer/CMakeLists.txt b/osm-world-renderer/CMakeLists.txt index 1ad166f0c..a5cff5292 100644 --- a/osm-world-renderer/CMakeLists.txt +++ b/osm-world-renderer/CMakeLists.txt @@ -1,22 +1,49 @@ -cmake_minimum_required (VERSION 3.5.1) -project (OsmMapRenderer) +project ( + osm-map-renderer + LANGUAGES CXX + VERSION ${CARLA_VERSION} +) -# Libosmscout and Luna SVG Library -include_directories (ThirdParties/include) -include_directories (ThirdParties/include/lunasvg) -link_directories (ThirdParties/lib) +set ( + OSM_RENDERER_PATH + ${CARLA_WORKSPACE_PATH}/osm-world-renderer +) -add_definitions (-D_USE_MATH_DEFINES) +add_library ( + lib-osm-map-renderer + ${OSM_RENDERER_PATH}/OsmRenderer/src/OsmRenderer.cpp + ${OSM_RENDERER_PATH}/OsmRenderer/src/MapDrawer.cpp + ${OSM_RENDERER_PATH}/OsmRenderer/src/MapRasterizer.cpp +) -# Source Files -add_library (OsmRenderer OsmRenderer/src/OsmRenderer.cpp) -target_sources (OsmRenderer PRIVATE OsmRenderer/src/MapDrawer.cpp) -target_sources (OsmRenderer PRIVATE OsmRenderer/src/MapRasterizer.cpp) -target_include_directories (OsmRenderer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/OsmRenderer/include) +if (EXTERNAL_DEPENDENCY_LIST) + add_dependencies ( + lib-osm-map-renderer + ${EXTERNAL_DEPENDENCY_LIST} + ) +endif () -add_executable (osm-world-renderer OsmRenderer/main.cpp) -target_link_libraries (osm-world-renderer OsmRenderer) -target_link_libraries (osm-world-renderer osmscout) -target_link_libraries (osm-world-renderer osmscout_map) -target_link_libraries (osm-world-renderer osmscout_map_svg) -target_link_libraries (osm-world-renderer lunasvg) \ No newline at end of file +target_include_directories ( + lib-osm-map-renderer PUBLIC + ${OSM_RENDERER_PATH}/OsmRenderer/include +) + +add_executable ( + osm-world-renderer + ${OSM_RENDERER_PATH}/OsmRenderer/main.cpp +) + +target_link_libraries ( + osm-world-renderer PRIVATE + lib-osm-map-renderer + osmscout + osmscout_map + osmscout_map_svg + lunasvg +) + +target_compile_definitions ( + osm-world-renderer PRIVATE + _USE_MATH_DEFINES + ${CARLA_COMMON_DEFINITIONS} +)