-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
458 lines (399 loc) · 19.2 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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# Copyright (C) 2015-2024 CEA, EDF
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : [email protected]
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
# Project name
# ============
# original
PROJECT(MEDCoupling C CXX)
# upper case
STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.3)
cmake_policy(SET CMP0057 NEW)
IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.13)
cmake_policy(SET CMP0078 OLD)
ENDIF()
IF (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.14)
cmake_policy(SET CMP0086 OLD)
ENDIF()
ENDIF()
# Common CMake macros
SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake files")
IF(EXISTS ${CONFIGURATION_ROOT_DIR})
LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
INCLUDE(SalomeMacros NO_POLICY_SCOPE)
ELSE()
MESSAGE(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
ENDIF()
# Versioning
# ===========
SALOME_SETUP_VERSION(9.13.0)
MESSAGE(STATUS "Building ${PROJECT_NAME_UC} ${${PROJECT_NAME_UC}_VERSION} from \"${${PROJECT_NAME_UC}_GIT_SHA1}\"")
# Platform setup
# ==============
INCLUDE(SalomeSetupPlatform)
# [ABN]: use the below for aggressive code quality check:
#if( EXISTS "aaaa")
# add_definitions(-Weverything)
# add_definitions(-Wno-inconsistent-missing-override)
# add_definitions(-Wno-c++98-compat -Wno-c++98-compat-pedantic)
# add_definitions(-Wsign-conversion)
# add_definitions(-Wno-switch-enum)
#
# add_definitions(-Wno-documentation-unknown-command) # \image in Doxygen
# add_definitions(-Wno-gnu-statement-expression) # assert(...)
#
# add_definitions(-Wno-reserved-id-macro -Wno-padded -Wno-weak-vtables -Wdouble-promotion -Wno-comma -Wno-unused-parameter)
# add_definitions(-Wno-unreachable-code-break -Wno-old-style-cast -Wno-deprecated -Wno-double-promotion)
# add_definitions(-Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes)
# add_definitions(-Wno-covered-switch-default -Wno-weak-template-vtables -Wno-undefined-func-template -Wno-used-but-marked-unused)
# add_definitions(-Wno-unreachable-code-return -Wno-missing-noreturn -Wno-unused-member-function -Wno-header-hygiene)
# add_definitions(-Wno-ignored-qualifiers) # because of MED-file
# add_definitions(-Wno-unused-function -Wno-unused-macros)
# add_definitions(-Wno-missing-field-initializers)
# add_definitions(-Wno-shadow) # SWIG generates a lot of those ...
#
# add_definitions(-Wno-float-equal) # OUCH
#endif()
#
# User options
# ============
INCLUDE(CMakeDependentOption)
OPTION(MEDCOUPLING_MICROMED "Build MED without MED file dependency." OFF)
OPTION(MEDCOUPLING_ENABLE_PYTHON "Build PYTHON bindings." ON)
OPTION(MEDCOUPLING_ENABLE_PARTITIONER "Build MEDPartitioner." ON)
OPTION(MEDCOUPLING_ENABLE_RENUMBER "Build Renumber." ON)
OPTION(MEDCOUPLING_ENABLE_SHAPERECOGN "Build Shape Recognition module." OFF)
OPTION(MEDCOUPLING_WITH_FILE_EXAMPLES "Install examples of files containing meshes and fields of different formats." ON)
OPTION(MEDCOUPLING_USE_MPI "(Use MPI containers) - For MED this triggers the build of ParaMEDMEM." OFF)
OPTION(MEDCOUPLING_BUILD_TESTS "Build MEDCoupling C++ tests." ON)
OPTION(MEDCOUPLING_BUILD_PY_TESTS "Build MEDCoupling Python tests." ON)
OPTION(MEDCOUPLING_BUILD_DOC "Build MEDCoupling doc." ON)
OPTION(MEDCOUPLING_BUILD_STATIC "Build MEDCoupling library in static mode." OFF)
OPTION(MEDCOUPLING_USE_64BIT_IDS "Size of IDs to refer cells and nodes. 32 bits when OFF (default), 64 bits when ON." ON)
IF(${MEDCOUPLING_USE_MPI})
SET(USE_METIS_NOT_PARMETIS OFF)
ELSE()
SET(USE_METIS_NOT_PARMETIS ON)
ENDIF()
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_METIS "Enable metis graph library in MEDPartitioner." ${USE_METIS_NOT_PARMETIS}
"MEDCOUPLING_ENABLE_PARTITIONER" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_SCOTCH "Enable scotch graph library in MEDPartitioner." ON
"MEDCOUPLING_ENABLE_PARTITIONER" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_PARMETIS "Enable parmetis graph library in MEDPartitioner." ON
"MEDCOUPLING_ENABLE_PARTITIONER;MEDCOUPLING_USE_MPI" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_PARTITIONER_PTSCOTCH "Enable ptscotch graph library in MEDPartitioner." ON
"MEDCOUPLING_ENABLE_PARTITIONER;MEDCOUPLING_USE_MPI" OFF)
SET(XDR_DEFAULT_OPTION ON)
IF(WIN32)
SET(XDR_DEFAULT_OPTION OFF)
ENDIF()
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_MEDLOADER_USE_XDR "Enable use of XDR for SauvReader." ${XDR_DEFAULT_OPTION} "NOT MEDCOUPLING_MICROMED" OFF)
CMAKE_DEPENDENT_OPTION(MEDCOUPLING_BUILD_FRENCH_DOC "Generate MEDCOUPLING French documentation" OFF
"MEDCOUPLING_BUILD_DOC" OFF)
IF(MEDCOUPLING_BUILD_STATIC)
SET(BUILD_SHARED_LIBS 0)
SET(CMAKE_POSITION_INDEPENDENT_CODE 1) # -fPIC option
ELSE(MEDCOUPLING_BUILD_STATIC)
SET(BUILD_SHARED_LIBS 1)
ENDIF(MEDCOUPLING_BUILD_STATIC)
IF(${MEDCOUPLING_PARTITIONER_PARMETIS} AND ${MEDCOUPLING_PARTITIONER_METIS})
MESSAGE(FATAL_ERROR "ParMetis and Metis are mutually exclusive! Make a choice (options MEDCOUPLING_PARTITIONER_METIS and MEDCOUPLING_PARTITIONER_PARMETIS).")
ENDIF(${MEDCOUPLING_PARTITIONER_PARMETIS} AND ${MEDCOUPLING_PARTITIONER_METIS})
IF(${MEDCOUPLING_PARTITIONER_PTSCOTCH} AND ${MEDCOUPLING_PARTITIONER_SCOTCH})
MESSAGE(FATAL_ERROR "PTScotch and Scotch are mutually exclusive! Make a choice (options MEDCOUPLING_PARTITIONER_SCOTCH and MEDCOUPLING_PARTITIONER_PTSCOTCH).")
ENDIF(${MEDCOUPLING_PARTITIONER_PTSCOTCH} AND ${MEDCOUPLING_PARTITIONER_SCOTCH})
#
# Set list of prerequisites
# =========================
IF(NOT MEDCOUPLING_MICROMED)
FIND_PACKAGE(SalomeHDF5 REQUIRED)
FIND_PACKAGE(SalomeMEDFile REQUIRED)
# XDR stuff
IF(MEDCOUPLING_MEDLOADER_USE_XDR)
FIND_PACKAGE(SalomeXDR REQUIRED)
ENDIF(MEDCOUPLING_MEDLOADER_USE_XDR)
# End of XDR Stuff
IF(MEDCOUPLING_ENABLE_PARTITIONER)
FIND_PACKAGE(SalomeLibXml2)
SALOME_LOG_OPTIONAL_PACKAGE(LibXml2 MEDCOUPLING_ENABLE_PARTITIONER)
IF(MEDCOUPLING_PARTITIONER_METIS)
FIND_PACKAGE(SalomeMetis)
SALOME_LOG_OPTIONAL_PACKAGE(Metis MEDCOUPLING_PARTITIONER_METIS)
IF(SalomeMetis_FOUND)
ADD_DEFINITIONS("-DMED_ENABLE_METIS")
ENDIF()
ENDIF(MEDCOUPLING_PARTITIONER_METIS)
IF(MEDCOUPLING_PARTITIONER_SCOTCH)
FIND_PACKAGE(SalomeScotch)
SALOME_LOG_OPTIONAL_PACKAGE(Scotch MEDCOUPLING_PARTITIONER_SCOTCH)
IF(SalomeScotch_FOUND)
ADD_DEFINITIONS("-DMED_ENABLE_SCOTCH")
ENDIF()
ENDIF(MEDCOUPLING_PARTITIONER_SCOTCH)
ENDIF(MEDCOUPLING_ENABLE_PARTITIONER)
ENDIF(NOT MEDCOUPLING_MICROMED)
ENABLE_TESTING() # let it outsite because even if MEDCOUPLING_BUILD_TESTS is OFF, python tests that not need additional compilation can be run.
IF(MEDCOUPLING_BUILD_TESTS)
FIND_PACKAGE(SalomeCppUnit)
SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
ENDIF(MEDCOUPLING_BUILD_TESTS)
IF(MEDCOUPLING_USE_MPI)
FIND_PACKAGE(SalomeMPI REQUIRED)
# Used when exporting configuration:
SET(MEDCOUPLING_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
SET(MEDCOUPLING_MPI_CXX_COMPILER "${MPI_CXX_COMPILER}") # Might not always be set even if MPI there ...
SET(MEDCOUPLING_MPI_CXX_LIBRARIES "${MPI_CXX_LIBRARIES}")
ADD_DEFINITIONS("-DHAVE_MPI")
SALOME_ADD_MPI_TO_HDF5()
IF(MEDCOUPLING_PARTITIONER_PARMETIS)
FIND_PACKAGE(SalomeParMetis)
SALOME_LOG_OPTIONAL_PACKAGE(ParMetis MEDCOUPLING_PARTITIONER_PARMETIS)
IF (SalomeParMetis_FOUND)
ADD_DEFINITIONS("-DMED_ENABLE_PARMETIS")
ENDIF()
ENDIF(MEDCOUPLING_PARTITIONER_PARMETIS)
IF(MEDCOUPLING_PARTITIONER_PTSCOTCH)
FIND_PACKAGE(SalomePTScotch)
SALOME_LOG_OPTIONAL_PACKAGE(PTScotch MEDCOUPLING_PARTITIONER_PTSCOTCH)
IF(SalomePTScotch_FOUND)
ADD_DEFINITIONS("-DMED_ENABLE_PTSCOTCH")
ENDIF(SalomePTScotch_FOUND)
ENDIF(MEDCOUPLING_PARTITIONER_PTSCOTCH)
ENDIF(MEDCOUPLING_USE_MPI)
IF(MEDCOUPLING_ENABLE_RENUMBER)
FIND_PACKAGE(SalomeBoost)
SALOME_LOG_OPTIONAL_PACKAGE(Boost MEDCOUPLING_ENABLE_RENUMBER)
ENDIF(MEDCOUPLING_ENABLE_RENUMBER)
IF(MEDCOUPLING_ENABLE_SHAPERECOGN)
IF(UNIX)
SET(CBLAS_ROOT_DIR $ENV{CBLAS_ROOT_DIR} CACHE PATH "Path to the LAPACK/CBLAS.")
IF(CBLAS_ROOT_DIR)
LIST(APPEND CMAKE_PREFIX_PATH "${CBLAS_ROOT_DIR}")
FIND_PACKAGE(CBLAS REQUIRED)
ELSE(CBLAS_ROOT_DIR)
FIND_PACKAGE(BLAS REQUIRED)
ENDIF(CBLAS_ROOT_DIR)
SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACKE")
IF(LAPACK_ROOT_DIR)
SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.")
LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
ENDIF(LAPACK_ROOT_DIR)
FIND_PACKAGE(LAPACK REQUIRED)
FIND_LIBRARY(LAPACKE_LIB NAMES lapacke REQUIRED)
SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${CBLAS_LIBRARIES})
FIND_PATH(LAPACKE_INCLUDE_DIRS NAMES lapacke.h HINTS ${LAPACK_LIBRARIES})
IF(LAPACK_FOUND)
MESSAGE(STATUS "Lapacke libraries: ${LAPACK_LIBRARIES}")
MESSAGE(STATUS "Lapacke include dirs: ${LAPACKE_INCLUDE_DIRS}")
ELSE()
MESSAGE(FATAL_ERROR "Error in Lapacke detection ! lapacke not found !")
ENDIF(LAPACK_FOUND)
SALOME_LOG_OPTIONAL_PACKAGE(Lapack MEDCOUPLING_ENABLE_SHAPERECOGN)
ELSEIF (MSVC)
SET(OPENBLAS_ROOT_DIR $ENV{OPENBLAS_ROOT_DIR} CACHE PATH "Path to the OpenBLAS.")
IF(OPENBLAS_ROOT_DIR)
LIST(APPEND CMAKE_PREFIX_PATH "${OPENBLAS_ROOT_DIR}")
FIND_PACKAGE(OpenBLAS REQUIRED)
ELSE(OPENBLAS_ROOT_DIR)
MESSAGE(FATAL "Could not find OpenBLAS")
ENDIF(OPENBLAS_ROOT_DIR)
SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACKE")
IF(LAPACK_ROOT_DIR)
SET(LAPACK_ROOT_DIR $ENV{LAPACK_ROOT_DIR} CACHE PATH "Path to the LAPACK.")
LIST(APPEND CMAKE_PREFIX_PATH "${LAPACK_ROOT_DIR}")
ENDIF(LAPACK_ROOT_DIR)
FIND_PACKAGE(LAPACK REQUIRED)
FIND_LIBRARY(LAPACKE_LIB NAMES openblas REQUIRED)
SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
FIND_PATH(LAPACKE_INCLUDE_DIRS NAMES lapacke.h HINTS ${LAPACK_LIBRARIES})
IF(LAPACK_FOUND)
MESSAGE(STATUS "Lapacke libraries: ${LAPACK_LIBRARIES}")
MESSAGE(STATUS "Lapacke include dirs: ${LAPACKE_INCLUDE_DIRS}")
ELSE()
MESSAGE(FATAL_ERROR "Error in Lapacke detection ! lapacke not found !")
ENDIF(LAPACK_FOUND)
SALOME_LOG_OPTIONAL_PACKAGE(Lapack MEDCOUPLING_ENABLE_SHAPERECOGN)
ElSE()
MESSAGE(FATAL "Not implemented")
ENDIF()
ENDIF(MEDCOUPLING_ENABLE_SHAPERECOGN)
IF(MEDCOUPLING_ENABLE_PYTHON)
FIND_PACKAGE(SalomePythonInterp)
FIND_PACKAGE(SalomePythonLibs)
FIND_PACKAGE(SalomeNumPySciPy)
FIND_PACKAGE(SalomeSWIG)
SALOME_LOG_OPTIONAL_PACKAGE(PythonInterp MEDCOUPLING_ENABLE_PYTHON)
SALOME_LOG_OPTIONAL_PACKAGE(PythonLibs MEDCOUPLING_ENABLE_PYTHON)
SALOME_LOG_OPTIONAL_PACKAGE(SWIG MEDCOUPLING_ENABLE_PYTHON)
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "2")
IF("${PYTHON_VERSION_MINOR}" LESS "7")
MESSAGE(FATAL_ERROR "MEDCoupling's Python requires at least Python 2.7 (you seem to have ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}). Upgrade your Python, or turn off MEDCOUPLING_ENABLE_PYTHON")
ENDIF()
ENDIF()
IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
MESSAGE(STATUS "Using Python 3")
ENDIF()
IF ("${SWIG_VERSION}" VERSION_GREATER_EQUAL "4")
SET(MEDCOUPLING_SWIG4_COMPAT TRUE CACHE BOOL "SWIG 4 compatibility (experimental)")
ELSE()
SET(MEDCOUPLING_SWIG4_COMPAT FALSE)
ENDIF()
IF(MEDCOUPLING_SWIG4_COMPAT)
LIST(APPEND CMAKE_SWIG_FLAGS "-DMEDCOUPLING_SWIG4_COMPAT")
ENDIF()
ENDIF(MEDCOUPLING_ENABLE_PYTHON)
IF(MEDCOUPLING_BUILD_DOC)
FIND_PACKAGE(SalomeDoxygen)
FIND_PACKAGE(SalomeGraphviz)
FIND_PACKAGE(SalomeSphinx)
SALOME_LOG_OPTIONAL_PACKAGE(Doxygen MEDCOUPLING_BUILD_DOC)
SALOME_LOG_OPTIONAL_PACKAGE(Graphviz MEDCOUPLING_BUILD_DOC)
SALOME_LOG_OPTIONAL_PACKAGE(Sphinx MEDCOUPLING_BUILD_DOC)
ENDIF(MEDCOUPLING_BUILD_DOC)
# Detection report
SALOME_PACKAGE_REPORT_AND_CHECK()
# Directories
#
# Directories have to be given after prerequisites (to be able to use
# Python version string for example).
# ===========
SET(MEDCOUPLING_INSTALL_BINS bin CACHE PATH "Install path: MEDCoupling binaries")
SET(MEDCOUPLING_INSTALL_LIBS lib CACHE PATH "Install path: MEDCoupling libs")
SET(MEDCOUPLING_INSTALL_HEADERS include CACHE PATH "Install path: MEDCoupling headers")
SET(MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS ${MEDCOUPLING_INSTALL_BINS} CACHE PATH "Install path: MEDCoupling scripts")
SET(MEDCOUPLING_INSTALL_TESTS tests CACHE PATH "Install path: MEDCoupling tests")
# SET(MEDCOUPLING_INSTALL_SCRIPT_DATA ${MEDCOUPLING_INSTALL_BINS} CACHE PATH "Install path: MEDCoupling script data")
SET(MEDCOUPLING_INSTALL_SCRIPT_PYTHON ${MEDCOUPLING_INSTALL_BINS} CACHE PATH "Install path: MEDCoupling Python scripts")
SET(MEDCOUPLING_INSTALL_CMAKE_LOCAL cmake_files CACHE PATH "Install path: local MEDCoupling CMake files")
IF(MEDCOUPLING_ENABLE_PYTHON)
SET(_pydir lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages)
SET(MEDCOUPLING_INSTALL_PYTHON ${_pydir} CACHE PATH "Install path: MEDCoupling Python stuff")
SET(MEDCOUPLING_INSTALL_PYTHON_SHARED ${MEDCOUPLING_INSTALL_PYTHON}/shared_modules CACHE PATH
"Install path: MEDCoupling Python shared modules")
ENDIF(MEDCOUPLING_ENABLE_PYTHON)
SET(MEDCOUPLING_INSTALL_RES share/resources CACHE PATH "Install path: MEDCoupling resources")
SET(MEDCOUPLING_INSTALL_DOC share/doc CACHE PATH "Install path: MEDCoupling documentation")
# Med specific:
SET(MEDCOUPLING_INSTALL_RES_DATA "${MEDCOUPLING_INSTALL_RES}/med" CACHE PATH "Install path: MEDCoupling specific data")
#SET(MEDCOUPLING_INSTALL_RES_SCRIPTS "${MEDCOUPLING_INSTALL_RES}/med" CACHE PATH "Install path: MEDCouplng specific scripts")
MARK_AS_ADVANCED(MEDCOUPLING_INSTALL_BINS MEDCOUPLING_INSTALL_LIBS MEDCOUPLING_INSTALL_IDLS MEDCOUPLING_INSTALL_HEADERS)
MARK_AS_ADVANCED(MEDCOUPLING_INSTALL_SCRIPT_SCRIPTS MEDCOUPLING_INSTALL_SCRIPT_DATA MEDCOUPLING_INSTALL_SCRIPT_PYTHON)
MARK_AS_ADVANCED(MEDCOUPLING_INSTALL_APPLISKEL_SCRIPTS MEDCOUPLING_INSTALL_APPLISKEL_PYTHON MEDCOUPLING_INSTALL_CMAKE MEDCOUPLING_INSTALL_CMAKE_LOCAL MEDCOUPLING_INSTALL_RES)
MARK_AS_ADVANCED(MEDCOUPLING_INSTALL_PYTHON MEDCOUPLING_INSTALL_PYTHON_SHARED MEDCOUPLING_INSTALL_RES_DATA MEDCOUPLING_INSTALL_DOC)
# Header configuration
# ====================
SALOME_CONFIGURE_FILE(MEDCoupling_version.h.in MEDCoupling_version.h INSTALL ${MEDCOUPLING_INSTALL_HEADERS})
# Accumulate environment variables for MED module
#SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${MEDCOUPLING_INSTALL_BINS}
# ${CMAKE_INSTALL_PREFIX}/${MEDCOUPLING_INSTALL_PYTHON})
#SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${MEDCOUPLING_INSTALL_LIBS})
# Sources
# ========
IF(WIN32)
ADD_DEFINITIONS("-D_USE_MATH_DEFINES")
ENDIF(WIN32)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
IF(MEDCOUPLING_ENABLE_PYTHON AND NUMPY_FOUND)
ADD_DEFINITIONS( "-DNPY_NO_DEPRECATED_API" )
ENDIF(MEDCOUPLING_ENABLE_PYTHON AND NUMPY_FOUND)
ADD_SUBDIRECTORY(src)
IF(MEDCOUPLING_BUILD_DOC)
ADD_SUBDIRECTORY(doc)
ENDIF(MEDCOUPLING_BUILD_DOC)
ADD_SUBDIRECTORY(resources)
IF(MEDCOUPLING_ENABLE_PYTHON)
ADD_SUBDIRECTORY(v8_work)
ENDIF()
# Configuration export
# ====================
INCLUDE(CMakePackageConfigHelpers)
# List of targets in this project we want to make visible to the rest of the world.
# They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup"
SET(_${PROJECT_NAME}_exposed_targets
interpkernel medcouplingcpp medcouplingremapper medicoco)
IF(NOT MEDCOUPLING_MICROMED)
LIST(APPEND _${PROJECT_NAME}_exposed_targets medloader)
IF(MEDCOUPLING_ENABLE_RENUMBER)
LIST(APPEND _${PROJECT_NAME}_exposed_targets renumbercpp)
ENDIF()
IF(MEDCOUPLING_ENABLE_PARTITIONER)
LIST(APPEND _${PROJECT_NAME}_exposed_targets medpartitionercpp)
IF(MEDCOUPLING_BUILD_TESTS)
LIST(APPEND _${PROJECT_NAME}_exposed_targets MEDPARTITIONERTest)
ENDIF()
ENDIF()
IF(MEDCOUPLING_BUILD_TESTS)
LIST(APPEND _${PROJECT_NAME}_exposed_targets InterpKernelTest InterpKernelTestUtils)
ENDIF()
ENDIF()
IF(MEDCOUPLING_USE_MPI)
LIST(APPEND _${PROJECT_NAME}_exposed_targets paramedmem)
IF(NOT MEDCOUPLING_MICROMED)
LIST(APPEND _${PROJECT_NAME}_exposed_targets paramedloader)
ENDIF()
IF(MEDCOUPLING_BUILD_TESTS)
IF(NOT MEDCOUPLING_MICROMED)
LIST(APPEND _${PROJECT_NAME}_exposed_targets ParaMEDMEMTest)
ENDIF()
ENDIF()
ENDIF()
IF(MEDCOUPLING_ENABLE_SHAPERECOGN)
LIST(APPEND _${PROJECT_NAME}_exposed_targets shaperecogn)
ENDIF(MEDCOUPLING_ENABLE_SHAPERECOGN)
# Add all targets to the build-tree export set
EXPORT(TARGETS ${_${PROJECT_NAME}_exposed_targets}
FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
# Create the configuration files:
# Ensure the variables are always defined for the configure (even if empty):
SET(MEDFILE_ROOT_DIR "${MEDFILE_ROOT_DIR}")
SET(MPI_ROOT_DIR "${MPI_ROOT_DIR}")
SET(BOOST_ROOT_DIR "${BOOST_ROOT_DIR}")
SET(SWIG_ROOT_DIR "${SWIG_ROOT_DIR}")
SET(PYTHON_ROOT_DIR "${PYTHON_ROOT_DIR}")
SET(CPPUNIT_ROOT_DIR "${CPPUNIT_ROOT_DIR}")
SET(GRAPHVIZ_ROOT_DIR "${GRAPHVIZ_ROOT_DIR}")
SET(DOXYGEN_ROOT_DIR "${DOXYGEN_ROOT_DIR}")
SET(SPHINX_ROOT_DIR "${SPHINX_ROOT_DIR}")
SET(METIS_ROOT_DIR "${METIS_ROOT_DIR}")
SET(PARMETIS_ROOT_DIR "${PARMETIS_ROOT_DIR}")
SET(SCOTCH_ROOT_DIR "${SCOTCH_ROOT_DIR}")
SET(XDR_ROOT_DIR "${XDR_ROOT_DIR}")
SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
SALOME_CONFIGURE_PREPARE(MEDFile MPI Boost Swig Python CppUnit Graphviz Doxygen Sphinx
Metis ParMetis Scotch XDR)
CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${MEDCOUPLING_INSTALL_CMAKE_LOCAL}"
PATH_VARS CONF_INCLUDE_DIRS MEDCOUPLING_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
MEDFILE_ROOT_DIR MPI_ROOT_DIR
BOOST_ROOT_DIR SWIG_ROOT_DIR PYTHON_ROOT_DIR CPPUNIT_ROOT_DIR GRAPHVIZ_ROOT_DIR DOXYGEN_ROOT_DIR
SPHINX_ROOT_DIR
METIS_ROOT_DIR PARMETIS_ROOT_DIR SCOTCH_ROOT_DIR XDR_ROOT_DIR)
WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${${PROJECT_NAME_UC}_VERSION}
COMPATIBILITY AnyNewerVersion)
# Install the CMake configuration files:
INSTALL(FILES
"${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake"
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${MEDCOUPLING_INSTALL_CMAKE_LOCAL}")
# Install the export set for use with the install-tree
INSTALL(EXPORT ${PROJECT_NAME}TargetGroup DESTINATION "${MEDCOUPLING_INSTALL_CMAKE_LOCAL}"
FILE ${PROJECT_NAME}Targets.cmake)