-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
79 lines (61 loc) · 2.4 KB
/
CMakeLists.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
cmake_minimum_required(VERSION 3.10)
project(siqadtools)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14")
cmake_policy(SET CMP0086 NEW)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12")
cmake_policy(SET CMP0074 NEW)
endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
cmake_policy(SET CMP0078 NEW)
endif()
# install paths
if(SKBUILD)
set(SIQADCONN_SWIG_MODULE_DEST ${CMAKE_CURRENT_BINARY_DIR}/../cmake-install/siqadtools)
set(SIQADCONN_PY_DEST ${CMAKE_CURRENT_BINARY_DIR}/../cmake-install/siqadtools)
elseif(DEFINED SIQADCONN_ROOT)
set(SIQADCONN_SWIG_MODULE_DEST ${SIQADCONN_ROOT})
set(SIQADCONN_PY_DEST ${SIQADCONN_ROOT})
else()
set(SIQADCONN_SWIG_MODULE_DEST ${CMAKE_CURRENT_BINARY_DIR}/siqadtools)
set(SIQADCONN_PY_DEST ${CMAKE_CURRENT_BINARY_DIR}/siqadtools)
endif()
#set_property(TARGET ${SWIG_MODULE_siqadconn_REAL_NAME} PROPERTY CXX_STANDARD_REQUIRED 11)
# add_definitions(-Wall -g -std=c++11)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
include_directories(
.
src
swig
)
if(SKBUILD)
# Building SWIG version
set(CMAKE_SWIG_FLAGS "")
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_PATH})
set_property(SOURCE swig/siqadconn.i PROPERTY CPLUSPLUS ON)
file(COPY swig/__init__.py DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/swig")
#set_source_files_properties(swig/siqadconn.i PROPERTIES SWIG_FLAGS "-includeall")
# build the SWIG src and C++ code
swig_add_library(siqadconn LANGUAGE python SOURCES swig/siqadconn.i src/siqadconn.cc)
# link PYTHON for Windows, don't link for Linux
if (WIN32 OR APPLE)
swig_link_libraries(siqadconn ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
else()
swig_link_libraries(siqadconn ${Boost_LIBRARIES})
endif()
install(TARGETS ${SWIG_MODULE_siqadconn_REAL_NAME}
DESTINATION ${SIQADCONN_SWIG_MODULE_DEST})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/siqadconn.py
${CMAKE_CURRENT_SOURCE_DIR}/swig/__init__.py
DESTINATION ${SIQADCONN_PY_DEST})
else()
# Building as C++ library
add_library(siqadconn src/siqadconn.cc)
target_link_libraries(siqadconn ${Boost_LIBRARIES})
set_property(TARGET siqadconn PROPERTY CXX_STANDARD 11)
set_property(TARGET siqadconn PROPERTY CXX_STANDARD_REQUIRED True)
endif()