1 cmake_minimum_required (VERSION 3.1)
2 set(CMAKE_CXX_STANDARD 11)
3 set(CMAKE_CXX_STANDARD_REQUIRED ON)
6 project (SOLVERLAB C CXX)
7 set (SOLVERLAB_VERSION_MAJOR 0)
8 set (SOLVERLAB_VERSION_MINOR 1)
10 option (SOLVERLAB_WITH_DOCUMENTATION "Generate SOLVERLAB documentation" ON)
11 option (SOLVERLAB_WITH_PYTHON "Compile Python interface of SOLVERLAB" ON)
12 option (SOLVERLAB_WITH_GUI "Compile a Graphic user Interface for SOLVERLAB" OFF)
13 option (SOLVERLAB_WITH_PACKAGE "Generate RPM, Debian and tarball packages" OFF)
14 option (SOLVERLAB_WITH_COREFLOWS "Generate COREFLOWS module" ON)
15 option (SOLVERLAB_WITH_TESTS "Generate SOLVERLAB example tests" ON)
17 #Path to installed libraries
18 set (PETSC_DIR OFF CACHE STRING "PETSc library path" )
19 set (SLEPC_DIR OFF CACHE STRING "SLEPc library path" )
20 set (HDF5_ROOT OFF CACHE STRING "HDF5 library path" )#For the compilation of MED with a specific version of HDF5
21 set (MEDFILE_ROOT_DIR OFF CACHE STRING "MED library path" )
22 set (MEDCOUPLING_ROOT_DIR OFF CACHE STRING "MEDCoupling library path" )
23 set (PYTHON_ROOT_DIR OFF CACHE STRING "Python library path" )
25 #url of tarball librairies
26 set (DOWNLOAD_PETSC http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.14.0.tar.gz
27 CACHE STRING "PETSc tarball path/url" )
28 set (DOWNLOAD_SLEPC https://slepc.upv.es/download/distrib/slepc-3.14.0.tar.gz
29 CACHE STRING "SLEPC tarball path/url" )
30 set (DOWNLOAD_F2CBLASLAPACK https://www.mcs.anl.gov/petsc/mirror/externalpackages/f2cblaslapack-3.4.2.q4.tar.gz
31 CACHE STRING "F2CBLASLAPACK tarball path/url" )
32 set (DOWNLOAD_HDF5 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.3/src/hdf5-1.10.3.tar.gz
33 CACHE STRING "HDF5 tarball path/url" )
34 set (DOWNLOAD_MED http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz
35 CACHE STRING "MED tarball path/url")
36 set (DOWNLOAD_MEDCOUPLING http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz
37 CACHE STRING "MEDCoupling tarball path/url" )
39 set (CMAKE_BUILD_TYPE Release CACHE STRING "Installation mode")
41 list (APPEND CMAKE_MODULE_PATH "${SOLVERLAB_SOURCE_DIR}/cmake_files")
43 include(ExternalProject)#For PETSc, MED and MEDCoupling
45 set(Python_ROOT_DIR $ENV{PYTHON_ROOT_DIR} )
46 set(PARAVIEW_ROOT_DIR $ENV{PARAVIEW_ROOT_DIR} )
47 set(MATPLOTLIB_ROOT_DIR $ENV{MATPLOTLIB_ROOT_DIR} )
48 set(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} )
50 ######################################################
51 # Detection or compilation of PETSc+SLEPc+HDF5 #
52 ######################################################
53 if ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR)
55 set(PETSC_DIR $ENV{PETSC_DIR})
56 message ( STATUS "Checking variable PETSC_DIR : " $ENV{PETSC_DIR} )
58 message ( STATUS "Checking variable PETSC_DIR : " ${PETSC_DIR} )
61 find_package (PETSc 3.4 REQUIRED)
64 message ( STATUS "PETSc found. Version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" )
65 set(PETSC_INSTALL ${PETSC_DIR})
67 #Define and search slepc variables
69 if ( DEFINED ENV{SLEPC_DIR} )
70 set(SLEPC_DIR $ENV{SLEPC_DIR})
71 else ( DEFINED ENV{SLEPC_DIR} )
72 set(SLEPC_DIR ${PETSC_DIR}/${PETSC_ARCH})
73 endif( DEFINED ENV{SLEPC_DIR} )
76 message ( STATUS "Checking variable SLEPC_DIR" )
77 if ( IS_DIRECTORY ${SLEPC_DIR}/include AND EXISTS ${SLEPC_DIR}/lib/libslepc.so)
78 set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
79 set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so)
80 message( STATUS "SLEPc found at ${SLEPC_DIR}" )
82 message( FATAL_ERROR "SLEPc not found at ${SLEPC_DIR}" )
85 #define hdf5 variables
86 if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments
87 if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment
88 set(HDF5_ROOT $ENV{HDF5_ROOT})
89 else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
90 #HDF5 to be found in petsc external packages
91 set(HDF5_ROOT ${PETSC_DIR}/${PETSC_ARCH})# define hint for hdf5/med installation in petsc external packages
92 endif( DEFINED ENV{HDF5_ROOT} )
93 endif( NOT HDF5_ROOT )
94 set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib)
95 set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include)
96 else ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR )
97 message ( STATUS "PETSC_DIR not set, searching PETSc and SLEPc in the system" )
99 if ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) #Case fedora/redhat system install
100 message ( STATUS "PETSC includes found in /usr/include/petsc/" )
101 message ( STATUS "PETSC library found in /usr/lib64" )
103 set(PETSC_INCLUDES /usr/include/petsc /usr/include/petsc/petsc/mpiuni)
104 set(PETSC_LIBRARIES /usr/lib64/libpetsc.so)
106 set(PETSC_VERSION "3.8") #3.8 for fedora 26 , 3.9 for fedora 29 , 3.10 for fedora 30, , 3.12 for fedora 32
108 set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet.
109 set(PETSC_INSTALL ${PETSC_DIR})
111 #Define and search slepc variables
112 if ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" )
113 message( STATUS "SLEPc includes found in /usr/include/slepc/" )
114 message( STATUS "SLEPc library found in /usr/lib64/slepc/" )
116 set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
117 set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so)
118 set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet.
119 else ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" )
120 message( FATAL_ERROR "SLEPc not found in the system" )
121 endif( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" )
123 #HDF5 to be found in the system
124 if ( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
125 find_package(HDF5 REQUIRED)
126 set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhdf5-dev")
127 set(CPACK_RPM_PACKAGE_REQUIRES "hdf5-devel")
128 endif( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} )
130 #elseif ( IS_DIRECTORY "/usr/lib/petsc/include" AND EXISTS "/usr/lib/petsc/lib/libpetsc_real.so" ) #Case ubuntu/debian system install
131 # message ( STATUS "PETSc includes found in /usr/lib/petsc/include")
132 # message ( STATUS "PETSc library found in /usr/lib/petsc/lib/libpetsc_real.so")
133 # set(PETSC_DIR /usr/lib/petsc/)
134 # set(PETSC_INCLUDES ${PETSC_DIR}/include ${PETSC_DIR}/include/petsc/mpiuni)
135 # set(PETSC_LIBRARIES ${PETSC_DIR}/lib/libpetsc_real.so)
137 # find_package (PETSc 3.4 REQUIRED)
138 # petsc_get_version ()
139 # set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet.
141 # Define and search slepc variables
142 # if ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
143 # message( STATUS "SLEPc includes found in /usr/lib/slepc/include" )
144 # message( STATUS "SLEPc library found in /usr/lib/slepc/lib/libslepc_real.so" )
145 # set(SLEPC_DIR /usr/lib/slepc/)
146 # set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
147 # set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc_real.so)
148 # set (CPACK_DEBIAN_PACKAGE_REQUIRES "${CPACK_DEBIAN_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet.
149 # else ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
150 # message( FATAL_ERROR "SLEPc not found in the system" )
151 # endif( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
153 #elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install
155 else ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) # No petsc in system, do compile petsc along with slepc as an external package
156 message (STATUS "PETSC not found in the system")
157 message (STATUS "PETSC will be downloaded and compiled from ${DOWNLOAD_PETSC}" )
158 message (STATUS "SLEPC will be downloaded and compiled from ${DOWNLOAD_SLEPC}" )
159 message (STATUS "HDF5 will be downloaded and compiled from ${DOWNLOAD_HDF5}" )
161 #extract tarball name
162 string(LENGTH "${DOWNLOAD_PETSC}" tarball_url_length)#length of the tarball
163 string(FIND "${DOWNLOAD_PETSC}" "/" start_tarball_name REVERSE )# last occurence of "/"
164 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
165 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
166 string(SUBSTRING ${DOWNLOAD_PETSC} ${start_tarball_name} ${tarball_name_length} PETSC_TARBALL_NAME)
168 set(PETSC_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${PETSC_TARBALL_NAME}) # Location of the final install
169 set(PETSC_ARCH arch-linux-c-opt)
170 set(PETSC_INSTALL ${CMAKE_INSTALL_PREFIX}/share/petsc)#folder to copy petsc libraries and include files
172 ExternalProject_Add (PETSc
173 URL ${DOWNLOAD_PETSC}
174 SOURCE_DIR ${PETSC_DIR}
176 CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${PETSC_INSTALL} --with-debugging=0 --with-mpi=0 --download-f2cblaslapack=${DOWNLOAD_F2CBLASLAPACK} --with-fc=0 --download-slepc=${DOWNLOAD_SLEPC} --download-hdf5=${DOWNLOAD_HDF5}
177 BUILD_COMMAND make all
178 TEST_COMMAND make check
179 INSTALL_COMMAND make install
180 INSTALL_DIR ${PETSC_DIR}
181 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
182 LOG_DOWNLOAD TRUE # Wrap download in script to log output
183 LOG_UPDATE TRUE # Wrap update in script to log output
184 LOG_CONFIGURE TRUE # Wrap configure in script to log output
185 LOG_BUILD TRUE # Wrap build in script to log output
186 LOG_TEST TRUE # Wrap test in script to log output
187 LOG_INSTALL TRUE # Wrap install in script to log output
190 message( STATUS "PETSc, SLEPc and HDF5 will be installed at ${PETSC_INSTALL}")
192 string(LENGTH "${PETSC_TARBALL_NAME}" tarball_name_length)#length of the tarball
193 string(FIND "${PETSC_TARBALL_NAME}" "-" start_version_name REVERSE )# last occurence of "-"
194 MATH(EXPR start_version_name "${start_version_name}+1")#start after the occurence of "/"
195 string(SUBSTRING ${PETSC_TARBALL_NAME} ${start_version_name} ${tarball_name_length} PETSC_VERSION)
196 message( STATUS "PETSc version ${PETSC_VERSION} will be installed" )
198 set(PETSC_INCLUDES ${PETSC_DIR}/${PETSC_ARCH}/include ${PETSC_DIR}/include)
199 set(PETSC_LIBRARIES ${PETSC_DIR}/${PETSC_ARCH}/lib/libpetsc.so)
201 #define slepc variables
202 set(SLEPC_DIR ${PETSC_INSTALL})
203 set(SLEPC_INCLUDES ${SLEPC_DIR}/include ${PETSC_DIR}/${PETSC_ARCH}/externalpackages/slepc-3.13.4/include ${PETSC_DIR}/${PETSC_ARCH}/externalpackages/slepc-3.13.4/installed-arch-linux2-c-opt/include)
204 set(SLEPC_LIBRARIES ${PETSC_DIR}/${PETSC_ARCH}/externalpackages/slepc-3.13.4/installed-arch-linux2-c-opt/lib/libslepc.so)
205 message( STATUS "SLEPc includes ${SLEPC_INCLUDES}")
207 #define hdf5 variables
208 if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments
209 if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment
210 set(HDF5_ROOT $ENV{HDF5_ROOT})
211 else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
212 set(HDF5_ROOT ${PETSC_INSTALL})#HDF5 to be found in petsc installation
213 endif( DEFINED ENV{HDF5_ROOT} )
214 endif( NOT HDF5_ROOT )
215 set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib)
216 set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include)
218 endif ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" )
219 endif ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR )
221 if ( ${PETSC_VERSION} VERSION_GREATER 3.5 )
222 add_definitions(-DPETSC_VERSION_GREATER_3_5)
223 endif( ${PETSC_VERSION} VERSION_GREATER 3.5 )
225 string(REPLACE ";" ":" PETSC_INCLUDES_INSTALL "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_SOLVERLAB.sh
227 add_library(petsc SHARED IMPORTED)
228 set_property(TARGET petsc PROPERTY IMPORTED_LOCATION ${PETSC_LIBRARIES})
229 add_library(slepc SHARED IMPORTED)
230 set_property(TARGET slepc PROPERTY IMPORTED_LOCATION ${SLEPC_LIBRARIES})
232 ######################################################
233 # Detection or compilation of MEDFile #
234 ######################################################
235 if( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
237 if ( NOT MEDFILE_ROOT_DIR )
238 set(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} )
239 endif( NOT MEDFILE_ROOT_DIR )
241 find_package (MEDFile REQUIRED)
242 message (STATUS "MEDFile found in ${MEDFILE_ROOT_DIR}")
244 else( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
246 message(STATUS "MED will be downloaded and installed from ${DOWNLOAD_MED}")
248 set(MEDFILE_DEFINITIONS "-D${MACHINE} -DMEDFILE_INSTALL_DOC=OFF")#Comment ne pas compiler la doc ?
249 set(MEDFILE_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/med) # Location of the final install
251 #extraction of the tarball archive name
252 string(LENGTH "${DOWNLOAD_MED}" tarball_url_length)#length of the name of the tarball
253 string(FIND "${DOWNLOAD_MED}" "/" start_tarball_name REVERSE )# last occurence of "/"
254 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
255 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
256 string(SUBSTRING ${DOWNLOAD_MED} ${start_tarball_name} ${tarball_name_length} MED_TARBALL_NAME)
258 ExternalProject_Add (MED
259 URL ${DOWNLOAD_MED} #location of med tarball
260 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MED_TARBALL_NAME}
262 CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${MEDFILE_ROOT_DIR} --with-hdf5=${HDF5_ROOT} --with-hdf5-include=${HDF5_ROOT}/include --with-hdf5-lib=${HDF5_LIBRARY_DIR} --with-hdf5-bin=${HDF5_ROOT}/bin --with-swig=yes
264 INSTALL_COMMAND make install
265 INSTALL_DIR ${MEDFILE_ROOT_DIR}
266 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
267 LOG_DOWNLOAD TRUE # Wrap download in script to log output
268 LOG_UPDATE TRUE # Wrap update in script to log output
269 LOG_CONFIGURE TRUE # Wrap configure in script to log output
270 LOG_BUILD TRUE # Wrap build in script to log output
271 LOG_TEST TRUE # Wrap test in script to log output
272 LOG_INSTALL TRUE # Wrap install in script to log output
275 set(MEDFILE_INCLUDE_DIRS ${MEDFILE_ROOT_DIR}/include)# Nécessaire pour le medloader et les sous-dossiers mesh, et IJKMesh
276 set(MEDFILE_LIBRARIES ${MEDFILE_ROOT_DIR}/lib)# Nécessaire pour le env_SOLVERLAB.sh
277 set(MEDFILE_C_LIBRARIES med medC)# Nécessaire pour le medloader
279 endif( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
281 add_library(med SHARED IMPORTED)
282 set_property(TARGET med PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmed.so)
283 add_library(medC SHARED IMPORTED)
284 set_property(TARGET medC PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmedC.so)
286 string(REPLACE ";" ":" MEDFILE_LIBRARIES_INSTALL "${MEDFILE_LIBRARIES}")# use colon instead of semicolon in environment file env_SOLVERLAB.sh
288 ######################################################
289 # Detection or compilation of MEDCoupling #
290 ######################################################
291 if( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
293 if( NOT MEDCOUPLING_ROOT_DIR )
294 set(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} )
295 endif( NOT MEDCOUPLING_ROOT_DIR )
297 message (STATUS "Seeking MEDCoupling library in ${MEDCOUPLING_ROOT_DIR}")
299 if( NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so OR NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so OR NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/include/MEDCoupling.hxx)
300 message (FATAL_ERROR "MEDCoupling library not found in ${MEDCOUPLING_ROOT_DIR}")
301 else( NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so OR NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so OR NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/include/MEDCoupling.hxx)
302 message (STATUS "MEDCoupling library found in ${MEDCOUPLING_ROOT_DIR}")
303 endif( NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so OR NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so OR NOT EXISTS ${MEDCOUPLING_ROOT_DIR}/include/MEDCoupling.hxx)
305 else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
306 message(STATUS "MEDCoupling will be downloaded and installed from ${DOWNLOAD_MEDCOUPLING}")
307 set(MEDCOUPLING_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/medcoupling) # Location of the final install
308 SET(ENV{HDF5_ROOT} ${HDF5_ROOT})#MEDCoupling install process seems to require an environment variable
310 #extraction of the tarball archive name
311 string(LENGTH "${DOWNLOAD_MEDCOUPLING}" tarball_url_length)#length of the tarball
312 string(FIND "${DOWNLOAD_MEDCOUPLING}" "/" start_tarball_name REVERSE )# last occurence of "/"
313 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
314 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
315 string(SUBSTRING ${DOWNLOAD_MEDCOUPLING} ${start_tarball_name} ${tarball_name_length} MEDCOUPLING_TARBALL_NAME)
316 string(SUBSTRING ${MEDCOUPLING_TARBALL_NAME} 12 ${tarball_name_length} MEDCOUPLING_VERSION_NAME)
318 message(STATUS "MEDCoupling version is ${MEDCOUPLING_VERSION_NAME}")
320 ExternalProject_Add (MEDCoupling
321 URL ${DOWNLOAD_MEDCOUPLING} #location of medcoupling tarball
322 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MEDCOUPLING_TARBALL_NAME}
323 # BUILD_IN_SOURCE FALSE
324 CONFIGURE_COMMAND cmake <SOURCE_DIR>/${MEDCOUPLING_TARBALL_NAME} -DCMAKE_INSTALL_PREFIX=${MEDCOUPLING_ROOT_DIR} -DCONFIGURATION_ROOT_DIR=<SOURCE_DIR>/configuration-${MEDCOUPLING_VERSION_NAME} -DMEDFILE_ROOT_DIR=${MEDFILE_ROOT_DIR} -DMEDCOUPLING_ENABLE_PARTITIONER=OFF -DMEDCOUPLING_PARTITIONER_METIS=OFF -DMEDCOUPLING_PARTITIONER_SCOTCH=OFF -DMEDCOUPLING_ENABLE_RENUMBER=OFF -DMEDCOUPLING_BUILD_DOC=OFF -DHDF5_ROOT_DIR=${HDF5_ROOT}
326 INSTALL_COMMAND make install
327 INSTALL_DIR ${MEDCOUPLING_ROOT_DIR}
328 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
329 LOG_DOWNLOAD TRUE # Wrap download in script to log output
330 LOG_UPDATE TRUE # Wrap update in script to log output
331 LOG_CONFIGURE TRUE # Wrap configure in script to log output
332 LOG_BUILD TRUE # Wrap build in script to log output
333 LOG_TEST TRUE # Wrap test in script to log output
334 LOG_INSTALL TRUE # Wrap install in script to log output
337 endif( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR} )
339 set(MEDCOUPLING_INCLUDE_DIR ${MEDCOUPLING_ROOT_DIR}/include)
340 set(MEDCOUPLING_LIBRARIES ${MEDCOUPLING_ROOT_DIR}/lib )#for environment file env_SOLVERLAB.sh
342 add_library(medloader SHARED IMPORTED )
343 set_property(TARGET medloader PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so)
344 add_library(medcoupling SHARED IMPORTED )
345 set_property(TARGET medcoupling PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so)
347 if (TARGET MED AND TARGET PETSc)
348 ExternalProject_Add_StepDependencies( MED build PETSc )#PETSc doit être compilé avant MED car c'est PETSc qui compile HDF5
349 endif(TARGET MED AND TARGET PETSc)
351 if (TARGET MED AND TARGET MEDCoupling)
352 ExternalProject_Add_StepDependencies( MEDCoupling build MED )#MED doit être compilé avant MEDCoupling
353 endif(TARGET MED AND TARGET MEDCoupling)
355 if (TARGET PETSc AND TARGET MEDCoupling)
356 ExternalProject_Add_StepDependencies( MEDCoupling build PETSc )#PETSc doit être compilé avant MEDCoupling (car il contient hdf5)
357 endif(TARGET PETSc AND TARGET MEDCoupling)
363 # Paraview variables to choose python version and for env_SOLVERLAB.sh
364 if ( DEFINED PARAVIEW_VERSION OR DEFINED ENV{PARAVIEW_VERSION} )
365 if ( NOT DEFINED PARAVIEW_VERSION )
366 set( PARAVIEW_VERSION $ENV{PARAVIEW_VERSION})
367 endif( NOT DEFINED PARAVIEW_VERSION )
368 message(STATUS "ParaView version is ${PARAVIEW_VERSION}" )
369 else( DEFINED PARAVIEW_VERSION OR DEFINED ENV{PARAVIEW_VERSION} )
370 if ( DEFINED PARAVIEW_ROOT_DIR OR DEFINED ENV{PARAVIEW_ROOT_DIR})
371 if ( DEFINED PARAVIEW_ROOT_DIR )
372 set( PARAVIEW_INCLUDE_DIR ${PARAVIEW_ROOT_DIR}/include)
373 set( PARAVIEW_LIBRARIES_DIR ${PARAVIEW_ROOT_DIR}/lib)
374 else( DEFINED PARAVIEW_ROOT_DIR )
375 set( PARAVIEW_INCLUDE_DIR $ENV{PARAVIEW_ROOT_DIR}/include)
376 set( PARAVIEW_LIBRARIES_DIR $ENV{PARAVIEW_ROOT_DIR}/lib)
377 endif( DEFINED PARAVIEW_ROOT_DIR )
378 else( DEFINED PARAVIEW_ROOT_DIR OR DEFINED ENV{PARAVIEW_ROOT_DIR})
379 message(STATUS "PARAVIEW_VERSION and PARAVIEW_ROOT_DIR not set. Trying to detect paraview.")
380 set( PARAVIEW_INCLUDE_DIR /usr/include/paraview/)
381 set( PARAVIEW_LIBRARIES_DIR /usr/lib/paraview/:/usr/lib64/paraview/:/usr/lib64/vtk/:/usr/lib/vtk/)
382 endif( DEFINED PARAVIEW_ROOT_DIR OR DEFINED ENV{PARAVIEW_ROOT_DIR})
384 set( PARAVIEW_SUFFIXES paraview-5.0 paraview-5.1 paraview-5.2 paraview-5.3 paraview-5.4 paraview-5.5 paraview-5.6 paraview-5.7 paraview-5.8 paraview-5.9 )
385 find_file( vtkConfig_file vtkPVConfig.h HINTS ${PARAVIEW_INCLUDE_DIR} PATH_SUFFIXES ${PARAVIEW_SUFFIXES})
387 #extraction of the paraview version"
388 IF ( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" )
389 message(WARNING "Could not find ParaView configuration file vtkPVConfig.h in folder ${PARAVIEW_INCLUDE_DIR} and subdirectories ${PARAVIEW_SUFFIXES}. Postprocessing may not work")
390 set( PARAVIEW_VERSION "5.0")
391 ELSE ( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" )
392 message( STATUS "Found vtkPVConfig.h in ${vtkConfig_file}")
393 file(STRINGS ${vtkConfig_file} vtkConfig)
394 FOREACH(line ${vtkConfig})
395 string(FIND "${line}" "#define PARAVIEW_VERSION_FULL " pos)
396 IF(NOT ${pos} EQUAL -1)
397 string(LENGTH ${line} line_length)#length of the tarball
398 MATH(EXPR start_pv_version "${line_length}-6")#line ends with "x.y.z", that counts for 7 characters
399 string(SUBSTRING ${line} ${start_pv_version} 5 PARAVIEW_VERSION)
401 ENDIF(NOT ${pos} EQUAL -1)
402 ENDFOREACH(line ${vtkConfig})
403 message(STATUS "ParaView detected, version is ${PARAVIEW_VERSION}" )
404 ENDIF( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" )
405 endif( DEFINED PARAVIEW_VERSION OR DEFINED ENV{PARAVIEW_VERSION} )
408 IF ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 3, use VERSION_GREATER_EQUAL if cmake >=3.7
410 message(STATUS "PARAVIEW_VERSION greater than 5.6. We need python3 for postprocessing scripts.")
411 ELSE ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 2
413 message(STATUS "PARAVIEW_VERSION smaller than 5.6. We need python2 for postprocessing scripts.")
414 ENDIF( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )
417 IF ( PYTHON_ROOT_DIR OR ENV{PYTHON_ROOT_DIR})
418 IF ( PYTHON_ROOT_DIR )
419 set(Python_ROOT_DIR ${PYTHON_ROOT_DIR} )
420 ELSE( PYTHON_ROOT_DIR })
421 set(Python_ROOT_DIR $ENV{PYTHON_ROOT_DIR} )
422 ENDIF( PYTHON_ROOT_DIR })
423 ENDIF(PYTHON_ROOT_DIR OR ENV{PYTHON_ROOT_DIR})
425 IF (${CMAKE_VERSION} VERSION_GREATER "3.12.0")
426 find_package(Python ${PYTHON2OR3} REQUIRED COMPONENTS Interpreter Development )
427 SET(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
428 ELSE (${CMAKE_VERSION} VERSION_GREATER "3.12.0")
429 find_package(PythonInterp ${PYTHON2OR3} REQUIRED )
430 find_package(PythonLibs ${PYTHON2OR3} REQUIRED )
431 set(Python_LIBRARIES ${PYTHON_LIBRARIES})
432 set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
433 set(Python_VERSION ${PYTHON_VERSION_STRING})
434 set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
435 set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR})
436 ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.12.0")
438 #Paraview library paths
439 set (PV_LIB_DIR /usr/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/dist-packages/paraview/:/usr/lib64/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtk/:${PARAVIEW_LIBRARIES_DIR})
440 set (PV_PYTHON_DIR /usr/lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/dist-packages/paraview/:/usr/lib64/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtk/:/usr/lib64/paraview/site-packages/:/usr/lib64/paraview/site-packages/paraview/:/usr/lib64/paraview/site-packages/vtk/:/usr/lib64/paraview/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/:/usr/lib64/paraview/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/paraview/:/usr/lib64/paraview/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtkmodules:/usr/lib/paraview/site-packages/paraview:/usr/lib/paraview/site-packages/paraview/vtk:${PARAVIEW_LIBRARIES_DIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/vtkmodules/)
442 message(STATUS "Python version found is ${Python_VERSION}")
443 find_package (SWIG 3.0 REQUIRED)
445 if (SOLVERLAB_WITH_DOCUMENTATION) #
446 find_package (Doxygen) #
447 set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, doxygen, graphviz, mscgen")
448 set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, doxygen, graphviz, mscgen")
449 if (NOT DOXYGEN_FOUND)
450 message (FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly.")
451 endif(NOT DOXYGEN_FOUND)
453 if (SOLVERLAB_WITH_TESTS) #
455 find_package (CPPUNIT REQUIRED)
457 find_package (XDR REQUIRED)
459 # Enter subdirectories
460 add_subdirectory (CDMATH)
461 if(SOLVERLAB_WITH_COREFLOWS)
462 add_subdirectory (CoreFlows)
463 endif(SOLVERLAB_WITH_COREFLOWS)
467 ${PROJECT_SOURCE_DIR}/env_SOLVERLAB.sh
468 ${CMAKE_INSTALL_PREFIX}/env_SOLVERLAB.sh