-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
111 lines (99 loc) · 3.47 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
cmake_minimum_required(VERSION 3.9)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT DEFINED CMAKE_BUILD_TYPE)
message(STATUS "CMAKE_BUILD_TYPE not set by user, setting to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
message(STATUS "CMAKE_BUILD_TYPE : ${CMAKE_BUILD_TYPE}")
project(GSLpp CXX)
find_package(GSL REQUIRED)
include_directories(${GSL_INCLUDE_DIRS})
set(WFLAGS " -Werror -Wall -Wextra -pedantic -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion -Wsign-conversion -Wmisleading-indentation -Wnull-dereference -Wdouble-promotion -Wformat=2 -Weffc++")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WFLAGS "${WFLAGS} -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wuseless-cast")
endif()
set(CMAKE_CXX_FLAGS ${WFLAGS})
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(SOURCE_FILES src/complex_impl.cpp
src/matrix_impl.cpp
src/vector_impl.cpp
src/divided_difference.cpp
src/permutation.cpp
src/eigen.cpp
src/linalg.cpp
src/basic_math.cpp
src/special_functions_bessel.cpp
src/special_functions_legendre.cpp
src/special_functions_laguerre.cpp
src/special_functions_hermite.cpp
src/special_functions_coupling.cpp
src/special_functions_exp.cpp
src/special_functions_log.cpp
src/special_functions_trig.cpp
src/special_functions_erf.cpp
src/special_functions_gamma_beta.cpp
src/special_functions_results.cpp
src/interp.cpp
src/ode.cpp
src/error.cpp)
set(TEST_FILES tests/matrix_cx_test.cpp
tests/vector_cx_test.cpp
tests/complex_base_math_test.cpp
tests/matrix_f_test.cpp
tests/vector_f_test.cpp
tests/complex_f_base_math_test.cpp
tests/matrix_i_test.cpp
tests/vector_i_test.cpp
tests/complex_f_test.cpp
tests/matrix_ld_test.cpp
tests/vector_ld_test.cpp
tests/complex_ld_base_math_test.cpp
tests/matrix_s_test.cpp
tests/vector_l_test.cpp
tests/complex_ld_test.cpp
tests/matrix_test.cpp
tests/vector_s_test.cpp
tests/complex_test.cpp
tests/matrix_uc_test.cpp
tests/vector_test.cpp
tests/interp_test.cpp
tests/ode_test.cpp
tests/matrix_ui_test.cpp
tests/vector_uc_test.cpp
tests/main_tests.cpp
tests/matrix_us_test.cpp
tests/vector_ui_test.cpp
tests/matrix_c_test.cpp
tests/vector_c_test.cpp
tests/vector_ul_test.cpp
tests/matrix_cxf_test.cpp
tests/vector_cxf_test.cpp
tests/vector_us_test.cpp
tests/matrix_cxld_test.cpp
tests/vector_cxld_test.cpp
tests/main_tests.cpp
)
add_library(GSLpp SHARED ${SOURCE_FILES})
target_include_directories(GSLpp PUBLIC include)
target_link_libraries(GSLpp ${GSL_LIBRARIES} openblas m)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if(result)
set_property(TARGET GSLpp PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
enable_testing()
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
add_executable(GSLppUnitTest ${TEST_FILES})
target_link_libraries(GSLppUnitTest GSLpp ${GTEST_LIBRARIES})
GTEST_ADD_TESTS(GSLppUnitTest "" ${TEST_FILES})
message(STATUS "CXX flags : ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
endif()
install(TARGETS GSLpp
LIBRARY DESTINATION lib/GSLpp)
# install(DIRECTORY include/GSLpp DESTINATION include)