forked from BrunoLevy/geogram
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
233 lines (174 loc) · 7.82 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
##############################################################################
# Geogram/Vorpaline root CMakeList
##############################################################################
cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0048 NEW)
##############################################################################
set(VORPALINE_VERSION_RC TRUE)
set(VORPALINE_VERSION_MAJOR 1)
set(VORPALINE_VERSION_MINOR 9)
set(VORPALINE_VERSION_PATCH 1)
set(VORPALINE_VERSION_PLAIN ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH})
if(VORPALINE_VERSION_RC)
set(VORPALINE_VERSION ${VORPALINE_VERSION_PLAIN}-rc)
else()
set(VORPALINE_VERSION ${VORPALINE_VERSION_PLAIN})
endif()
##############################################################################
# Note: geogram.cmake defines GEOGRAM_WITH_VORPALINE
# that we could have used instead,
# but geogram.cmake needs to be included after the project()
# command, since project() resets CFLAGS and CXXFLAGS.
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/vorpalib)
project(Vorpaline VERSION "${VORPALINE_VERSION_PLAIN}")
else()
project(Geogram VERSION "${VORPALINE_VERSION_PLAIN}")
endif()
# Optional modules
# (can be overriden in CMakeOptions.txt)
# Set GEOGRAM_SUB_BUILD if Geogram sources included in buildtree, then
# VORPALINE_PLATFORM can be set directly in parent CMakeLists.txt
if(NOT GEOGRAM_SUB_BUILD)
option(GEOGRAM_WITH_GRAPHICS "Viewers and geogram_gfx library" ON)
option(GEOGRAM_WITH_LEGACY_NUMERICS "Legacy numerical libraries" ON)
option(GEOGRAM_WITH_HLBFGS "Non-linear solver (Yang Liu's HLBFGS)" ON)
option(GEOGRAM_WITH_TETGEN "Tetrahedral mesher (Hang Si's TetGen)" ON)
option(GEOGRAM_WITH_TRIANGLE "Triangle mesher (Jonathan Shewchuk's triangle)" ON)
option(GEOGRAM_WITH_LUA "Built-in LUA interpreter" ON)
option(GEOGRAM_LIB_ONLY "Libraries only (no example programs/no viewer)" OFF)
option(GEOGRAM_WITH_FPG "Predicate generator (Sylvain Pion's FPG)" OFF)
option(GEOGRAM_USE_SYSTEM_GLFW3 "Use the version of GLFW3 installed in the system if found" OFF)
option(GEOGRAM_WITH_GARGANTUA "64-bit indices" OFF)
option(GEOGRAM_WITH_TBB "Use TBB for multi-threading" OFF)
include(cmake/geo_detect_platform.cmake)
endif()
if(GEOGRAM_WITH_TBB AND NOT TARGET TBB::tbb)
include(cmake/onetbb.cmake)
endif()
include(cmake/geogram.cmake)
# Override default CMAKE_INSTALL_DOCDIR: Use doc instead of CMake default DATAROOTDIR/doc/PROJECT_NAME
set(CMAKE_INSTALL_DOCDIR doc CACHE PATH "Documentation root")
# Set remaining CMAKE_INSTALL_...DIR variables
include(GNUInstallDirs)
# Install destinations for pkg-config and CMake files
set(GEOGRAM_INSTALL_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH "pkg-config file install destination")
set(GEOGRAM_INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/modules CACHE PATH "CMake file install destination")
set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR})
# Determine the current Build-OS (Build-platform without the compiler info)
string(REGEX REPLACE "-[^-]+$" "" VORPALINE_OS ${VORPALINE_PLATFORM})
# Determine the current build date
string(TIMESTAMP VORPALINE_BUILD_DATE "%Y-%m-%d %H:%M:%S")
string(TIMESTAMP YEAR "%Y")
# Determine the current build number
# This is set by Jenkins in environment variable BUILD_NUMBER
set(VORPALINE_BUILD_NUMBER $ENV{BUILD_NUMBER})
if(GEOGRAM_WITH_GARGANTUA)
add_definitions(-DGARGANTUA)
endif()
##############################################################################
# Get SVN revision info
if(GEOGRAM_WITH_VORPALINE)
## set(VORPALINE_SVN_REVISION ${Vorpaline_WC_REVISION})
endif()
##############################################################################
# RPATH (where executables find the .so / DLLs)
# - Enables RPATH support for MACOSX
# - Makes RPATH of dynamic libraries and executable point to the directory
# where libraries are installed.
if(VORPALINE_BUILD_DYNAMIC)
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif()
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
# uninstall target
# Needs to be created before add_subdirectory() because GLFw has
# also an uninstall target that will be inhibited if there is
# already one (Geogram's one needs to be first)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
##############################################################################
# Geogram/Vorpaline sources
add_subdirectory(src/lib/geogram)
if(GEOGRAM_WITH_VORPALINE)
add_subdirectory(src/lib/vorpalib)
endif()
add_subdirectory(src/lib/third_party)
if(GEOGRAM_WITH_GRAPHICS)
add_subdirectory(src/lib/geogram_gfx)
endif()
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/lib/exploragram)
if(GEOGRAM_WITH_EXPLORAGRAM)
add_subdirectory(src/lib/exploragram)
endif()
endif()
if(NOT GEOGRAM_LIB_ONLY)
add_subdirectory(src/bin)
add_subdirectory(src/tests)
add_subdirectory(src/examples)
add_subdirectory(tests)
endif()
add_subdirectory(doc)
##############################################################################
# Cleanup from previous builds
file(REMOVE ${CMAKE_BINARY_DIR}/doc/LICENSE.txt)
##############################################################################
# Geogram installation
# FindGeogram.cmake
install(FILES cmake/FindGeogram.cmake DESTINATION ${GEOGRAM_INSTALL_CMAKE_DIR} COMPONENT devkit)
# Configure CPack
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_SYSTEM_NAME ${VORPALINE_OS})
set(CPACK_PACKAGE_VENDOR "INRIA - ALICE")
if(${GEOGRAM_WITH_VORPALINE})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A flexible mesh generator")
else()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "fast, simple and easy-to-use primitives for geometric programming")
endif()
set(CPACK_PACKAGE_VERSION_MAJOR ${VORPALINE_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VORPALINE_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VORPALINE_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${VORPALINE_VERSION})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY true)
if(CPACK_GENERATOR STREQUAL "DEB")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGE_CONTACT [email protected])
# set(CPACK_PACKAGE_DEPENDS "libglfw3 (>= 3.2-1), libc6 (>= 2.22-11), libstdc++ (>= 6.1.1-4)")
# TODO: use objdump -p | grep NEEDED to automate...
# or GET_PROPERTY(result GLOBAL ENABLED_FEATURES) (successful FIND_PACKAGE())
endif()
if(NOT DEFINED CPACK_GENERATOR)
if(WIN32)
set(CPACK_GENERATOR ZIP)
else()
set(CPACK_GENERATOR TGZ)
endif()
endif()
# Enable component-based packaging for archive generators (TGZ, ZIP)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL runtime devkit devkit-full doc-devkit doc-devkit-full)
set(CPACK_COMPONENTS_GROUPING "IGNORE")
set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "Vorpaline Application")
set(CPACK_COMPONENT_RUNTIME_GROUP "Runtime")
set(CPACK_COMPONENT_DEVKIT_DISPLAY_NAME "Vorpaline Developer Kit")
set(CPACK_COMPONENT_DEVKIT_GROUP "Development")
set(CPACK_COMPONENT_DEVKIT-FULL_DISPLAY_NAME "Vorpaline Full Developer Kit")
set(CPACK_COMPONENT_DEVKIT-FULL_GROUP "Development")
set(CPACK_COMPONENT_DOC-DEVKIT_DISPLAY_NAME "Vorpaline API Developer Kit Documentation")
set(CPACK_COMPONENT_DOC-DEVKIT_GROUP "Documentation")
set(CPACK_COMPONENT_DOC-DEVKIT-FULL_DISPLAY_NAME "Vorpaline Full Developer Kit Documentation")
set(CPACK_COMPONENT_DOC-DEVKIT-FULL_GROUP "Documentation")
set(CPACK_COMPONENT_DOC-DEVKIT-INTERNAL_DISPLAY_NAME "Vorpaline Internal Developer Kit Documentation")
set(CPACK_COMPONENT_DOC-DEVKIT-INTERNAL_GROUP "Documentation")
# Copy the helper script to build individual packages to the binary directory
configure_file(
tools/make_package.pl.in
make_package.pl
@ONLY
)
# This must always be last!
include(CPack)