diff --git a/CMakeLists.txt b/CMakeLists.txt index b7d2a92973..1afccfd8e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/dependencies/CMakeLists.txt b/cmake/dependencies/CMakeLists.txt index e50bced155..e22f6d03cf 100644 --- a/cmake/dependencies/CMakeLists.txt +++ b/cmake/dependencies/CMakeLists.txt @@ -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 # ############################################################################## diff --git a/cmake/deps.cmake b/cmake/deps.cmake index d71fb18cd0..3507928262 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -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() +