Skip to content

Commit

Permalink
Enable 24.04 CI, require cmake 3.22.1 (#2420)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
scpeters authored Jun 1, 2024
1 parent 4c34f4e commit 6f46876
Show file tree
Hide file tree
Showing 29 changed files with 47 additions and 81 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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'
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/command_actor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/custom_component/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/custom_sensor_system/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/gui_system_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/rendering_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/reset_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)

project(ResetPlugins)

Expand Down
2 changes: 1 addition & 1 deletion examples/plugin/system_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/acoustic_comms_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/comms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/custom_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/each_performance/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/entity_creation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/external_ecm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/gtest_setup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)

project(GTestSetup)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/joy_to_twist/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/joystick/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/keyboard/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/light_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/lrauv_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/marker/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/multi_lrauv_race/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/standalone/scene_requester/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
27 changes: 5 additions & 22 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
27 changes: 0 additions & 27 deletions test/integration/examples_build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<ExampleEntry> GetExamples()
Expand Down Expand Up @@ -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));

Expand Down
1 change: 0 additions & 1 deletion test/test_config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 6f46876

Please sign in to comment.