|
1 | | -if(CMAKE_VERSION VERSION_GREATER 4.11) |
| 1 | +find_package(pybind11 CONFIG QUIET) |
| 2 | +if(NOT TARGET pybind11::module) |
2 | 3 | include(FetchContent) |
3 | 4 | FetchContent_Declare( |
4 | 5 | pybind11 |
5 | 6 | GIT_REPOSITORY https://github.com/pybind/pybind11 |
6 | | - GIT_TAG v2.10.0) |
| 7 | + GIT_TAG v3.0.1) |
7 | 8 | FetchContent_GetProperties(pybind11) |
8 | 9 | if(NOT pybind11_POPULATED) |
9 | 10 | FetchContent_Populate(pybind11) |
10 | 11 | add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) |
| 12 | + endif() |
| 13 | +endif() |
11 | 14 |
|
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}) |
25 | 27 |
|
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() |
30 | 32 |
|
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) |
34 | 36 |
|
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