-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
161 lines (142 loc) · 6.62 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
cmake_minimum_required(VERSION 3.14)
project(linger VERSION 0.0.1)
include(CTest)
add_library(linger INTERFACE)
target_include_directories(linger
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_sources(linger
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/addition_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/addition_traits_impl.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/arithmetic_operators.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/arithmetic_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/debug_helpers.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/dynamic_engines.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/engine_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/fixed_size_engines.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/forward_declarations.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/library_aliases.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/matrix.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/multiplication_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/multiplication_traits_impl.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/negation_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/negation_traits_impl.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/number_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/operation_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/row_column_views.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/subtraction_traits.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/subtraction_traits_impl.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/transpose_views.hpp>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra/vector.hpp>
$<INSTALL_INTERFACE:include/linear_algebra.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/addition_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/addition_traits_impl.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/arithmetic_operators.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/arithmetic_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/debug_helpers.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/dynamic_engines.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/engine_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/fixed_size_engines.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/forward_declarations.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/library_aliases.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/matrix.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/multiplication_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/multiplication_traits_impl.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/negation_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/negation_traits_impl.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/number_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/operation_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/row_column_views.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/subtraction_traits.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/subtraction_traits_impl.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/transpose_views.hpp>
$<INSTALL_INTERFACE:include/linear_algebra/vector.hpp>
)
target_compile_features(linger
INTERFACE
cxx_std_17
)
add_library(linger::linger ALIAS linger)
add_executable(linger_test "")
target_include_directories(linger_test
PRIVATE
test
)
target_sources(linger_test
PRIVATE
test/test_new_arithmetic.hpp
test/test_new_engine.hpp
test/test_new_number.hpp
test/test_obj_matrix.cpp
test/test_op_add.cpp
test/test_op_mul.cpp
test/test_op_neg.cpp
test/test_op_sub.cpp
# test/test_01.cpp
# test/test_02.cpp
test/test_main.cpp
)
target_link_libraries(linger_test
PRIVATE
linger::linger
)
set_target_properties(linger_test PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS NO
)
target_compile_options(linger_test
PRIVATE
$<$<OR:$<CXX_COMPILER_ID:GNU>>:-Wall -pedantic -Wextra -Wno-unused-function -Wno-unused-variable -W -Wno-unused-but-set-variable -fmax-errors=10>
$<$<OR:$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:Clang>>:-Wall -pedantic -Wextra -Wno-unused-parameter -Wno-unused-function>
)
# This should be passed in via the commmand line ("cmake --build ./ -v" or "cmake --build ./ -DCMAKE_VERBOSE_MAKEFILE=1")
#set(CMAKE_VERBOSE_MAKEFILE 1)
include(GNUInstallDirs)
# Hierarchically copy headers to the install dir
install (
DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/include/linear_algebra"
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN
"*.hpp"
)
install(
TARGETS linger
DESTINATION lib/cmake/linger
EXPORT linger-target
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
EXPORT linger-target
NAMESPACE linger::
#FILE linger-target.cmake
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/linger"
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/linger-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/linger-config.cmake
INSTALL_DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/linger"
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/linger-version.cmake
VERSION ${PROPAGATE_CONST_VERSION}
COMPATIBILITY SameMajorVersion
ARCH_INDEPENDENT
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/linger-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/linger-version.cmake
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/linger"
)