cmake(python): Add pybind11 dependency

This commit is contained in:
Corentin Le Molgat
2022-02-21 10:51:33 +01:00
parent 3d8e27e21a
commit 3dde655176
3 changed files with 30 additions and 0 deletions

View File

@@ -225,6 +225,9 @@ if(BUILD_JAVA)
endif()
if(BUILD_PYTHON)
option(BUILD_pybind11 "Build pybind11 library" ON)
message(STATUS "Build pybind11: ${BUILD_pybind11}")
option(FETCH_PYTHON_DEPS "Install python required modules if not available" ${BUILD_DEPS})
message(STATUS "Python fetch dependencies: ${FETCH_PYTHON_DEPS}")
endif()

View File

@@ -144,6 +144,25 @@ if(BUILD_Eigen3)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# pybind11
# ##############################################################################
if(BUILD_pybind11)
message(CHECK_START "Fetching pybind11")
list(APPEND CMAKE_MESSAGE_INDENT " ")
set(PYBIND11_INSTALL ON)
set(PYBIND11_TEST OFF)
FetchContent_Declare(
pybind11
GIT_REPOSITORY "https://github.com/pybind/pybind11.git"
GIT_TAG "v2.9.1"
#PATCH_COMMAND git apply --ignore-whitespace "${CMAKE_CURRENT_LIST_DIR}/../../patches/pybind11-2.9.1.patch"
)
FetchContent_MakeAvailable(pybind11)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
# ##############################################################################
# SCIP
# ##############################################################################

View File

@@ -118,3 +118,11 @@ endif()
if(USE_XPRESS)
find_package(XPRESS REQUIRED)
endif()
# Check language Dependencies
if(BUILD_PYTHON)
if(NOT BUILD_pybind11)
find_package(pybind11 REQUIRED)
endif()
endif()