Commit 2f56bb4c authored by Markus Mirz's avatar Markus Mirz

add pybind cmake option

parent 781317ed
......@@ -95,15 +95,16 @@ find_package(OpenMP)
find_package(CUDA)
find_package(GSL)
find_package(Graphviz)
find_package(PythonInterp 3.6)
find_package(PythonLibs 3.6)
find_package(NumPy)
find_package(VILLASnode)
if(PythonInterp_FOUND AND PythonLibs_FOUND)
set(Python_FOUND ON)
if(NOT PYBIND)
find_package(PythonInterp 3.6)
find_package(PythonLibs 3.6)
find_package(NumPy)
if(PythonInterp_FOUND AND PythonLibs_FOUND)
set(Python_FOUND ON)
endif()
endif()
if("${CMAKE_SYSTEM}" MATCHES "Linux")
......@@ -182,8 +183,13 @@ if(BUILD_EXAMPLES)
endif(BUILD_EXAMPLES)
if(PYBIND)
if (WITH_PYBIND_SUBMODULE OR WIN32)
include(cmake/GetPybindSubmodule.cmake)
else()
find_package(pybind11)
endif()
set(PYBIND11_CPP_STANDARD -std=c++11)
add_subdirectory(Dependencies/pybind11)
pybind11_add_module(dpsimpy Source/pybind/main.cpp)
target_link_libraries(dpsimpy PRIVATE dpsim)
endif()
......
# Build pybind from github repository
include(FetchContent)
FetchContent_Declare(
pybind-submodule
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.5
)
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
FetchContent_GetProperties(pybind-submodule)
if(NOT pybind-submodule_POPULATED)
FetchContent_Populate(pybind-submodule)
add_subdirectory(${pybind-submodule_SOURCE_DIR} ${pybind-submodule_BINARY_DIR})
endif()
else()
FetchContent_MakeAvailable(pybind-submodule)
endif()
FetchContent_GetProperties(pybind-submodule)
message(STATUS "Path to pybind-submodule: " ${pybind-submodule_SOURCE_DIR})
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment