cmake(python): Add pybind11 dependency
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
# ##############################################################################
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user