From e55d298bf7f118dd39fc89e66994734540875f73 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 21 Nov 2023 16:38:08 +0000 Subject: [PATCH] chore: cmake_minimum_required 3.21 --- CMakeLists.txt | 2 +- conanfile.py | 10 ++--- lanelet2_core/CMakeLists.txt | 4 +- lanelet2_io/CMakeLists.txt | 9 ++-- lanelet2_maps/CMakeLists.txt | 2 +- lanelet2_matching/CMakeLists.txt | 12 ++--- lanelet2_projection/CMakeLists.txt | 10 +++-- lanelet2_python/CMakeLists.txt | 63 +++++---------------------- lanelet2_routing/CMakeLists.txt | 10 +++-- lanelet2_traffic_rules/CMakeLists.txt | 9 ++-- lanelet2_validation/CMakeLists.txt | 13 +++--- 11 files changed, 57 insertions(+), 87 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ca54015..8b535e2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.21) project(lanelet2) set(CMAKE_CXX_STANDARD 17) diff --git a/conanfile.py b/conanfile.py index 12b61ecd..9d48c739 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,18 +3,18 @@ class Lanelet2Conan(ConanFile): - name = "lanelet2" + name = "lanelet2x" version = "1.2.1" # Optional metadata license = "BSD" - url = "https://github.com/fzi-forschungszentrum-informatik/lanelet2" - description = "Map handling framework for automated driving" + url = "https://github.com/wu-vincent/lanelet2" + description = "Your favorite map handling framework for automated driving, now standalone and with cross-platform support." # Binary configuration settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + options = {"shared": [True, False], "fPIC": [True]} + default_options = {"shared": False, "fPIC": True} # "boost/*:shared": True proj_list = [ 'lanelet2_core', diff --git a/lanelet2_core/CMakeLists.txt b/lanelet2_core/CMakeLists.txt index d0f47ce9..86c4ea46 100644 --- a/lanelet2_core/CMakeLists.txt +++ b/lanelet2_core/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_core) ################### @@ -24,7 +24,7 @@ file(GLOB PROJECT_SOURCE_FILES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") # Declare a cpp library add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCE_FILES_SRC}) target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(${PROJECT_NAME} PUBLIC Boost::graph Eigen3::Eigen) +target_link_libraries(${PROJECT_NAME} PUBLIC Boost::headers Eigen3::Eigen) ############# ## Install ## diff --git a/lanelet2_io/CMakeLists.txt b/lanelet2_io/CMakeLists.txt index dc335b6f..5e975e53 100644 --- a/lanelet2_io/CMakeLists.txt +++ b/lanelet2_io/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_io) ################### @@ -47,8 +47,11 @@ if (LANELET2_ENABLE_TESTING) add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST}) target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME}) - add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + if (WIN32) + add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND_EXPAND_LISTS) + endif () gtest_discover_tests("${PROJECT_NAME}_test") add_dependencies("${PROJECT_NAME}_test" lanelet2_maps) diff --git a/lanelet2_maps/CMakeLists.txt b/lanelet2_maps/CMakeLists.txt index bbc2e22d..c43623e2 100644 --- a/lanelet2_maps/CMakeLists.txt +++ b/lanelet2_maps/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_maps) ########### diff --git a/lanelet2_matching/CMakeLists.txt b/lanelet2_matching/CMakeLists.txt index 2342e88d..d58b695e 100644 --- a/lanelet2_matching/CMakeLists.txt +++ b/lanelet2_matching/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_matching) ################### @@ -46,11 +46,11 @@ if (LANELET2_ENABLE_TESTING) add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST}) target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME}) - add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + if (WIN32) + add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND_EXPAND_LISTS) + endif () gtest_discover_tests("${PROJECT_NAME}_test") endif () \ No newline at end of file diff --git a/lanelet2_projection/CMakeLists.txt b/lanelet2_projection/CMakeLists.txt index 13096c06..a0498407 100644 --- a/lanelet2_projection/CMakeLists.txt +++ b/lanelet2_projection/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_projection) ################### @@ -47,9 +47,11 @@ if (LANELET2_ENABLE_TESTING) add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST}) target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME}) - add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + if (WIN32) + add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND_EXPAND_LISTS) + endif () gtest_discover_tests("${PROJECT_NAME}_test") endif () diff --git a/lanelet2_python/CMakeLists.txt b/lanelet2_python/CMakeLists.txt index 00e06d76..d29cbc64 100644 --- a/lanelet2_python/CMakeLists.txt +++ b/lanelet2_python/CMakeLists.txt @@ -1,69 +1,30 @@ -set(MRT_PKG_VERSION 4.0.0) -# Modify only if you know what you are doing! -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_python) ################### ## Find packages ## ################### -find_package(mrt_cmake_modules REQUIRED) -include(UseMrtStdCompilerFlags) -include(GatherDeps) - -# You can add a custom.cmake in order to add special handling for this package. E.g. you can do: -# list(REMOVE_ITEM DEPENDEND_PACKAGES ...) -# To remove libs which cannot be found automatically. You can also "find_package" other, custom dependencies there. -# You can also set PROJECT_INSTALL_FILES to install files that are not installed by default. -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake") - include("${CMAKE_CURRENT_SOURCE_DIR}/custom.cmake") -endif() - -find_package(AutoDeps REQUIRED COMPONENTS ${DEPENDEND_PACKAGES}) - -mrt_parse_package_xml() +find_package(Boost REQUIRED COMPONENTS python) +find_package(PythonLibs REQUIRED) ######################## -## Add python modules ## +## Build python modules ## ######################## -# This adds a python module if located under src/{PROJECT_NAME) -mrt_python_module_setup() - -mrt_glob_files(PROJECT_PYTHON_SOURCE_FILES_SRC "python_api/*.cpp") -if (PROJECT_PYTHON_SOURCE_FILES_SRC) - # Add a cpp-python api library. Make sure there are no name collisions with python modules in this project - mrt_add_python_api( lanelet2 - FILES ${PROJECT_PYTHON_SOURCE_FILES_SRC} - ) -endif() - -############################ -## Read source code files ## -############################ -mrt_glob_files_recurse(PROJECT_HEADER_FILES_INC "include/*.h" "include/*.hpp" "include/*.cuh") -mrt_glob_files(PROJECT_SOURCE_FILES_INC "src/*.h" "src/*.hpp" "src/*.cuh") -mrt_glob_files(PROJECT_SOURCE_FILES_SRC "src/*.cpp" "src/*.cu") - -########### -## Build ## -########### -# Declare a cpp library -mrt_add_library(${PROJECT_NAME} - INCLUDES ${PROJECT_HEADER_FILES_INC} ${PROJECT_SOURCE_FILES_INC} - SOURCES ${PROJECT_SOURCE_FILES_SRC} - ) +file(GLOB PROJECT_PYTHON_SOURCE_FILES_SRC "${CMAKE_SOURCE_DIR}/python_api/*.cpp") +foreach (PROJECT_PYTHON_SOURCE_FILE ${PROJECT_PYTHON_SOURCE_FILES_SRC}) + get_filename_component(PYTHON_MODULE_NAME ${PROJECT_PYTHON_SOURCE_FILE} NAME_WE) + add_library(${PYTHON_MODULE_NAME} SHARED ${PROJECT_PYTHON_SOURCE_FILE}) + target_include_directories(${PYTHON_MODULE_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") + set_target_properties(${PYTHON_MODULE_NAME} PROPERTIES PREFIX "") +endforeach () ############# ## Install ## ############# # Install all targets, headers by default and scripts and other files if specified (folders or files). -# This command also exports libraries and config files for dependent packages and this supersedes catkin_package. -mrt_install(PROGRAMS scripts FILES res data ${PROJECT_INSTALL_FILES}) + ############# ## Testing ## ############# # Add test targets for cpp and python tests -if (CATKIN_ENABLE_TESTING) - mrt_add_tests(test) - mrt_add_nosetests(test) -endif() diff --git a/lanelet2_routing/CMakeLists.txt b/lanelet2_routing/CMakeLists.txt index c9124c54..cf9c3ed9 100644 --- a/lanelet2_routing/CMakeLists.txt +++ b/lanelet2_routing/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_routing) ################### @@ -48,9 +48,11 @@ if (LANELET2_ENABLE_TESTING) add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST}) target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME}) - add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + if (WIN32) + add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND_EXPAND_LISTS) + endif () gtest_discover_tests("${PROJECT_NAME}_test") add_dependencies("${PROJECT_NAME}_test" lanelet2_maps) diff --git a/lanelet2_traffic_rules/CMakeLists.txt b/lanelet2_traffic_rules/CMakeLists.txt index 95875a8f..0eba4405 100644 --- a/lanelet2_traffic_rules/CMakeLists.txt +++ b/lanelet2_traffic_rules/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_traffic_rules) ################### @@ -45,8 +45,11 @@ if (LANELET2_ENABLE_TESTING) add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST}) target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME}) - add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + if (WIN32) + add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND_EXPAND_LISTS) + endif () gtest_discover_tests("${PROJECT_NAME}_test") endif () \ No newline at end of file diff --git a/lanelet2_validation/CMakeLists.txt b/lanelet2_validation/CMakeLists.txt index dc168ace..77f12cad 100644 --- a/lanelet2_validation/CMakeLists.txt +++ b/lanelet2_validation/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.21) project(lanelet2_validation) ################### @@ -68,12 +68,11 @@ if (LANELET2_ENABLE_TESTING) add_executable("${PROJECT_NAME}_test" ${PROJECT_SOURCE_FILES_TEST}) target_link_libraries("${PROJECT_NAME}_test" PRIVATE GTest::gtest_main ${PROJECT_NAME}) - add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" - COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$") + if (WIN32) + add_custom_command(TARGET "${PROJECT_NAME}_test" POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "$" "$" + COMMAND_EXPAND_LISTS) + endif () gtest_discover_tests("${PROJECT_NAME}_test") add_dependencies("${PROJECT_NAME}_test" lanelet2_maps)