Skip to content

Commit

Permalink
CMake: add DART_USE_SYSTEM_PYBIND11 (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s authored Jan 21, 2025
1 parent a28f06b commit 940c425
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ dart_option(DART_FORCE_COLORED_OUTPUT
dart_option(DART_USE_SYSTEM_IMGUI "Use system ImGui" OFF)
dart_option(DART_USE_SYSTEM_GOOGLEBENCHMARK "Use system GoogleBenchmark" OFF)
dart_option(DART_USE_SYSTEM_GOOGLETEST "Use system GoogleTest" OFF)
dart_option(DART_USE_SYSTEM_PYBIND11 "Use system pybind11" OFF)

#===============================================================================
# Print intro
Expand Down
18 changes: 11 additions & 7 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ if(NOT DART_BUILD_DARTPY)
endif()

# Set up pybind11
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.12.0
)
FetchContent_MakeAvailable(pybind11)
if(DART_USE_SYSTEM_PYBIND11)
find_package(pybind11 CONFIG REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.12.0
)
FetchContent_MakeAvailable(pybind11)
endif()

if(NOT pybind11_FOUND)
message(WARNING "Disabling [dartpy] due to missing pybind11 >= 2.2.0.")
Expand Down

0 comments on commit 940c425

Please sign in to comment.