mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
[cmake] Search pybind11 if USE_SUPERBUILD=OFF
Also don't install the pybind headers without superbuild
This commit is contained in:
parent
c48084fd1c
commit
0257f416b2
@ -257,12 +257,20 @@ endif (USE_GUI)
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
if (USE_PYTHON)
|
if (USE_PYTHON)
|
||||||
add_definitions(-DNG_PYTHON)
|
add_definitions(-DNG_PYTHON)
|
||||||
|
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h HINTS ${PYTHON_INCLUDE_DIR})
|
||||||
|
if( PYBIND_INCLUDE_DIR )
|
||||||
|
message(STATUS "Found Pybind11: ${PYBIND_INCLUDE_DIR}")
|
||||||
|
else( PYBIND_INCLUDE_DIR )
|
||||||
|
message(FATAL_ERROR "Could NOT find pybind11!")
|
||||||
|
endif( PYBIND_INCLUDE_DIR )
|
||||||
|
|
||||||
include_directories(${PYBIND_INCLUDE_DIR})
|
include_directories(${PYBIND_INCLUDE_DIR})
|
||||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||||
|
|
||||||
install(DIRECTORY ${PYBIND_INCLUDE_DIR}/pybind11 DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)
|
if(NG_INSTALL_PYBIND)
|
||||||
install(FILES ${PYBIND_INCLUDE_DIR}/../LICENSE DESTINATION ${NG_INSTALL_DIR_INCLUDE}/pybind11 COMPONENT netgen_devel)
|
install(DIRECTORY ${PYBIND_INCLUDE_DIR}/pybind11 DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)
|
||||||
|
install(FILES ${PYBIND_INCLUDE_DIR}/../LICENSE DESTINATION ${NG_INSTALL_DIR_INCLUDE}/pybind11 COMPONENT netgen_devel)
|
||||||
|
endif(NG_INSTALL_PYBIND)
|
||||||
endif (USE_PYTHON)
|
endif (USE_PYTHON)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
@ -51,10 +51,11 @@ endif(NOT WIN32)
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
if (USE_PYTHON)
|
if (USE_PYTHON)
|
||||||
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include NO_DEFAULT_PATH)
|
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include NO_DEFAULT_PATH)
|
||||||
|
set(NG_INSTALL_PYBIND ON)
|
||||||
if( NOT PYBIND_INCLUDE_DIR )
|
if( NOT PYBIND_INCLUDE_DIR )
|
||||||
# if the pybind submodule is missing, try to initialize and update all submodules
|
# if the pybind submodule is missing, try to initialize and update all submodules
|
||||||
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include)
|
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include NO_DEFAULT_PATH)
|
||||||
endif( NOT PYBIND_INCLUDE_DIR )
|
endif( NOT PYBIND_INCLUDE_DIR )
|
||||||
if( PYBIND_INCLUDE_DIR )
|
if( PYBIND_INCLUDE_DIR )
|
||||||
message("-- Found Pybind11: ${PYBIND_INCLUDE_DIR}")
|
message("-- Found Pybind11: ${PYBIND_INCLUDE_DIR}")
|
||||||
@ -64,7 +65,14 @@ if (USE_PYTHON)
|
|||||||
find_package(PythonInterp 3 REQUIRED)
|
find_package(PythonInterp 3 REQUIRED)
|
||||||
find_package(PythonLibs 3 REQUIRED)
|
find_package(PythonLibs 3 REQUIRED)
|
||||||
|
|
||||||
set_vars(NETGEN_CMAKE_ARGS PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_EXECUTABLE PYTHON_VERSION PYBIND_INCLUDE_DIR)
|
set_vars(NETGEN_CMAKE_ARGS
|
||||||
|
PYTHON_INCLUDE_DIRS
|
||||||
|
PYTHON_LIBRARIES
|
||||||
|
PYTHON_EXECUTABLE
|
||||||
|
PYTHON_VERSION
|
||||||
|
PYBIND_INCLUDE_DIR
|
||||||
|
NG_INSTALL_PYBIND
|
||||||
|
)
|
||||||
endif (USE_PYTHON)
|
endif (USE_PYTHON)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user