forked from gismo/gismo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
397 lines (314 loc) · 13 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
#####################################################################
## CMakeLists.txt
## This file is part of the G+Smo library.
##
## Author: Angelos Mantzaflaris
## Copyright (C) 2012-2018 - RICAM-Linz.
######################################################################
cmake_minimum_required(VERSION 2.8.8)
if(POLICY CMP0048)# CMake 3.0
cmake_policy(SET CMP0011 NEW)
cmake_policy(SET CMP0042 NEW)
cmake_policy(SET CMP0048 NEW)
endif()
if(POLICY CMP0054)# CMake 3.1
cmake_policy(SET CMP0054 NEW)
endif()
if(POLICY CMP0053)# CMake 3.1.3
cmake_policy(SET CMP0053 NEW)
endif()
if(POLICY CMP0063)# CMake 3.3
cmake_policy(SET CMP0063 NEW)
endif()
if(POLICY CMP0077)# CMake 3.13
cmake_policy(SET CMP0077 NEW)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(NOT CMAKE_BUILD_TYPE)
# Set default build type to Release
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Type of build (None Debug Release RelWithDebInfo MinSizeRel)" FORCE)
if(NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"RelWithDebInfo" "MinSizeRel")
endif()
endif()
set(gismo_VERSION_MAJOR "0")
set(gismo_VERSION_MINOR "8")
set(gismo_VERSION_PATCH "5")
set(gismo_VERSION
"${gismo_VERSION_MAJOR}.${gismo_VERSION_MINOR}.${gismo_VERSION_PATCH}" CACHE INTERNAL "gismo version number")
if(POLICY CMP0048)# CMake 3.0
project(gismo LANGUAGES C CXX VERSION ${gismo_VERSION})
else()
project(gismo C CXX)
endif()
if (GISMO_BUILD_PCH)
enable_language(CXXPCH)
endif()
if(NOT GISMO_INSOURCE_BUILD AND "${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR "In-source G+Smo builds are not permitted. \n How to fix this:\n 1. Type \nmake cleancmake\nto remove garbage CMake files. \n\n 2. Please make a separate folder for building, otherwise typing \nmake\nthat will create a ./build folder and will compile in that folder. ")
endif()
## #################################################################
## Cmake Inclusions and configuration options
## #################################################################
set(CMAKE_INSTALL_MESSAGE NEVER)
#Use solution folders for Visual Studio
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Remove NDEBUG flag from RelWithDebInfo builds
if(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
string(REPLACE "-DNDEBUG" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
include( gismoUse )
include( gsConfig )
message( " GGGGGGGGG GGGG GGGGGGGGG GGGGGG GGGGGG GGGGGGGGGG" )
message( " GGGG GGGG GGGG GGGGGG GGGGGG GGGG GGGG" )
message( " GGGG GGGGGGGGGGGG GGGGGGGGG G GGGG G GGGG GGGG GGGG" )
message( " GGGG GGGGGG GGGGGGGGGGGGG GGGGGGGGGG GG GGGG GG GGGG GGGG GGGGG" )
message( "GGGGG GGGGG GGGGGGGGGGGG GGGGGGGGG GG GGGGGG GGGG GGGG GGGG " )
message( "GGGG GGGG GGGG GGGG GG GGGG GGGG GGGG GGGG " )
message( " GGGGGGGGGG GGGG GGGGGGGGG GG GGG GGGG GGGGGGGGGG " )
message( " version ${${PROJECT_NAME}_VERSION}" )
## #################################################################
## Project options
## #################################################################
include( gsOptions )
include(CTest)
# Note: clean cache to reset to OFF
set(BUILD_TESTING "Enable testing" ${GISMO_BUILD_UNITTESTS})
## #################################################################
## Preprocessor definitions
## #################################################################
# Data directory
include ( gsDataDir )
## #################################################################
## JIT compiler
## #################################################################
include(gsJITConfigXml)
gsJITConfigXml(${CMAKE_CURRENT_SOURCE_DIR}/cmake/jit.xml.in
${CMAKE_BINARY_DIR}/config/jit.xml)
# Configure
configure_file ("${PROJECT_SOURCE_DIR}/src/gsCore/gsConfig.h.in"
"${PROJECT_BINARY_DIR}/gsCore/gsConfig.h" )
configure_file ("${PROJECT_SOURCE_DIR}/src/gsCore/gsExport.h.in"
"${PROJECT_BINARY_DIR}/gsCore/gsExport.h" )
## #################################################################
## Collect headers and sources
## #################################################################
# Clean previously set variables in the cache
unset(${PROJECT_NAME}_HEADERS CACHE)
unset(${PROJECT_NAME}_SOURCES CACHE)
unset(${PROJECT_NAME}_EXTENSIONS CACHE)
unset(${PROJECT_NAME}_MODULES CACHE)
unset(${PROJECT_NAME}_optionals CACHE)
unset(${PROJECT_NAME}_LINKER CACHE)
unset(gismo_TMPL_HEADERS CACHE)
set(${PROJECT_NAME}_optionals ""
CACHE INTERNAL "${PROJECT_NAME} list of optionals")
set (GISMO_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/external"
"${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/extensions"
CACHE INTERNAL "${PROJECT_NAME} include directories" )
#first time
include_directories(${GISMO_INCLUDE_DIRS})
# Offer the user the choice of overriding the installation directories
set(LIB_INSTALL_DIR lib CACHE STRING "Installation directory for libraries")
set(BIN_INSTALL_DIR bin CACHE STRING "Installation directory for executables")
set(INCLUDE_INSTALL_DIR include CACHE STRING "Installation directory for header files")
## #################################################################
## Extensions
## #################################################################
include(gsFetch)
# Add externals directory
add_subdirectory(external)
if(GISMO_WITH_CODIPACK)
add_subdirectory(extensions/gsCoDiPack)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${CODIPACK_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${CODIPACK_INCLUDE_DIR})
endif(GISMO_WITH_CODIPACK)
if(GISMO_WITH_IPOPT)
add_subdirectory(extensions/gsIpopt)
#set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${IPOPT_INCLUDE_DIR}
#CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${IPOPT_INCLUDE_DIR})
endif(GISMO_WITH_IPOPT)
#if(GISMO_WITH_METIS)
#include_directories(${METIS_INCLUDE_DIR})
#set(gismo_LINKER ${gismo_LINKER} ${METIS_LIBRARIES}
# CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#endif(GISMO_WITH_METIS)
if(GISMO_WITH_MPI)
find_package(MPI REQUIRED)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${MPI_INCLUDE_PATH}
CACHE INTERNAL "${PROJECT_NAME} include directories")
set(gismo_LINKER ${gismo_LINKER} ${MPI_CXX_LIBRARIES}
CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#include_directories(SYSTEM ${MPI_INCLUDE_PATH})
endif(GISMO_WITH_MPI)
if(GISMO_WITH_MPFR OR GISMO_WITH_MPQ)
find_package(GMP QUIET)
find_package(MPFR QUIET)
if (NOT GMP_FOUND OR NOT MPFR_FOUND)
add_subdirectory(extensions/gsMultiPrecision)
endif()
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${GMP_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
set(gismo_LINKER ${gismo_LINKER} ${GMP_LIBRARY} ${GMPXX_LIBRARY}
CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#include_directories(SYSTEM ${GMP_INCLUDE_DIR})
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${MPFR_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
set(gismo_LINKER ${gismo_LINKER} ${MPFR_LIBRARY}
CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#include_directories(SYSTEM ${MPFR_INCLUDE_DIR})
endif()
if(GISMO_WITH_ONURBS)
add_subdirectory(extensions/gsOpennurbs)
endif(GISMO_WITH_ONURBS)
#if(GISMO_WITH_PARDISO)
#endif(GISMO_WITH_PARDISO)
#if(GISMO_WITH_PASTIX)
#endif(GISMO_WITH_PASTIX)
if(GISMO_WITH_PSOLID)
add_subdirectory(extensions/gsParasolid)
endif(GISMO_WITH_PSOLID)
if(GISMO_WITH_SPECTRA)
add_subdirectory(extensions/gsSpectra)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${SPECTRA_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${SPECTRA_INCLUDE_DIR})
endif(GISMO_WITH_SPECTRA)
if(GISMO_WITH_SUPERLU)
find_package(SuperLU REQUIRED)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${SUPERLU_INCLUDES}
CACHE INTERNAL "${PROJECT_NAME} include directories")
set(gismo_LINKER ${gismo_LINKER} ${SUPERLU_LIBRARIES}
CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#include_directories(SYSTEM ${SUPERLU_INCLUDES})
endif(GISMO_WITH_SUPERLU)
if(GISMO_WITH_TAUCS)
find_package(Taucs REQUIRED)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${TAUCS_INCLUDES}
CACHE INTERNAL "${PROJECT_NAME} include directories")
set(gismo_LINKER ${gismo_LINKER} ${TAUCS_LIBRARIES}
CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#include_directories(SYSTEM ${SUPERLU_INCLUDES})
endif(GISMO_WITH_TAUCS)
if(GISMO_WITH_UMFPACK)
find_package(Umfpack REQUIRED)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${UMFPACK_INCLUDES}
CACHE INTERNAL "${PROJECT_NAME} include directories")
set(gismo_LINKER ${gismo_LINKER} ${UMFPACK_LIBRARIES}
CACHE INTERNAL "${PROJECT_NAME} extra linker objects")
#include_directories(SYSTEM ${UMFPACK_INCLUDES})
endif(GISMO_WITH_UMFPACK)
if(GISMO_WITH_UNUM)
add_subdirectory(extensions/gsUnum)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${UNUM_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${UNUM_INCLUDE_DIR})
endif(GISMO_WITH_UNUM)
if(GISMO_WITH_TRILINOS)
add_subdirectory(extensions/gsTrilinos)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${TRILINOS_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${TRILINOS_INCLUDE_DIR})
endif(GISMO_WITH_TRILINOS)
if(GISMO_WITH_OCC)
add_subdirectory(extensions/gsOpenCascade)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${OCC_INCLUDE_DIR}
CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${OCC_INCLUDE_DIR})
endif(GISMO_WITH_OCC)
if(GISMO_WITH_SMESH)
include(external/surface_mesh.cmake)
set (GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS} ${SMESH_INCLUDE_DIRS}
CACHE INTERNAL "${PROJECT_NAME} include directories")
#include_directories(${SMESH_INCLUDE_DIR})
endif()
#second time
include_directories(${GISMO_INCLUDE_DIRS})
# external inclusion paths
#get_property(EXTERNAL_INCLUDE_DIRS GLOBAL PROPERTY EXTERNAL_INCLUDE_DIRS)
#include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/external)
# Add main sources directory
add_subdirectory(src)
if(GISMO_BUILD_LIB)
if (GISMO_EXTRA_DEBUG)
set(gismo_SOURCES ${gismo_SOURCES} ${PROJECT_SOURCE_DIR}/src/misc/gsStackWalker.cpp)
endif()
endif()
## #################################################################
## Submodules
## #################################################################
if(GISMO_COMPFLOW)
gismo_fetch_module(gsCompFlow)
endif()
if(GISMO_ELASTICITY)
gismo_fetch_module(gsElasticity)
endif()
if(GISMO_EXASTENCILS)
gismo_fetch_module(gsExaStencils)
endif()
if(GISMO_UNSUPPORTED OR GISMO_MOTOR)
gismo_fetch_module(unsupported)
endif()
if(GISMO_MOTOR)
gismo_fetch_module(motor)
endif()
## #################################################################
## Shared and static library
## #################################################################
include(gsLibrary)
## #################################################################
## Documentation
## #################################################################
add_subdirectory(doc/snippets EXCLUDE_FROM_ALL)
add_subdirectory(doc)
## #################################################################
## Plugins
## #################################################################
add_custom_target(plugins)
if(GISMO_BUILD_AXL)
add_subdirectory(plugins/gsAxel)
endif(GISMO_BUILD_AXL)
if(GISMO_BUILD_MEX)
add_subdirectory(plugins/gsMex)
endif(GISMO_BUILD_MEX)
if(GISMO_BUILD_PVIEW)
add_subdirectory(plugins/gsParaview)
endif(GISMO_BUILD_PVIEW)
if(GISMO_BUILD_RHINOPLUGINS)
add_subdirectory(plugins/RhinoTHBSplines)
endif(GISMO_BUILD_RHINOPLUGINS)
## #################################################################
## Install
## #################################################################
include(gsInstall)
## #################################################################
## Executables
## #################################################################
# Note: if the shared libs are created, examples are linked against the
# shared lib, otherwise targets are not linked against anything, only
# templated code is used.
if(GISMO_BUILD_EXAMPLES)
add_subdirectory(examples)
else()
add_subdirectory(examples EXCLUDE_FROM_ALL)
endif(GISMO_BUILD_EXAMPLES)
## #################################################################
## Unittests
## #################################################################
if(GISMO_BUILD_UNITTESTS)
add_subdirectory(unittests)
else()
add_custom_target(unittests COMMAND "" COMMENT "Set CMake argument GISMO_BUILD_UNITTESTS=ON to enable unittests")
endif(GISMO_BUILD_UNITTESTS)
add_subdirectory(optional)
if (NOT gismo_optionals STREQUAL "")
string (REPLACE ";" ", " gismo_optionals "${gismo_optionals}")
message(STATUS "Optional compile list: ${gismo_optionals}")
endif()
unset(GISMO_UNAME CACHE)
unset(GISMO_PASS CACHE)
#message("GISMO_INCLUDE_DIRS ${GISMO_INCLUDE_DIRS}")