Find dependencies via pkg-config. --- CMakeLists.txt | 72 +++---------------- .../Applications/esmini/main.cpp | 2 + EnvironmentSimulator/CMakeLists.txt | 3 - .../Modules/Controllers/ControllerSumo.cpp | 1 - .../Modules/RoadManager/CMakeLists.txt | 7 +- .../Modules/ScenarioEngine/CMakeLists.txt | 17 +---- 6 files changed, 16 insertions(+), 86 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aec4cf55..c9689b44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ else() FATAL_ERROR) endif() +include(FindPkgConfig) + # ############################# Project generate options ########################################################### project( @@ -138,75 +140,26 @@ set_special_build_flags() include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/utils/get_subdirectories.cmake) include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/utils/set_folder.cmake) -# ############################### Downloading cloud packages ######################################################### - -include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/cloud/set_cloud_links.cmake) -set_cloud_links() - -include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/cloud/download.cmake) - -message(STATUS "Downloading dependencies...") - -download( - osg - ${EXTERNALS_OSG_PATH} - ${EXTERNALS_OSG_OS_SPECIFIC_PATH} - "${OSG_PACKAGE_URL}") - -download( - osi - ${EXTERNALS_OSI_PATH} - ${EXTERNALS_OSI_OS_SPECIFIC_PATH} - "${OSI_PACKAGE_URL}") - -download( - sumo - ${EXTERNALS_SUMO_PATH} - ${EXTERNALS_SUMO_OS_SPECIFIC_PATH} - "${SUMO_PACKAGE_URL}") - -download( - implot - ${EXTERNALS_IMPLOT_PATH} - ${EXTERNALS_IMPLOT_OS_SPECIFIC_PATH} - "${IMPLOT_PACKAGE_URL}") - -download( - models - ${RESOURCES_PATH} - ${MODELS_PATH} - "${MODELS_PACKAGE_URL}") - -if(NOT - (APPLE - OR MINGW)) - download( - googletest - ${EXTERNALS_GOOGLETEST_PATH} - ${EXTERNALS_GOOGLETEST_OS_SPECIFIC_PATH} - ${GTEST_PACKAGE_URL}) -endif() - # ############################### Loading external packages ########################################################## if(USE_GTEST) - include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/external/gtest.cmake) - set_gtest_libs() + find_package(GTest REQUIRED) endif() if(USE_OSG) - include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/external/osg.cmake) - set_osg_libs() + pkg_check_modules(OSG REQUIRED openscenegraph osgdb_jpeg osgdb_osg + osgdb_serializers_osg + osgdb_serializers_osgsim) endif() if(USE_OSI) - include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/external/osi.cmake) - set_osi_libs() + find_package(open_simulation_interface REQUIRED) + set(EXTERNALS_OSI_INCLUDES "${OPEN_SIMULATION_INTERFACE_INCLUDE_DIRS}") + set(OSI_LIBRARIES open_simulation_interface::open_simulation_interface) endif() if(USE_SUMO) - include(${CMAKE_CURRENT_SOURCE_DIR}/support/cmake/external/sumo.cmake) - set_sumo_libs() + set ( SUMO_LIBRARIES sumocpp tracicpp ) endif() if(USE_IMPLOT) @@ -229,10 +182,7 @@ if(NOT endif() # Add variables to global scope, e.g. when esmini is used as submodule -set(EXTERNALS_PUGIXML_PATH - ${EXTERNALS_PUGIXML_PATH} - CACHE INTERNAL - "") +find_package(pugixml) set(EXTERNALS_EXPR_PATH ${EXTERNALS_EXPR_PATH} CACHE INTERNAL diff --git a/EnvironmentSimulator/Applications/esmini/main.cpp b/EnvironmentSimulator/Applications/esmini/main.cpp index 84f38c7f..943c42c8 100644 --- a/EnvironmentSimulator/Applications/esmini/main.cpp +++ b/EnvironmentSimulator/Applications/esmini/main.cpp @@ -13,7 +13,9 @@ #include "playerbase.hpp" #include "CommonMini.cpp" #include "OSCParameterDistribution.hpp" +#if _USE_IMPLOT #include "Plot.hpp" +#endif #include <osgViewer/ViewerEventHandlers> #include <signal.h> diff --git a/EnvironmentSimulator/CMakeLists.txt b/EnvironmentSimulator/CMakeLists.txt index 87e1dd98..3db513a0 100644 --- a/EnvironmentSimulator/CMakeLists.txt +++ b/EnvironmentSimulator/CMakeLists.txt @@ -57,9 +57,6 @@ set_folder( set_folder( ScenarioEngine ${ModulesFolder}) -set_folder( - Externals - ${ModulesFolder}) set_folder( RoadManager ${ModulesFolder}) diff --git a/EnvironmentSimulator/Modules/Controllers/ControllerSumo.cpp b/EnvironmentSimulator/Modules/Controllers/ControllerSumo.cpp index 92b40c90..764d2d3b 100644 --- a/EnvironmentSimulator/Modules/Controllers/ControllerSumo.cpp +++ b/EnvironmentSimulator/Modules/Controllers/ControllerSumo.cpp @@ -16,7 +16,6 @@ #include "ScenarioGateway.hpp" #include "pugixml.hpp" -#include <utils/geom/PositionVector.h> #include <libsumo/Simulation.h> #include <libsumo/Vehicle.h> #include <libsumo/TraCIDefs.h> diff --git a/EnvironmentSimulator/Modules/RoadManager/CMakeLists.txt b/EnvironmentSimulator/Modules/RoadManager/CMakeLists.txt index afb77338..b8beba48 100644 --- a/EnvironmentSimulator/Modules/RoadManager/CMakeLists.txt +++ b/EnvironmentSimulator/Modules/RoadManager/CMakeLists.txt @@ -20,9 +20,6 @@ set(SOURCES odrSpiral.cpp LaneIndependentRouter.cpp) -set(SRC_ADDITIONAL - ${EXTERNALS_PUGIXML_PATH}/pugixml.cpp) - source_group( "External Libraries" FILES ${SRC_ADDITIONAL}) @@ -44,6 +41,7 @@ add_library( target_link_libraries( ${TARGET} PRIVATE CommonMini + pugixml # project_options ) @@ -54,8 +52,7 @@ target_include_directories( target_include_directories( ${TARGET} SYSTEM - PUBLIC ${EXTERNALS_PUGIXML_PATH} - ${ROAD_MANAGER_PATH}) + PUBLIC ${ROAD_MANAGER_PATH}) disable_static_analysis(${TARGET}) disable_iwyu(${TARGET}) diff --git a/EnvironmentSimulator/Modules/ScenarioEngine/CMakeLists.txt b/EnvironmentSimulator/Modules/ScenarioEngine/CMakeLists.txt index 5089dfc1..4b95a071 100644 --- a/EnvironmentSimulator/Modules/ScenarioEngine/CMakeLists.txt +++ b/EnvironmentSimulator/Modules/ScenarioEngine/CMakeLists.txt @@ -3,9 +3,6 @@ set(TARGET ScenarioEngine) -set(EXTERNAL_TARGET - Externals) - # ############################### Loading desired rules ############################################################## include(${CMAKE_SOURCE_DIR}/support/cmake/rule/disable_static_analysis.cmake) @@ -40,26 +37,15 @@ endif( NOT USE_OSI) -set(SRC_ADDITIONAL - ${EXTERNALS_PUGIXML_PATH}/pugixml.cpp) - source_group( OSCTypeDefs FILES ${SRC_OSCTYPEDEFS}) source_group( "Source Files" FILES ${SRC_SOURCEFILES}) -source_group( - "External Libraries" - FILES ${SRC_ADDITIONAL}) # ############################### Creating library ################################################################### -add_library( - ${EXTERNAL_TARGET} - STATIC - ${SRC_ADDITIONAL}) - add_library( ${TARGET} STATIC @@ -68,7 +54,7 @@ add_library( target_link_libraries( ${TARGET} - PRIVATE project_options) + PRIVATE project_options pugixml) target_include_directories( ${TARGET} @@ -84,7 +70,6 @@ target_include_directories( PUBLIC ${ROAD_MANAGER_PATH} ${EXTERNALS_OSI_INCLUDES} ${EXTERNALS_SUMO_INCLUDES} - ${EXTERNALS_PUGIXML_PATH} ${EXTERNALS_EXPR_PATH}) target_link_libraries( -- 2.45.1