forked from ndarray/Boost.NumPy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
118 lines (95 loc) · 3.33 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
cmake_minimum_required(VERSION 2.8.3)
project( boost.numpy )
# put our local cmake find scripts at the beginning of the cmake
# module search path
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/libs/numpy/cmake ${CMAKE_MODULE_PATH})
# configure output folders so artifacts are built into a single set of
# top-level folders rather than the default cmake build structure that
# matches the source tree.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
CACHE PATH "Output directory for static libraries.")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
CACHE PATH "Output directory for shared libraries.")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
CACHE PATH "Output directory for executables and DLL's.")
# find required python packages
find_package(PythonInterp REQUIRED)
find_package(PythonLibsNew REQUIRED)
find_package(NumPy REQUIRED)
# find boost
#
# set(Boost_USE_STATIC_LIBS ON)
# set(Boost_USE_MULTITHREADED ON)
# set(Boost_USE_STATIC_RUNTIME ON)
FIND_PACKAGE(Boost COMPONENTS python REQUIRED)
message( STATUS "found boost:"
"\nINCLUDE: ${Boost_INCLUDE_DIRS}"
"\nLIB: ${Boost_LIBRARIES}"
)
# add_definitions( -DBOOST_ALL_NO_LIB )
# In some cases, you may need to explicitly specify that a dynamic Boost is used; if so use:
# add_definitions( -DBOOST_ALL_DYN_LINK )
# variable controlling whether the boost_numpy is a shared or static library
if (WIN32)
set(LIBRARY_TYPE STATIC CACHE STRING "type of library to make for boost_numpy")
else()
set(LIBRARY_TYPE SHARED CACHE STRING "type of library to make for boost_numpy")
endif()
# variable controlling building of documentation
set(BUILD_DOCS OFF CACHE BOOL "Build Boost.NumPy Documentation")
# logic for configuring documentation generation
if(BUILD_DOCS)
# find sphinx
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sphinx; print sphinx.__version__"
RESULT_VARIABLE SPHINX_PROCESS
OUTPUT_VARIABLE SPHINX_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(HAVE_SPHINX 0)
if(SPHINX_PROCESS EQUAL 0)
FIND_PROGRAM(SPHINX_BUILD sphinx-build)
if(SPHINX_BUILD)
set(HAVE_SPHINX 1)
message(STATUS " Found Sphinx ${SPHINX_VERSION}: ${SPHINX_BUILD}")
else()
# sphinx is required to generate documention, so it is an error
# if we cannot find it
MESSAGE(SEND_ERROR "must be able to find sphinx-build when BUILD_DOCS is enabled")
endif()
endif()
# find pdflatex, which is only required for doc-pdf
FIND_PACKAGE(LATEX)
if (PDFLATEX_COMPILER)
message( STATUS "Found PDFLATEX_COMPILER=${PDFLATEX_COMPILER}" )
else()
message( STATUS "Found PDFLATEX_COMPILER NOT found" )
endif()
endif()
# compiler definitions for non-windows builds
if (NOT WIN32)
add_definitions(-fPIC)
endif()
# enable ctest targets
ENABLE_TESTING()
# turn on visual studio solution folders
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
# global settings for include paths
include_directories(
${PROJECT_SOURCE_DIR}
${PYTHON_INCLUDE_DIRS}
${NUMPY_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
# install headers
install(DIRECTORY boost
DESTINATION "include"
FILES_MATCHING
PATTERN "*.hpp"
${INSTALL_PERMISSIONS_SRC}
)
# add submodules
ADD_SUBDIRECTORY(libs/numpy/src)
ADD_SUBDIRECTORY(libs/numpy/example)
ADD_SUBDIRECTORY(libs/numpy/test)
if (BUILD_DOCS)
ADD_SUBDIRECTORY(libs/numpy/doc)
endif()