-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists_pybind11.txt
87 lines (73 loc) · 2.56 KB
/
CMakeLists_pybind11.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Cmake config for NanoShaper for Python
project(NanoShaper)
cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
cmake_policy(VERSION 2.8.4)
else()
cmake_policy(VERSION 2.6)
endif()
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists_git.txt)
SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(JSON_BuildTests OFF CACHE INTERNAL "")
find_package(CGAL REQUIRED)
find_package(Boost REQUIRED COMPONENTS thread)
if (Boost_FOUND)
link_directories ( ${Boost_LIBRARY_DIRS} )
link_libraries(${Boost_LIBRARIES})
include_directories ( ${Boost_INCLUDE_DIRS} )
include_directories (BEFORE include)
add_definitions(-DENABLE_BOOST_THREADS)
else (Boost_FOUND)
message(STATUS "Boost libs not found, Multithreading will be disabled")
endif (Boost_FOUND)
SET(Python_FIND_STRATEGY LOCATION)
find_package(Python 3.9 COMPONENTS Interpreter Development.Module REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
add_definitions(-DPYTHON)
message(STATUS "Using python ${Python_EXECUTABLE} ${Python_INCLUDE_DIRS} ${Python_LIBRARY_DIRS} ${Python_LIBRARIES} ${pybind11_INCLUDE_DIRS} ${pybind11_LIBRARIES}")
include_directories (BEFORE include)
include_directories(src)
include_directories(src/ConfigFile)
include_directories(src/jama)
include_directories(src/tnt)
include_directories(src/sturm)
include_directories(src/octree)
include_directories(${Python_INCLUDE_DIRS})
link_directories(${Python_LIBRARY_DIRS})
link_libraries(${Python_LIBRARIES})
include_directories(${pybind11_INCLUDE_DIRS})
link_libraries(${pybind11_LIBRARIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include( ${CGAL_USE_FILE} )
add_subdirectory(lib/spdlog)
add_definitions(-DSPDLOG)
add_subdirectory(lib/json)
add_definitions(-DENABLE_CGAL)
add_definitions(-DENABLE_BOOST_THREADS)
file(GLOB SRC
"./src/*.h"
"./src/*.cpp")
list(FILTER SRC EXCLUDE REGEX ".*main\\.cpp$")
add_library(NanoShaper MODULE
./src/python/nanoshaper_pybind.cpp
./src/main_functions.h
./src/sturm/sturm.cpp
./src/sturm/util.cpp
./src/sturm/solve.h
${SRC}
./src/ply/ply.cpp
./src/ply/ply.h
./src/ConfigFile/ConfigFile.cpp
./src/ConfigFile/ConfigFile.h
./src/octree/octree.h
)
target_link_options(NanoShaper PUBLIC -undefined dynamic_lookup)
target_link_libraries(NanoShaper
PRIVATE pybind11::headers
PRIVATE spdlog::spdlog_header_only
PRIVATE nlohmann_json::nlohmann_json
)
pybind11_extension(NanoShaper)
message(STATUS "C++ Release flags ${CMAKE_CXX_FLAGS_RELEASE}")