-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
213 lines (165 loc) · 5.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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
##
## -- CMake build system description
##
cmake_minimum_required(VERSION 3.13)
set(aProjName "Engabra")
set(${aProjName}LibName Engabra)
set(aProjVersion "0.2.0") # Set based on features, updates and patches
# Get source code identifier (e.g. hash code from git repo)
include(./cmake/func_setReleaseTag.cmake)
setReleaseTag(aSourceIdentity)
project(
${aProjName}
VERSION ${aProjVersion}
DESCRIPTION "Practical C++ Geometric Algebra Computation for Engineering"
LANGUAGES CXX
)
message("### CMAKE_MAJOR_VERSION: " ${CMAKE_MAJOR_VERSION})
message("### CMAKE_MINOR_VERSION: " ${CMAKE_MINOR_VERSION})
message("### CMAKE_PATCH_VERSION: " ${CMAKE_PATCH_VERSION})
message("### CMAKE_TWEAK_VERSION: " ${CMAKE_TWEAK_VERSION})
message("### PROJECT: " ${PROJECT})
message("### PROJECT_VERSION: " ${PROJECT_VERSION})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# If any compile flags definitions - add here
add_definitions()
set(BUILD_FLAGS_FOR_CLANG
""
)
set(BUILD_FLAGS_FOR_GCC
"-DEngabra_Project_Version=\"${aProjVersion}\""
"-DEngabra_Source_Identity=\"${aSourceIdentity}\""
#
-pthread
-fomit-frame-pointer
-fno-operator-names
-fstrict-enums
#
-Wc++11-compat
-Wall
-Wextra
-Wuninitialized
-Winit-self
-fno-nonansi-builtins
-pedantic-errors
#
-fmax-errors=1 # keep template error message generation under control
)
set(BUILD_FLAGS_FOR_VISUAL
""
)
##
## -- configure packaging utilities
##
# unit test capabilities
# include and enable here for enable to be inherited by subdir tree
include(CTest)
enable_testing()
# Needs to be included first for use in subdir CMakeLists.txt files
include(GNUInstallDirs) # creates/sets CMAKE_INSTALL_<dir>
##
## -- project source tree description
##
set(EXPORT_ALIAS_NAME ${aProjName}::${aProjName})
set(EXPORT_TARGETS_NAME ${aProjName}Targets)
set(EXPORT_FILENAME ${EXPORT_TARGETS_NAME}.cmake)
message("### EXPORT_ALIAS_NAME: " ${EXPORT_ALIAS_NAME})
message("### EXPORT_TARGETS_NAME: " ${EXPORT_TARGETS_NAME})
message("### EXPORT_FILENAME: " ${EXPORT_FILENAME})
## -- Inform CMake about project tree
# ===
# === Documentation
# ===
add_subdirectory(doc) # project reference documentation
# ===
# === Library
# ===
# Project source code
add_subdirectory(src) # project source code
add_subdirectory(include) # project library public interface (e.g. c++ headers)
# ===
# === Tests
# ===
add_subdirectory(test) # developer unit tests (check source code operation)
#add_subdirectory(vnv) # use-case validation tests
# ===
# === Demonstrations
# ===
# Project examples
## -- simple demo programs (more elaborate ones separate repositories)
add_subdirectory(demo)
# ===
# === Packaging
# ===
# CMake configuration file packaging
add_subdirectory(cmake) # generate .cmake files for downstream use
##
## -- CMake configuration utilities
##
message("####==== aProjName: ${aProjName}")
message("####==== ${aProjName}_VERSION: ${${aProjName}_VERSION}")
set_property(
TARGET ${aProjName}
PROPERTY VERSION ${${aProjName}_VERSION}
)
set_property(
TARGET ${aProjName}
PROPERTY VERSION INTERFACE_${aProjName}_MAJOR_VERSION 1
)
set_property(
TARGET ${aProjName}
APPEND PROPERTY COMPATIBLE_INTERFACE_STRING ${aProjName}_MAJOR_VERSION
)
##
## -- Distribution packages
##
# Override default install location for testing this package
# In general default (no command here) will install to /usr/{lib,bin,...}
# - but here, set package to sandbox location for easier/safer testing
# set (DEB_PACKAGE_ROOT "/tmpLocal/${aProjName}")
# - default is "/usr" (e.g. for system packages)
# - specify explicitly as "/usr/local" as a developer local package
# - extract from command line
set (DEB_PACKAGE_ROOT "${CMAKE_INSTALL_PREFIX}")
set(CPACK_PACKAGING_INSTALL_PREFIX "${DEB_PACKAGE_ROOT}")
# list of packages to create (e.g. "DEB;RPM;...") if all tools installed
set(CPACK_GENERATOR "DEB")
#
# === Distribution package creation
#
set(aProj_PACKAGE_VENDOR "https://github.com/Stellacore")
set(aProj_PACKAGE_MAINTAINER "https://github.com/Stellacore/${aProjName}")
# Specify generic cross-package distribuation properties
# set(CPACK_PACKAGE_NAME ${aProjName}) # same as default
set(CPACK_PACKAGE_VENDOR "${aProj_PACKAGE_VENDOR}")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK})
# == Debian package
set(CPACK_PACKAGING_INSTALL_PREFIX "${DEB_PACKAGE_ROOT}")
# Set package(Generator) specific characteristics
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${aProj_PACKAGE_MAINTAINER}")
# -- deps:
# set(APT_PACKAGE_DEPLIST
# "libeigen3-dev (>= ${EigenVersion}) \
# "
# )
# set(CPACK_DEBIAN_PACKAGE_DEPENDS ${APT_PACKAGE_DEPLIST})
# Must be included after the package variables are set
include(CPack)
message("###")
message("### CMAKE_INSTALL_LIBDIR: " ${CMAKE_INSTALL_LIBDIR})
message("### CMAKE_INSTALL_BINDIR: " ${CMAKE_INSTALL_BINDIR})
message("### CMAKE_INSTALL_INCLUDEDIR: " ${CMAKE_INSTALL_INCLUDEDIR})
message("### CMAKE_INSTALL_DOCDIR: " ${CMAKE_INSTALL_DOCDIR})
message("###")
message("### CMAKE_INSTALL_FULL_LIBDIR: " ${CMAKE_INSTALL_FULL_LIBDIR})
message("### CMAKE_INSTALL_FULL_BINDIR: " ${CMAKE_INSTALL_FULL_BINDIR})
message("### CMAKE_INSTALL_FULL_INCLUDEDIR: " ${CMAKE_INSTALL_FULL_INCLUDEDIR})
message("### CMAKE_INSTALL_FULL_DOCDIR: " ${CMAKE_INSTALL_FULL_DOCDIR})
message("###")
message("### DEB_PACKAGE_ROOT: " ${DEB_PACKAGE_ROOT})
message("###")