-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
62 lines (51 loc) · 2.26 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
set(CMAKE_OSX_ARCHITECTURES x86_64;arm64 CACHE INTERNAL "archs for osx")
cmake_minimum_required(VERSION 3.0)
project(ChebTools)
# Set the standard for C++ to c++17
set(CMAKE_CXX_STANDARD 17)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/externals/Eigen")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
set(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/ChebTools.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/speed_tests.cpp")
if (MSVC)
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/externals/Eigen/debug/msvc/eigen.natvis")
endif()
set(OPENMP_NEEDED False)
if (OPENMP_NEEDED)
# Check for the existence of OpenMP and enable it as needed
# see also http://stackoverflow.com/a/12404666/1360263
find_package(OpenMP)
endif()
if (CHEBTOOLS_STATIC_LIBRARY OR NISTFIT_PYBIND11)
add_library(ChebTools STATIC ${SOURCES})
# Add target include directories for easy linking with other applications
target_include_directories(ChebTools PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
if (OPENMP_NEEDED)
target_link_libraries(ChebTools PUBLIC OpenMP::OpenMP_CXX)
endif()
else()
if (NOT CHEBTOOLS_NO_PYBIND11)
# Build pybind11 python module
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/externals/pybind11")
pybind11_add_module(ChebTools "${CMAKE_CURRENT_SOURCE_DIR}/src/pybind11_wrapper.cpp" ${SOURCES})
target_compile_definitions(ChebTools PUBLIC -DPYBIND11)
if (OPENMP_NEEDED)
target_link_libraries(ChebTools PUBLIC OpenMP::OpenMP_CXX)
endif()
endif()
if (NOT CHEBTOOLS_NO_MONOLITH)
# Also build monolithic exe
add_executable(ChebToolsMonolith "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" ${SOURCES})
if (OPENMP_NEEDED)
target_link_libraries(ChebToolsMonolith PUBLIC OpenMP::OpenMP_CXX)
endif()
endif()
if (NOT CHEBTOOLS_NO_CATCH)
# Also build Catch testing module
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/externals/Catch/single_include")
add_executable(ChebToolsCatchTests "${CMAKE_CURRENT_SOURCE_DIR}/tests/tests.cpp" ${SOURCES})
if (OPENMP_NEEDED)
target_link_libraries(ChebToolsCatchTests PUBLIC OpenMP::OpenMP_CXX)
endif()
endif()
endif()
add_subdirectory("scripts/Basu")