Skip to content

Commit 2a7eebc

Browse files
authored
Merge pull request #2790 from nim65s/cmake
CMake: updates for CMake >= 3.22
2 parents 0b10a13 + 62bb855 commit 2a7eebc

File tree

9 files changed

+34
-44
lines changed

9 files changed

+34
-44
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1313
- Homogenize python viewers examples ([#2771](https://github.com/stack-of-tasks/pinocchio/pull/2771))
1414
- Add docker images ([#2776](https://github.com/stack-of-tasks/pinocchio/pull/2776))
1515
- ROS: added jrl_cmakemodules dependency ([#2789](https://github.com/stack-of-tasks/pinocchio/pull/2789))
16+
- Removed CMake < 3.22 details ([#2790](https://github.com/stack-of-tasks/pinocchio/pull/2790))
1617

1718
## [3.8.0] - 2025-09-17
1819

CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,10 @@ include("${JRL_CMAKE_MODULES}/python.cmake")
8686
include("${JRL_CMAKE_MODULES}/boost.cmake")
8787
include("${JRL_CMAKE_MODULES}/ide.cmake")
8888
include("${JRL_CMAKE_MODULES}/apple.cmake")
89-
if(APPLE) # Use the handmade approach
90-
if(${CMAKE_VERSION} VERSION_LESS "3.18.0") # Need to find the right version
91-
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/OpenMP ${CMAKE_MODULE_PATH})
92-
endif()
93-
elseif(UNIX)
94-
if(${CMAKE_VERSION} VERSION_EQUAL "3.20.0")
95-
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/OpenMP ${CMAKE_MODULE_PATH})
96-
endif()
97-
endif()
9889
include(CMakeDependentOption)
9990

10091
# If needed, set CMake policy for APPLE systems
10192
apply_default_apple_configuration()
102-
if(CMAKE_VERSION VERSION_GREATER "3.12")
103-
cmake_policy(SET CMP0074 NEW)
104-
endif()
10593

10694
# Force C++ standard to be C++11 at least
10795
check_minimal_cxx_standard(11 ENFORCE)

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
default = self'.packages.pinocchio;
3333
pinocchio = pkgs.python3Packages.pinocchio.overrideAttrs (super: {
3434
propagatedBuildInputs = super.propagatedBuildInputs ++ [ pkgs.example-robot-data ];
35+
nativeCheckInputs = [ pkgs.python3Packages.pybind11 ];
3536
src = pkgs.lib.fileset.toSource {
3637
root = ./.;
3738
fileset = pkgs.lib.fileset.unions [
@@ -78,6 +79,7 @@
7879
pkgs.example-robot-data
7980
self'.packages.libpinocchio
8081
];
82+
nativeCheckInputs = [ pkgs.python3Packages.pybind11 ];
8183
src = pkgs.lib.fileset.toSource {
8284
root = ./.;
8385
fileset = pkgs.lib.fileset.unions [

unittest/packaging/cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44

unittest/packaging/external/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.11)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44

unittest/packaging/pinocchio_header/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44
find_package(pinocchio REQUIRED)

unittest/packaging/pkgconfig/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.22)
22

33
project(ExtraLib CXX)
44
find_package(PkgConfig REQUIRED)

unittest/python/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,5 @@ endif()
164164
if(NOT WIN32)
165165
pinocchio_add_python_cpp_module(bindings_visualizer PIN_TARGETS pinocchio::pinocchio_visualizers)
166166
pinocchio_add_lib_unit_test(bindings_visualizer)
167+
add_subdirectory(pybind11)
167168
endif()
168-
169-
add_subdirectory(pybind11)
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
if(CMAKE_VERSION VERSION_GREATER 4.11)
1+
find_package(pybind11 CONFIG QUIET)
2+
if(NOT TARGET pybind11::module)
23
include(FetchContent)
34
FetchContent_Declare(
45
pybind11
56
GIT_REPOSITORY https://github.com/pybind/pybind11
6-
GIT_TAG v2.10.0)
7+
GIT_TAG v3.0.1)
78
FetchContent_GetProperties(pybind11)
89
if(NOT pybind11_POPULATED)
910
FetchContent_Populate(pybind11)
1011
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
12+
endif()
13+
endif()
1114

12-
# pybind11_add_module(cpp2pybind11 cpp2pybind11.cpp)
13-
#
14-
# BUG: might not work out of the box on OSX with conda:
15-
# https://github.com/pybind/pybind11/issues/3081
16-
if(NOT BUILD_TESTING)
17-
add_library(cpp2pybind11 MODULE EXCLUDE_FROM_ALL cpp2pybind11.cpp)
18-
else()
19-
add_library(cpp2pybind11 MODULE cpp2pybind11.cpp)
20-
endif()
21-
add_dependencies(build_tests cpp2pybind11)
22-
target_link_libraries(cpp2pybind11 PRIVATE pinocchio_pywrap_default pybind11::module)
23-
target_include_directories(cpp2pybind11 SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
24-
set_target_properties(cpp2pybind11 PROPERTIES PREFIX "" SUFFIX ${PYTHON_EXT_SUFFIX})
15+
# pybind11_add_module(cpp2pybind11 cpp2pybind11.cpp)
16+
#
17+
# BUG: might not work out of the box on OSX with conda:
18+
# https://github.com/pybind/pybind11/issues/3081
19+
if(NOT BUILD_TESTING)
20+
add_library(cpp2pybind11 MODULE EXCLUDE_FROM_ALL cpp2pybind11.cpp)
21+
else()
22+
add_library(cpp2pybind11 MODULE cpp2pybind11.cpp)
23+
endif()
24+
add_dependencies(build_tests cpp2pybind11)
25+
target_link_libraries(cpp2pybind11 PRIVATE pinocchio_pywrap_default pybind11::module Eigen3::Eigen)
26+
set_target_properties(cpp2pybind11 PROPERTIES PREFIX "" SUFFIX ${PYTHON_EXT_SUFFIX})
2527

26-
if(CMAKE_CXX_STANDARD LESS 14)
27-
message(STATUS "CXX_STANDARD for cpp2pybind11 changed from ${CMAKE_CXX_STANDARD} to 14")
28-
set_target_properties(cpp2pybind11 PROPERTIES CXX_STANDARD 14)
29-
endif()
28+
if(CMAKE_CXX_STANDARD LESS 14)
29+
message(STATUS "CXX_STANDARD for cpp2pybind11 changed from ${CMAKE_CXX_STANDARD} to 14")
30+
set_target_properties(cpp2pybind11 PROPERTIES CXX_STANDARD 14)
31+
endif()
3032

31-
if(WIN32)
32-
target_compile_definitions(cpp2pybind11 PRIVATE -DNOMINMAX)
33-
endif(WIN32)
33+
if(WIN32)
34+
target_compile_definitions(cpp2pybind11 PRIVATE -DNOMINMAX)
35+
endif(WIN32)
3436

35-
add_python_unit_test("test-py-cpp2pybind11" "unittest/python/pybind11/test-cpp2pybind11.py"
36-
"bindings/python" "unittest/python/pybind11")
37-
endif()
38-
endif()
37+
add_python_unit_test("test-py-cpp2pybind11" "unittest/python/pybind11/test-cpp2pybind11.py"
38+
"bindings/python" "unittest/python/pybind11")

0 commit comments

Comments
 (0)