From 6f4687627b905a1562c7710045898a8cde4dac9d Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 31 May 2024 21:08:40 -0700 Subject: [PATCH] Enable 24.04 CI, require cmake 3.22.1 (#2420) * Part of gazebosim/gz-cmake#350. * Remove old cmake code * Use Python3_EXECUTABLE, not GZ_PYTHON_EXECUTABLE * Remove logic for skipping tests with old cmake Signed-off-by: Steve Peters --- .github/workflows/ci.yml | 16 +++++++++++ CMakeLists.txt | 5 +--- examples/plugin/command_actor/CMakeLists.txt | 2 +- .../plugin/custom_component/CMakeLists.txt | 2 +- .../custom_sensor_system/CMakeLists.txt | 2 +- .../plugin/gui_system_plugin/CMakeLists.txt | 2 +- examples/plugin/hello_world/CMakeLists.txt | 2 +- .../plugin/rendering_plugins/CMakeLists.txt | 2 +- examples/plugin/reset_plugin/CMakeLists.txt | 2 +- examples/plugin/system_plugin/CMakeLists.txt | 2 +- .../acoustic_comms_demo/CMakeLists.txt | 2 +- examples/standalone/comms/CMakeLists.txt | 2 +- .../standalone/custom_server/CMakeLists.txt | 2 +- .../each_performance/CMakeLists.txt | 2 +- .../standalone/entity_creation/CMakeLists.txt | 2 +- .../standalone/external_ecm/CMakeLists.txt | 2 +- .../standalone/gtest_setup/CMakeLists.txt | 2 +- .../standalone/joy_to_twist/CMakeLists.txt | 2 +- examples/standalone/joystick/CMakeLists.txt | 2 +- examples/standalone/keyboard/CMakeLists.txt | 2 +- .../standalone/light_control/CMakeLists.txt | 2 +- .../standalone/lrauv_control/CMakeLists.txt | 2 +- examples/standalone/marker/CMakeLists.txt | 2 +- .../multi_lrauv_race/CMakeLists.txt | 2 +- .../standalone/scene_requester/CMakeLists.txt | 2 +- python/CMakeLists.txt | 27 ++++--------------- src/CMakeLists.txt | 6 ++--- test/integration/examples_build.cc | 27 ------------------- test/test_config.hh.in | 1 - 29 files changed, 47 insertions(+), 81 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f46c5e8ac..f11e11f8c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,3 +34,19 @@ jobs: codecov-enabled: true cppcheck-enabled: true cpplint-enabled: true + noble-ci: + runs-on: ubuntu-latest + name: Ubuntu Noble CI + steps: + - name: Checkout + uses: actions/checkout@v4 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 + with: + extra_args: --all-files + - name: Compile and test + id: ci + uses: gazebo-tooling/action-gz-ci@noble + with: + # per bug https://github.com/gazebosim/gz-sim/issues/1409 + cmake-args: '-DBUILD_DOCS=OFF' diff --git a/CMakeLists.txt b/CMakeLists.txt index 375fea97c9..62f2af55b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) #============================================================================ # Initialize the project @@ -65,9 +65,6 @@ cmake_dependent_option(USE_DIST_PACKAGES_FOR_PYTHON # Search for project-specific dependencies #============================================================================ -# Setting this policy enables using the protobuf_MODULE_COMPATIBLE -# set command in CMake versions older than 13.13 -set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) # This option is needed to use the PROTOBUF_GENERATE_CPP # in case protobuf is found with the CMake config files # It needs to be set before any find_package(...) call diff --git a/examples/plugin/command_actor/CMakeLists.txt b/examples/plugin/command_actor/CMakeLists.txt index 23fba669eb..be6f6918ff 100644 --- a/examples/plugin/command_actor/CMakeLists.txt +++ b/examples/plugin/command_actor/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) find_package(gz-cmake4 REQUIRED) diff --git a/examples/plugin/custom_component/CMakeLists.txt b/examples/plugin/custom_component/CMakeLists.txt index a1e8a8dc50..7e2c0b1478 100644 --- a/examples/plugin/custom_component/CMakeLists.txt +++ b/examples/plugin/custom_component/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) find_package(gz-cmake4 REQUIRED) diff --git a/examples/plugin/custom_sensor_system/CMakeLists.txt b/examples/plugin/custom_sensor_system/CMakeLists.txt index d7e8c722a0..47e398c64d 100644 --- a/examples/plugin/custom_sensor_system/CMakeLists.txt +++ b/examples/plugin/custom_sensor_system/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) find_package(gz-cmake4 REQUIRED) diff --git a/examples/plugin/gui_system_plugin/CMakeLists.txt b/examples/plugin/gui_system_plugin/CMakeLists.txt index 53ba9dc4ce..d2da6a83d9 100644 --- a/examples/plugin/gui_system_plugin/CMakeLists.txt +++ b/examples/plugin/gui_system_plugin/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) if(POLICY CMP0100) cmake_policy(SET CMP0100 NEW) diff --git a/examples/plugin/hello_world/CMakeLists.txt b/examples/plugin/hello_world/CMakeLists.txt index 488050665e..d1a6adc2fd 100644 --- a/examples/plugin/hello_world/CMakeLists.txt +++ b/examples/plugin/hello_world/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) find_package(gz-cmake4 REQUIRED) diff --git a/examples/plugin/rendering_plugins/CMakeLists.txt b/examples/plugin/rendering_plugins/CMakeLists.txt index f8c8bd14b8..983cd746a1 100644 --- a/examples/plugin/rendering_plugins/CMakeLists.txt +++ b/examples/plugin/rendering_plugins/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) if(POLICY CMP0100) cmake_policy(SET CMP0100 NEW) diff --git a/examples/plugin/reset_plugin/CMakeLists.txt b/examples/plugin/reset_plugin/CMakeLists.txt index 3fb659aed3..3a9e97329a 100644 --- a/examples/plugin/reset_plugin/CMakeLists.txt +++ b/examples/plugin/reset_plugin/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(ResetPlugins) diff --git a/examples/plugin/system_plugin/CMakeLists.txt b/examples/plugin/system_plugin/CMakeLists.txt index 08be7e0d48..1a651f6bca 100644 --- a/examples/plugin/system_plugin/CMakeLists.txt +++ b/examples/plugin/system_plugin/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) find_package(gz-cmake4 REQUIRED) diff --git a/examples/standalone/acoustic_comms_demo/CMakeLists.txt b/examples/standalone/acoustic_comms_demo/CMakeLists.txt index 7e6f6582cd..73a7dddde9 100644 --- a/examples/standalone/acoustic_comms_demo/CMakeLists.txt +++ b/examples/standalone/acoustic_comms_demo/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-acoustic-comms-demo) diff --git a/examples/standalone/comms/CMakeLists.txt b/examples/standalone/comms/CMakeLists.txt index f909bbbeea..a1c6e7c55b 100644 --- a/examples/standalone/comms/CMakeLists.txt +++ b/examples/standalone/comms/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-comms) diff --git a/examples/standalone/custom_server/CMakeLists.txt b/examples/standalone/custom_server/CMakeLists.txt index 0b29df1802..2fbbc64fdb 100644 --- a/examples/standalone/custom_server/CMakeLists.txt +++ b/examples/standalone/custom_server/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-custom-server) diff --git a/examples/standalone/each_performance/CMakeLists.txt b/examples/standalone/each_performance/CMakeLists.txt index fbcbf246df..98b94029eb 100644 --- a/examples/standalone/each_performance/CMakeLists.txt +++ b/examples/standalone/each_performance/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-each-performance) diff --git a/examples/standalone/entity_creation/CMakeLists.txt b/examples/standalone/entity_creation/CMakeLists.txt index 29efcc96df..445f7eab69 100644 --- a/examples/standalone/entity_creation/CMakeLists.txt +++ b/examples/standalone/entity_creation/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-entity-creation) diff --git a/examples/standalone/external_ecm/CMakeLists.txt b/examples/standalone/external_ecm/CMakeLists.txt index 6dc89463d7..24f8d78594 100644 --- a/examples/standalone/external_ecm/CMakeLists.txt +++ b/examples/standalone/external_ecm/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-external-ecm) diff --git a/examples/standalone/gtest_setup/CMakeLists.txt b/examples/standalone/gtest_setup/CMakeLists.txt index eb08a179a2..99a24e3fb7 100644 --- a/examples/standalone/gtest_setup/CMakeLists.txt +++ b/examples/standalone/gtest_setup/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(GTestSetup) diff --git a/examples/standalone/joy_to_twist/CMakeLists.txt b/examples/standalone/joy_to_twist/CMakeLists.txt index 4f77908aa1..c2ea401431 100644 --- a/examples/standalone/joy_to_twist/CMakeLists.txt +++ b/examples/standalone/joy_to_twist/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-joy-to-twist) diff --git a/examples/standalone/joystick/CMakeLists.txt b/examples/standalone/joystick/CMakeLists.txt index 6168fdef1f..2a066a8e89 100644 --- a/examples/standalone/joystick/CMakeLists.txt +++ b/examples/standalone/joystick/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) # joystick currently works only on linux project(gz-sim-joystick) diff --git a/examples/standalone/keyboard/CMakeLists.txt b/examples/standalone/keyboard/CMakeLists.txt index 7f5f25c3d5..9d96cb7ef4 100644 --- a/examples/standalone/keyboard/CMakeLists.txt +++ b/examples/standalone/keyboard/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-keyboard) diff --git a/examples/standalone/light_control/CMakeLists.txt b/examples/standalone/light_control/CMakeLists.txt index 9464d76bdf..9f3ee16e4c 100644 --- a/examples/standalone/light_control/CMakeLists.txt +++ b/examples/standalone/light_control/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-light-control) diff --git a/examples/standalone/lrauv_control/CMakeLists.txt b/examples/standalone/lrauv_control/CMakeLists.txt index e55e371d8d..6c075de8dd 100644 --- a/examples/standalone/lrauv_control/CMakeLists.txt +++ b/examples/standalone/lrauv_control/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-lrauv-control) diff --git a/examples/standalone/marker/CMakeLists.txt b/examples/standalone/marker/CMakeLists.txt index 29a590bae9..f3bd3b655b 100644 --- a/examples/standalone/marker/CMakeLists.txt +++ b/examples/standalone/marker/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-marker) diff --git a/examples/standalone/multi_lrauv_race/CMakeLists.txt b/examples/standalone/multi_lrauv_race/CMakeLists.txt index d80e811934..69049f2ad0 100644 --- a/examples/standalone/multi_lrauv_race/CMakeLists.txt +++ b/examples/standalone/multi_lrauv_race/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-multi-lrauv-race) diff --git a/examples/standalone/scene_requester/CMakeLists.txt b/examples/standalone/scene_requester/CMakeLists.txt index 542f3a9491..049877d3db 100644 --- a/examples/standalone/scene_requester/CMakeLists.txt +++ b/examples/standalone/scene_requester/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR) project(gz-sim-scene-requester) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 3069e98752..98bbe66650 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,22 +1,6 @@ -if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug") - # pybind11 logic for setting up a debug build when both a debug and release - # python interpreter are present in the system seems to be pretty much broken. - # This works around the issue. - set(PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES}") -endif() - - if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION) - if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - execute_process( - COMMAND "${PYTHON_EXECUTABLE}" -c "if True: - from distutils import sysconfig as sc - print(sc.get_python_lib(plat_specific=True))" - OUTPUT_VARIABLE Python3_SITEARCH - OUTPUT_STRIP_TRAILING_WHITESPACE) - else() - # Get install variable from Python3 module - # Python3_SITEARCH is available from 3.12 on, workaround if needed: + if(NOT Python3_SITEARCH) + # Get variable from Python3 module find_package(Python3 COMPONENTS Interpreter) endif() @@ -31,7 +15,6 @@ else() set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python) endif() -set(GZ_PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) set(GZ_PYTHON_INSTALL_PATH "${GZ_PYTHON_INSTALL_PATH}/gz") # Set the build location and install location for a CPython extension @@ -101,7 +84,7 @@ if (BUILD_TESTING) world_TEST ) - execute_process(COMMAND "${GZ_PYTHON_EXECUTABLE}" -m pytest --version + execute_process(COMMAND "${Python3_EXECUTABLE}" -m pytest --version OUTPUT_VARIABLE PYTEST_output ERROR_VARIABLE PYTEST_error RESULT_VARIABLE PYTEST_result) @@ -115,10 +98,10 @@ if (BUILD_TESTING) foreach (test ${python_tests}) if (pytest_FOUND) add_test(NAME ${test} COMMAND - "${GZ_PYTHON_EXECUTABLE}" -m pytest "${CMAKE_SOURCE_DIR}/python/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/UNIT_${test}.xml") + "${Python3_EXECUTABLE}" -m pytest "${CMAKE_SOURCE_DIR}/python/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/UNIT_${test}.xml") else() add_test(NAME ${test} COMMAND - "${GZ_PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py") + "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py") endif() set(_env_vars) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f0aaf946a..d4a5589b19 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -306,10 +306,8 @@ foreach(CMD_TEST # and executables in a common CMAKE_RUNTIME_OUTPUT_DIRECTORY, so that the .dll are found # as they are in the same directory where the executable is loaded. For tests that are # launched via Ruby, this does not work, so we need to manually add CMAKE_RUNTIME_OUTPUT_DIRECTORY - # to the PATH. This is done via the ENVIRONMENT_MODIFICATION that is only available - # since CMake 3.22. However, if an older CMake is used another trick to install the libraries - # beforehand - if (WIN32 AND CMAKE_VERSION STRGREATER "3.22") + # to the PATH. This is done via the ENVIRONMENT_MODIFICATION that was added in CMake 3.22. + if (WIN32) set_tests_properties(${CMD_TEST} PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") endif() diff --git a/test/integration/examples_build.cc b/test/integration/examples_build.cc index 51cb4ec84a..4b20a80f84 100644 --- a/test/integration/examples_build.cc +++ b/test/integration/examples_build.cc @@ -57,28 +57,6 @@ struct ExampleEntry } }; -////////////////////////////////////////////////// -/// Filter examples that are known to not build or require -/// specific configurations -/// \param[in] _entry Example entry to check -/// \return true if example entry should be built, false otherwise -bool FilterEntry(const ExampleEntry &_entry) -{ - math::SemanticVersion cmakeVersion{std::string(CMAKE_VERSION)}; - if (cmakeVersion < math::SemanticVersion(3, 11, 0) && - (_entry.base == "custom_sensor_system" || - _entry.base == "gtest_setup")) - { - gzdbg << "Skipping [" << _entry.base - << "] test, which requires CMake version " - << ">= 3.11.0. Currently using CMake " - << cmakeVersion - << std::endl; - return false; - } - return true; -} - ////////////////////////////////////////////////// /// Generate a list of examples to be built. std::vector GetExamples() @@ -116,11 +94,6 @@ void ExamplesBuild::Build(const ExampleEntry &_entry) { common::Console::SetVerbosity(4); - if (!FilterEntry(_entry)) - { - GTEST_SKIP(); - } - // Path to examples of the given type ASSERT_TRUE(gz::common::exists(_entry.sourceDir)); diff --git a/test/test_config.hh.in b/test/test_config.hh.in index 4681208058..b367ed89de 100644 --- a/test/test_config.hh.in +++ b/test/test_config.hh.in @@ -23,7 +23,6 @@ #define PROJECT_SOURCE_PATH "${PROJECT_SOURCE_DIR}" #define PROJECT_BINARY_PATH "${CMAKE_BINARY_DIR}" -#define CMAKE_VERSION "${CMAKE_VERSION}" #define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf"