Skip to content

Commit 6f46876

Browse files
authored
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 <scpeters@openrobotics.org>
1 parent 4c34f4e commit 6f46876

File tree

29 files changed

+47
-81
lines changed

29 files changed

+47
-81
lines changed

.github/workflows/ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,19 @@ jobs:
3434
codecov-enabled: true
3535
cppcheck-enabled: true
3636
cpplint-enabled: true
37+
noble-ci:
38+
runs-on: ubuntu-latest
39+
name: Ubuntu Noble CI
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
- uses: actions/setup-python@v3
44+
- uses: pre-commit/action@v3.0.0
45+
with:
46+
extra_args: --all-files
47+
- name: Compile and test
48+
id: ci
49+
uses: gazebo-tooling/action-gz-ci@noble
50+
with:
51+
# per bug https://github.com/gazebosim/gz-sim/issues/1409
52+
cmake-args: '-DBUILD_DOCS=OFF'

CMakeLists.txt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
#============================================================================
44
# Initialize the project
@@ -65,9 +65,6 @@ cmake_dependent_option(USE_DIST_PACKAGES_FOR_PYTHON
6565
# Search for project-specific dependencies
6666
#============================================================================
6767

68-
# Setting this policy enables using the protobuf_MODULE_COMPATIBLE
69-
# set command in CMake versions older than 13.13
70-
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
7168
# This option is needed to use the PROTOBUF_GENERATE_CPP
7269
# in case protobuf is found with the CMake config files
7370
# It needs to be set before any find_package(...) call

examples/plugin/command_actor/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
find_package(gz-cmake4 REQUIRED)
44

examples/plugin/custom_component/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
find_package(gz-cmake4 REQUIRED)
44

examples/plugin/custom_sensor_system/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
find_package(gz-cmake4 REQUIRED)
44

examples/plugin/gui_system_plugin/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
if(POLICY CMP0100)
44
cmake_policy(SET CMP0100 NEW)

examples/plugin/hello_world/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
find_package(gz-cmake4 REQUIRED)
44

examples/plugin/rendering_plugins/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
if(POLICY CMP0100)
44
cmake_policy(SET CMP0100 NEW)

examples/plugin/reset_plugin/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(ResetPlugins)
44

examples/plugin/system_plugin/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
find_package(gz-cmake4 REQUIRED)
44

examples/standalone/acoustic_comms_demo/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-acoustic-comms-demo)
44

examples/standalone/comms/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-comms)
44

examples/standalone/custom_server/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-custom-server)
44

examples/standalone/each_performance/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-each-performance)
44

examples/standalone/entity_creation/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-entity-creation)
44

examples/standalone/external_ecm/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-external-ecm)
44

examples/standalone/gtest_setup/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(GTestSetup)
44

examples/standalone/joy_to_twist/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-joy-to-twist)
44

examples/standalone/joystick/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22
# joystick currently works only on linux
33

44
project(gz-sim-joystick)

examples/standalone/keyboard/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-keyboard)
44

examples/standalone/light_control/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-light-control)
44

examples/standalone/lrauv_control/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-lrauv-control)
44

examples/standalone/marker/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-marker)
44

examples/standalone/multi_lrauv_race/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-multi-lrauv-race)
44

examples/standalone/scene_requester/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
22

33
project(gz-sim-scene-requester)
44

python/CMakeLists.txt

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
1-
if(WIN32 AND CMAKE_BUILD_TYPE STREQUAL "Debug")
2-
# pybind11 logic for setting up a debug build when both a debug and release
3-
# python interpreter are present in the system seems to be pretty much broken.
4-
# This works around the issue.
5-
set(PYTHON_LIBRARIES "${PYTHON_DEBUG_LIBRARIES}")
6-
endif()
7-
8-
91
if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
10-
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
11-
execute_process(
12-
COMMAND "${PYTHON_EXECUTABLE}" -c "if True:
13-
from distutils import sysconfig as sc
14-
print(sc.get_python_lib(plat_specific=True))"
15-
OUTPUT_VARIABLE Python3_SITEARCH
16-
OUTPUT_STRIP_TRAILING_WHITESPACE)
17-
else()
18-
# Get install variable from Python3 module
19-
# Python3_SITEARCH is available from 3.12 on, workaround if needed:
2+
if(NOT Python3_SITEARCH)
3+
# Get variable from Python3 module
204
find_package(Python3 COMPONENTS Interpreter)
215
endif()
226

@@ -31,7 +15,6 @@ else()
3115
set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python)
3216
endif()
3317

34-
set(GZ_PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
3518
set(GZ_PYTHON_INSTALL_PATH "${GZ_PYTHON_INSTALL_PATH}/gz")
3619

3720
# Set the build location and install location for a CPython extension
@@ -101,7 +84,7 @@ if (BUILD_TESTING)
10184
world_TEST
10285
)
10386

104-
execute_process(COMMAND "${GZ_PYTHON_EXECUTABLE}" -m pytest --version
87+
execute_process(COMMAND "${Python3_EXECUTABLE}" -m pytest --version
10588
OUTPUT_VARIABLE PYTEST_output
10689
ERROR_VARIABLE PYTEST_error
10790
RESULT_VARIABLE PYTEST_result)
@@ -115,10 +98,10 @@ if (BUILD_TESTING)
11598
foreach (test ${python_tests})
11699
if (pytest_FOUND)
117100
add_test(NAME ${test} COMMAND
118-
"${GZ_PYTHON_EXECUTABLE}" -m pytest "${CMAKE_SOURCE_DIR}/python/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/UNIT_${test}.xml")
101+
"${Python3_EXECUTABLE}" -m pytest "${CMAKE_SOURCE_DIR}/python/test/${test}.py" --junitxml "${CMAKE_BINARY_DIR}/test_results/UNIT_${test}.xml")
119102
else()
120103
add_test(NAME ${test} COMMAND
121-
"${GZ_PYTHON_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py")
104+
"${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/python/test/${test}.py")
122105
endif()
123106

124107
set(_env_vars)

src/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,8 @@ foreach(CMD_TEST
306306
# and executables in a common CMAKE_RUNTIME_OUTPUT_DIRECTORY, so that the .dll are found
307307
# as they are in the same directory where the executable is loaded. For tests that are
308308
# launched via Ruby, this does not work, so we need to manually add CMAKE_RUNTIME_OUTPUT_DIRECTORY
309-
# to the PATH. This is done via the ENVIRONMENT_MODIFICATION that is only available
310-
# since CMake 3.22. However, if an older CMake is used another trick to install the libraries
311-
# beforehand
312-
if (WIN32 AND CMAKE_VERSION STRGREATER "3.22")
309+
# to the PATH. This is done via the ENVIRONMENT_MODIFICATION that was added in CMake 3.22.
310+
if (WIN32)
313311
set_tests_properties(${CMD_TEST} PROPERTIES
314312
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
315313
endif()

test/integration/examples_build.cc

-27
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,6 @@ struct ExampleEntry
5757
}
5858
};
5959

60-
//////////////////////////////////////////////////
61-
/// Filter examples that are known to not build or require
62-
/// specific configurations
63-
/// \param[in] _entry Example entry to check
64-
/// \return true if example entry should be built, false otherwise
65-
bool FilterEntry(const ExampleEntry &_entry)
66-
{
67-
math::SemanticVersion cmakeVersion{std::string(CMAKE_VERSION)};
68-
if (cmakeVersion < math::SemanticVersion(3, 11, 0) &&
69-
(_entry.base == "custom_sensor_system" ||
70-
_entry.base == "gtest_setup"))
71-
{
72-
gzdbg << "Skipping [" << _entry.base
73-
<< "] test, which requires CMake version "
74-
<< ">= 3.11.0. Currently using CMake "
75-
<< cmakeVersion
76-
<< std::endl;
77-
return false;
78-
}
79-
return true;
80-
}
81-
8260
//////////////////////////////////////////////////
8361
/// Generate a list of examples to be built.
8462
std::vector<ExampleEntry> GetExamples()
@@ -116,11 +94,6 @@ void ExamplesBuild::Build(const ExampleEntry &_entry)
11694
{
11795
common::Console::SetVerbosity(4);
11896

119-
if (!FilterEntry(_entry))
120-
{
121-
GTEST_SKIP();
122-
}
123-
12497
// Path to examples of the given type
12598
ASSERT_TRUE(gz::common::exists(_entry.sourceDir));
12699

test/test_config.hh.in

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#define PROJECT_SOURCE_PATH "${PROJECT_SOURCE_DIR}"
2525
#define PROJECT_BINARY_PATH "${CMAKE_BINARY_DIR}"
26-
#define CMAKE_VERSION "${CMAKE_VERSION}"
2726

2827
#define GZ_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf"
2928

0 commit comments

Comments
 (0)