forked from igatoolsProject/igatools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
390 lines (308 loc) · 14.4 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
#-+--------------------------------------------------------------------
# Igatools a general purpose Isogeometric analysis library.
# Copyright (C) 2012-2016 by the igatools authors (see authors.txt).
#
# This file is part of the igatools library.
#
# The igatools library is free software: you can use it, redistribute
# it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-+--------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Main cmake file for the igatools library
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#TODO: Define the configure time variable for dimension compilation
#TODO: upadate to cmake >= 3
cmake_minimum_required(VERSION 3.1)
project(iga CXX C)
list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules")
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Include all local macros
file(GLOB_RECURSE macro_list ${PROJECT_SOURCE_DIR}/cmake/*.cmake)
foreach(item ${macro_list})
include (${item})
endforeach(item)
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Make sure the build directory is not the source or
# the install directory
#
macro_ensure_out_of_source_build()
macro_ensure_out_of_build_install()
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# If the prefix is not provided by the user but the
# enviroment variable IGATOOLS_PREFIX exists then we use it
# instead of the default prefix
if((DEFINED ENV{IGATOOLS_PREFIX}) AND (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT))
set(CMAKE_INSTALL_PREFIX
$ENV{IGATOOLS_PREFIX} CACHE PATH "Installation prefix" FORCE)
endif()
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Set the igatools version
#
set(IGATOOLS_MAJOR_VERSION 1)
set(IGATOOLS_MINOR_VERSION 99)
set(IGATOOLS_PATCH_VERSION 0)
set(IGATOOLS_VERSION
${IGATOOLS_MAJOR_VERSION}.${IGATOOLS_MINOR_VERSION}.${IGATOOLS_PATCH_VERSION})
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Find Required programs
#
find_sed()
find_python()
find_doxygen()
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Optional features for building igatools
#
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(USE_DEPRECATED "Use the part of the igatools code marked as deprecated" OFF)
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(IGATOOLS_USES_TRILINOS "Use the linear algebra packages from Trilinos" ON)
if (IGATOOLS_USES_TRILINOS)
message("-- TRILINOS support is enabled.")
else(IGATOOLS_USES_TRILINOS)
message("-- TRILINOS support is not enabled.")
endif(IGATOOLS_USES_TRILINOS)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(IGATOOLS_WITH_NURBS "Enable NURBS support" ON)
if (IGATOOLS_WITH_NURBS)
message("-- NURBS support is enabled.")
else(IGATOOLS_WITH_NURBS)
message("-- NURBS support is not enabled.")
endif(IGATOOLS_WITH_NURBS)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(REAL_IS_LONG_DOUBLE "Enable quadruple precision" OFF)
if (REAL_IS_LONG_DOUBLE)
message("-- Quadruple precision support (EXPERIMENTAL) is enabled.")
else(REAL_IS_LONG_DOUBLE)
message("-- Quadruple precision support (EXPERIMENTAL) is not enabled.")
endif(REAL_IS_LONG_DOUBLE)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(MPATCH "Enable multipatch features of the library (experimental)" OFF)
if (MPATCH)
message("-- Multipatch features (EXPERIMENTAL) are enabled.")
else(MPATCH)
message("-- Multipatch features (EXPERIMENTAL) are not enabled.")
endif(MPATCH)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(HIERARCHICAL "Enable Hierarchical splines support (experimental)" OFF)
if (HIERARCHICAL)
message("-- Hierarchical splines support (EXPERIMENTAL) is enabled.")
else(HIERARCHICAL)
message("-- Hierarchical splines support (EXPERIMENTAL) is not enabled.")
endif(HIERARCHICAL)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(IGATOOLS_WITH_MESH_REFINEMENT "Enable mesh refinement support" ON)
if (IGATOOLS_WITH_MESH_REFINEMENT)
if (NOT IGATOOLS_USES_TRILINOS)
message (FATAL_ERROR "IGATOOLS_WITH_MESH_REFINEMENT variable set to ON is not "
"compatible with IGATOOLS_USES_TRILINOS set to OFF. Trilinos support must be "
"activated.")
endif ()
message("-- Mesh refinement support (EXPERIMENTAL) is enabled.")
else(IGATOOLS_WITH_MESH_REFINEMENT)
message("-- Mesh refinement support (EXPERIMENTAL) is not enabled.")
endif(IGATOOLS_WITH_MESH_REFINEMENT)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(IGATOOLS_WITH_SERIALIZATION "Enable serialization support" OFF)
if (IGATOOLS_WITH_SERIALIZATION)
message("-- Serialization support (EXPERIMENTAL) with CEREAL library is enabled.")
else(IGATOOLS_WITH_SERIALIZATION)
message("-- Serialization support (EXPERIMENTAL) is not enabled.")
endif(IGATOOLS_WITH_SERIALIZATION)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(IGATOOLS_WITH_PARAVIEW_PLUGIN "Enable the building of the ParaView plugin" OFF)
if (IGATOOLS_WITH_PARAVIEW_PLUGIN)
if (NOT IGATOOLS_WITH_SERIALIZATION)
message (FATAL_ERROR "IGATOOLS_WITH_PARAVIEW_PLUGIN variable set to ON is not "
"compatible with IGATOOLS_WITH_SERIALIZATION set to OFF. Serialization must be "
"activated.")
endif ()
message("-- Paraview plugin building (EXPERIMENTAL) is enabled.")
else(IGATOOLS_WITH_PARAVIEW_PLUGIN)
message("-- Paraview plugin building (EXPERIMENTAL) is not enabled.")
endif(IGATOOLS_WITH_PARAVIEW_PLUGIN)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(IGATOOLS_WITH_XML_IO "Enable XML I/O support" OFF)
if (IGATOOLS_WITH_XML_IO)
find_xercesc()
if (XERCESC_FOUND)
message("-- XML I/O support (EXPERIMENTAL) is enabled.")
else(XERCESC_FOUND)
message(FATAL_ERROR "XML I/O support (EXPERIMENTAL) is enabled but Xerces-C is NOT FOUND.")
endif(XERCESC_FOUND)
else(IGATOOLS_WITH_XML_IO)
message("-- XML I/O support (EXPERIMENTAL) is not enabled.")
endif(IGATOOLS_WITH_XML_IO)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(USE_VTK "Enable VTK support" OFF)
if (USE_VTK)
find_package(VTK REQUIRED)
if (VTK_FOUND)
include(${VTK_USE_FILE})
message("-- VTK support (EXPERIMENTAL) is enabled.")
else(VTK_FOUND)
message(FATAL_ERROR "VTK support (EXPERIMENTAL) is enabled but the VTK library is NOT FOUND.")
endif(VTK_FOUND)
else(USE_VTK)
message("-- VTK support (EXPERIMENTAL) is not enabled.")
endif(USE_VTK)
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
option(USE_CGAL "Enable CGAL support" OFF)
if (USE_CGAL)
find_cgal()
if (CGAL_FOUND)
# include(${CGAL_USE_FILE})
message("-- CGAL support (EXPERIMENTAL) is enabled.")
else(CGAL_FOUND)
message(FATAL_ERROR "CGAL support (EXPERIMENTAL) is enabled but the CGAL library is NOT FOUND.")
endif(CGAL_FOUND)
else(USE_CGAL)
message("-- CGAL support (EXPERIMENTAL) is not enabled.")
endif(USE_CGAL)
#-------------------------------------------------------------------------------
option(use_other_templates "Enable a mechanism to use uninstantiated templates" ON)
option(submit_test "Allow test submition" OFF)
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Find Required libraries
#
find_boost()
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Find optional libraries
if (IGATOOLS_USES_TRILINOS)
find_trilinos()
endif()
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Compiler and compile flags
if(CMAKE_BUILD_TYPE MATCHES Release)
message("-- IGATOOLS build type: RELEASE")
else ()
message("-- IGATOOLS build type: DEBUG")
endif()
init_cxx_flags()
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# bases dimensions and ranks to compile the library for
#
set(dim CACHE STRINGS "list of domain dimensions")
set(codim CACHE STRINGS "list of domain codimension")
set(range CACHE STRINGS "list of reference basis range dim")
set(rank CACHE STRINGS "list of reference basis rank")
set(trans_type CACHE STRINGS "list of transformation type")
set(max_der_order 2 CACHE STRINGS "maximum order of derivatives")
set(num_sub_elem 1 CACHE STRINGS "number of sub element to consider 1 for faces")
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Configuration of the library
#
set(iga_lib_name igatools)
# igatools source files
#set (source_dirs base utils geometry basis_functions linear_algebra io contrib functions)
set (source_dirs base utils geometry basis_functions linear_algebra functions io operators)
#set (source_dirs base utils geometry linear_algebra functions)
foreach(dir ${source_dirs})
file(GLOB source ${PROJECT_SOURCE_DIR}/source/${dir}/*.cpp)
list(APPEND source_files ${source})
endforeach()
# igatools include directories
if (IGATOOLS_WITH_SERIALIZATION)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include/igatools/contrib/cereal/include
${CMAKE_CURRENT_BINARY_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include/igatools/contrib/cereal/include )
else (IGATOOLS_WITH_SERIALIZATION)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include)
endif(IGATOOLS_WITH_SERIALIZATION)
# the igatools library target
add_library(${iga_lib_name} SHARED ${source_files})
target_link_libraries(${iga_lib_name}
${Trilinos_TPL_LIBRARIES}
${Trilinos_LIBRARIES}
${Petsc_LIBRARIES}
${XERCESC_LIBRARIES}
${Boost_LIBRARIES}
${VTK_LIBRARIES}
${CGAL_LIBRARIES})
set_property(TARGET ${iga_lib_name} PROPERTY VERSION ${IGATOOLS_VERSION})
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Generate configure dependent source files (in the build directory)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/${iga_lib_name}/base/config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/include/${iga_lib_name}/base/config.h")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/${iga_lib_name}Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${iga_lib_name}Config.cmake @ONLY)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/${iga_lib_name}ConfigVersion.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${iga_lib_name}ConfigVersion.cmake @ONLY)
# Create the instantiation files
message("Configuring instantiations")
create_basis_table()
generate_instantiations()
generate_serial()
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Create install target
create_install_target(${use_other_templates})
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Create target to generate documentation
create_doc_target()
#
#-------------------------------------------------------------------------------
## #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## # ParaView plugin section
## if (IGATOOLS_WITH_PARAVIEW_PLUGIN)
## add_subdirectory(${PROJECT_SOURCE_DIR}/addons/paraview_plugin)
## endif()
## #
## #-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Tutorial example section
add_subdirectory(${PROJECT_SOURCE_DIR}/tutorial)
#
#-------------------------------------------------------------------------------
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Unit Test configuration
add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
#
#-------------------------------------------------------------------------------
print_final_message()