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" )
24 #url of tarball librairies
25 set (DOWNLOAD_PETSC http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.13.5.tar.gz
26 CACHE STRING "PETSc tarball path/url" )
27 set (DOWNLOAD_SLEPC https://slepc.upv.es/download/distrib/slepc-3.13.4.tar.gz
28 CACHE STRING "SLEPC tarball path/url" )
29 set (DOWNLOAD_F2CBLASLAPACK https://www.mcs.anl.gov/petsc/mirror/externalpackages/f2cblaslapack-3.4.2.q4.tar.gz
30 CACHE STRING "F2CBLASLAPACK tarball path/url" )
31 set (DOWNLOAD_HDF5 https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.3/src/hdf5-1.10.3.tar.gz
32 CACHE STRING "HDF5 tarball path/url" )
33 set (DOWNLOAD_MED http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz
34 CACHE STRING "MED tarball path/url")
35 set (DOWNLOAD_MEDCOUPLING http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz
36 CACHE STRING "MEDCoupling tarball path/url" )
38 list (APPEND CMAKE_MODULE_PATH "${SOLVERLAB_SOURCE_DIR}/cmake_files")
39 include(ExternalProject)#For PETSc, MED and MEDCoupling
40 ######################################################
41 # Detection or compilation of PETSc+SLEPc+HDF5 #
42 ######################################################
43 if ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR)
45 set(PETSC_DIR $ENV{PETSC_DIR})
46 message ( STATUS "Checking variable PETSC_DIR : " $ENV{PETSC_DIR} )
48 message ( STATUS "Checking variable PETSC_DIR : " ${PETSC_DIR} )
51 find_package (PETSc 3.4 REQUIRED)
54 message ( STATUS "PETSc found. Version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" )
55 set(PETSC_INSTALL ${PETSC_DIR})
57 #Define and search slepc variables
59 if ( DEFINED ENV{SLEPC_DIR} )
60 set(SLEPC_DIR $ENV{SLEPC_DIR})
61 else ( DEFINED ENV{SLEPC_DIR} )
62 set(SLEPC_DIR ${PETSC_DIR}/${PETSC_ARCH})
63 endif( DEFINED ENV{SLEPC_DIR} )
66 message ( STATUS "Checking variable SLEPC_DIR" )
67 if ( IS_DIRECTORY ${SLEPC_DIR}/include AND EXISTS ${SLEPC_DIR}/lib/libslepc.so)
68 set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
69 set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so)
70 message( STATUS "SLEPc found at ${SLEPC_DIR}" )
72 message( FATAL_ERROR "SLEPc not found at ${SLEPC_DIR}" )
75 #define hdf5 variables
76 if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments
77 if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment
78 set(HDF5_ROOT $ENV{HDF5_ROOT})
79 else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
80 #HDF5 to be found in petsc external packages
81 set(HDF5_ROOT ${PETSC_DIR}/${PETSC_ARCH})# define hint for hdf5/med installation in petsc external packages
82 endif( DEFINED ENV{HDF5_ROOT} )
83 endif( NOT HDF5_ROOT )
84 set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib)
85 set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include)
86 else ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR )
87 message ( STATUS "PETSC_DIR not set, searching PETSc and SLEPc in the system" )
89 if ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) #Case fedora/redhat system install
90 message ( STATUS "PETSC includes found in /usr/include/petsc/" )
91 message ( STATUS "PETSC library found in /usr/lib64" )
93 set(PETSC_INCLUDES /usr/include/petsc /usr/include/petsc/petsc/mpiuni)
94 set(PETSC_LIBRARIES /usr/lib64/libpetsc.so)
96 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
98 set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet.
99 set(PETSC_INSTALL ${PETSC_DIR})
101 #Define and search slepc variables
102 if ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" )
103 message( STATUS "SLEPc includes found in /usr/include/slepc/" )
104 message( STATUS "SLEPc library found in /usr/lib64/slepc/" )
106 set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
107 set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so)
108 set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet.
109 else ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" )
110 message( FATAL_ERROR "SLEPc not found in the system" )
111 endif( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" )
113 #HDF5 to be found in the system
114 if ( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
115 find_package(HDF5 REQUIRED)
116 set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhdf5-dev")
117 set(CPACK_RPM_PACKAGE_REQUIRES "hdf5-devel")
118 endif( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} )
120 #elseif ( IS_DIRECTORY "/usr/lib/petsc/include" AND EXISTS "/usr/lib/petsc/lib/libpetsc_real.so" ) #Case ubuntu/debian system install
121 # message ( STATUS "PETSc includes found in /usr/lib/petsc/include")
122 # message ( STATUS "PETSc library found in /usr/lib/petsc/lib/libpetsc_real.so")
123 # set(PETSC_DIR /usr/lib/petsc/)
124 # set(PETSC_INCLUDES ${PETSC_DIR}/include ${PETSC_DIR}/include/petsc/mpiuni)
125 # set(PETSC_LIBRARIES ${PETSC_DIR}/lib/libpetsc_real.so)
127 # find_package (PETSc 3.4 REQUIRED)
128 # petsc_get_version ()
129 # set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet.
131 # Define and search slepc variables
132 # if ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
133 # message( STATUS "SLEPc includes found in /usr/lib/slepc/include" )
134 # message( STATUS "SLEPc library found in /usr/lib/slepc/lib/libslepc_real.so" )
135 # set(SLEPC_DIR /usr/lib/slepc/)
136 # set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
137 # set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc_real.so)
138 # set (CPACK_DEBIAN_PACKAGE_REQUIRES "${CPACK_DEBIAN_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet.
139 # else ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
140 # message( FATAL_ERROR "SLEPc not found in the system" )
141 # endif( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
143 #elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install
145 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
146 message (STATUS "PETSC not found in the system")
147 message (STATUS "PETSC will be downloaded and compiled from ${DOWNLOAD_PETSC}" )
148 message (STATUS "SLEPC will be downloaded and compiled from ${DOWNLOAD_SLEPC}" )
149 message (STATUS "HDF5 will be downloaded and compiled from ${DOWNLOAD_HDF5}" )
151 #extract tarball name
152 string(LENGTH "${DOWNLOAD_PETSC}" tarball_url_length)#length of the tarball
153 string(FIND "${DOWNLOAD_PETSC}" "/" start_tarball_name REVERSE )# last occurence of "/"
154 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
155 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
156 string(SUBSTRING ${DOWNLOAD_PETSC} ${start_tarball_name} ${tarball_name_length} PETSC_TARBALL_NAME)
158 set(PETSC_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${PETSC_TARBALL_NAME}) # Location of the final install
159 set(PETSC_ARCH arch-linux-c-opt)
160 set(PETSC_INSTALL ${CMAKE_INSTALL_PREFIX}/share/petsc)#folder to copy petsc libraries and include files
162 ExternalProject_Add (PETSc
163 URL ${DOWNLOAD_PETSC}
164 SOURCE_DIR ${PETSC_DIR}
166 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}
167 BUILD_COMMAND make all
168 TEST_COMMAND make check
169 INSTALL_COMMAND make install
170 INSTALL_DIR ${PETSC_DIR}
171 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
172 LOG_DOWNLOAD TRUE # Wrap download in script to log output
173 LOG_UPDATE TRUE # Wrap update in script to log output
174 LOG_CONFIGURE TRUE # Wrap configure in script to log output
175 LOG_BUILD TRUE # Wrap build in script to log output
176 LOG_TEST TRUE # Wrap test in script to log output
177 LOG_INSTALL TRUE # Wrap install in script to log output
180 message( STATUS "PETSc, SLEPc and HDF5 will be installed at ${PETSC_INSTALL}")
182 string(LENGTH "${PETSC_TARBALL_NAME}" tarball_name_length)#length of the tarball
183 string(FIND "${PETSC_TARBALL_NAME}" "-" start_version_name REVERSE )# last occurence of "-"
184 MATH(EXPR start_version_name "${start_version_name}+1")#start after the occurence of "/"
185 string(SUBSTRING ${PETSC_TARBALL_NAME} ${start_version_name} ${tarball_name_length} PETSC_VERSION)
186 message( STATUS "PETSc version ${PETSC_VERSION} will be installed" )
188 set(PETSC_INCLUDES ${PETSC_DIR}/${PETSC_ARCH}/include ${PETSC_DIR}/include)
189 set(PETSC_LIBRARIES ${PETSC_DIR}/${PETSC_ARCH}/lib/libpetsc.so)
191 #define slepc variables
192 set(SLEPC_DIR ${PETSC_INSTALL})
193 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)
194 set(SLEPC_LIBRARIES ${PETSC_DIR}/${PETSC_ARCH}/externalpackages/slepc-3.13.4/installed-arch-linux2-c-opt/lib/libslepc.so)
195 message( STATUS "SLEPc includes ${SLEPC_INCLUDES}")
197 #define hdf5 variables
198 if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments
199 if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment
200 set(HDF5_ROOT $ENV{HDF5_ROOT})
201 else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
202 set(HDF5_ROOT ${PETSC_INSTALL})#HDF5 to be found in petsc installation
203 endif( DEFINED ENV{HDF5_ROOT} )
204 endif( NOT HDF5_ROOT )
205 set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib)
206 set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include)
208 endif ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" )
209 endif ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR )
211 if ( ${PETSC_VERSION} VERSION_GREATER 3.5 )
212 add_definitions(-DPETSC_VERSION_GREATER_3_5)
213 endif( ${PETSC_VERSION} VERSION_GREATER 3.5 )
215 string(REPLACE ";" ":" PETSC_INCLUDES_INSTALL "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_CDMATH.sh
217 add_library(petsc SHARED IMPORTED)
218 set_property(TARGET petsc PROPERTY IMPORTED_LOCATION ${PETSC_LIBRARIES})
219 add_library(slepc SHARED IMPORTED)
220 set_property(TARGET slepc PROPERTY IMPORTED_LOCATION ${SLEPC_LIBRARIES})
222 ######################################################
223 # Detection or compilation of MEDFile #
224 ######################################################
225 if( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
227 if ( NOT MEDFILE_ROOT_DIR )
228 set(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} )
229 endif( NOT MEDFILE_ROOT_DIR )
231 find_package (MEDFile REQUIRED)
232 message (STATUS "MEDFile found in ${MEDFILE_ROOT_DIR}")
234 else( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
236 message(STATUS "MED will be downloaded and installed from ${DOWNLOAD_MED}")
238 set(MEDFILE_DEFINITIONS "-D${MACHINE} -DMEDFILE_INSTALL_DOC=OFF")#Comment ne pas compiler la doc ?
239 set(MEDFILE_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/med) # Location of the final install
241 #extraction of the tarball archive name
242 string(LENGTH "${DOWNLOAD_MED}" tarball_url_length)#length of the name of the tarball
243 string(FIND "${DOWNLOAD_MED}" "/" start_tarball_name REVERSE )# last occurence of "/"
244 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
245 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
246 string(SUBSTRING ${DOWNLOAD_MED} ${start_tarball_name} ${tarball_name_length} MED_TARBALL_NAME)
248 ExternalProject_Add (MED
249 URL ${DOWNLOAD_MED} #location of med tarball
250 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MED_TARBALL_NAME}
252 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
254 INSTALL_COMMAND make install
255 INSTALL_DIR ${MEDFILE_ROOT_DIR}
256 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
257 LOG_DOWNLOAD TRUE # Wrap download in script to log output
258 LOG_UPDATE TRUE # Wrap update in script to log output
259 LOG_CONFIGURE TRUE # Wrap configure in script to log output
260 LOG_BUILD TRUE # Wrap build in script to log output
261 LOG_TEST TRUE # Wrap test in script to log output
262 LOG_INSTALL TRUE # Wrap install in script to log output
265 set(MEDFILE_INCLUDE_DIRS ${MEDFILE_ROOT_DIR}/include)# Nécessaire pour le medloader et les sous-dossiers mesh, et IJKMesh
266 set(MEDFILE_LIBRARIES ${MEDFILE_ROOT_DIR}/lib)# Nécessaire pour le env_SOLVERLAB.sh
267 set(MEDFILE_C_LIBRARIES med medC)# Nécessaire pour le medloader
269 endif( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
271 add_library(med SHARED IMPORTED)
272 set_property(TARGET med PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmed.so)
273 add_library(medC SHARED IMPORTED)
274 set_property(TARGET medC PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmedC.so)
276 string(REPLACE ";" ":" MEDFILE_LIBRARIES_INSTALL "${MEDFILE_LIBRARIES}")# use colon instead of semicolon in environment file env_SOLVERLAB.sh
278 ######################################################
279 # Detection or compilation of MEDCoupling #
280 ######################################################
281 if( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
283 if( NOT MEDCOUPLING_ROOT_DIR )
284 set(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} )
285 endif( NOT MEDCOUPLING_ROOT_DIR )
287 message (STATUS "Seeking MEDCoupling library in ${MEDCOUPLING_ROOT_DIR}")
289 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)
290 message (FATAL_ERROR "MEDCoupling library not found in ${MEDCOUPLING_ROOT_DIR}")
291 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)
292 message (STATUS "MEDCoupling library found in ${MEDCOUPLING_ROOT_DIR}")
293 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)
295 else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
296 message(STATUS "MEDCoupling will be downloaded and installed from ${DOWNLOAD_MEDCOUPLING}")
297 set(MEDCOUPLING_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/medcoupling) # Location of the final install
298 SET(ENV{HDF5_ROOT} ${HDF5_ROOT})#MEDCoupling install process seems to require an environment variable
300 #extraction of the tarball archive name
301 string(LENGTH "${DOWNLOAD_MEDCOUPLING}" tarball_url_length)#length of the tarball
302 string(FIND "${DOWNLOAD_MEDCOUPLING}" "/" start_tarball_name REVERSE )# last occurence of "/"
303 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
304 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
305 string(SUBSTRING ${DOWNLOAD_MEDCOUPLING} ${start_tarball_name} ${tarball_name_length} MEDCOUPLING_TARBALL_NAME)
306 string(SUBSTRING ${MEDCOUPLING_TARBALL_NAME} 12 ${tarball_name_length} MEDCOUPLING_VERSION_NAME)
308 message(STATUS "MEDCoupling version is ${MEDCOUPLING_VERSION_NAME}")
310 ExternalProject_Add (MEDCoupling
311 URL ${DOWNLOAD_MEDCOUPLING} #location of medcoupling tarball
312 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MEDCOUPLING_TARBALL_NAME}
313 # BUILD_IN_SOURCE FALSE
314 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}
316 INSTALL_COMMAND make install
317 INSTALL_DIR ${MEDCOUPLING_ROOT_DIR}
318 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
319 LOG_DOWNLOAD TRUE # Wrap download in script to log output
320 LOG_UPDATE TRUE # Wrap update in script to log output
321 LOG_CONFIGURE TRUE # Wrap configure in script to log output
322 LOG_BUILD TRUE # Wrap build in script to log output
323 LOG_TEST TRUE # Wrap test in script to log output
324 LOG_INSTALL TRUE # Wrap install in script to log output
327 endif( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR} )
329 set(MEDCOUPLING_INCLUDE_DIR ${MEDCOUPLING_ROOT_DIR}/include)
330 set(MEDCOUPLING_LIBRARIES ${MEDCOUPLING_ROOT_DIR}/lib )#for environment file env_SOLVERLAB.sh
332 add_library(medloader SHARED IMPORTED )
333 set_property(TARGET medloader PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so)
334 add_library(medcoupling SHARED IMPORTED )
335 set_property(TARGET medcoupling PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so)
337 if (TARGET MED AND TARGET PETSc)
338 ExternalProject_Add_StepDependencies( MED build PETSc )#PETSc doit être compilé avant MED car c'est PETSc qui compile HDF5
339 endif(TARGET MED AND TARGET PETSc)
341 if (TARGET MED AND TARGET MEDCoupling)
342 ExternalProject_Add_StepDependencies( MEDCoupling build MED )#MED doit être compilé avant MEDCoupling
343 endif(TARGET MED AND TARGET MEDCoupling)
345 if (TARGET PETSc AND TARGET MEDCoupling)
346 ExternalProject_Add_StepDependencies( MEDCoupling build PETSc )#PETSc doit être compilé avant MEDCoupling (car il contient hdf5)
347 endif(TARGET PETSc AND TARGET MEDCoupling)
353 # Paraview variables for env_SOLVERLAB.sh
354 if( NOT DEFINED PARAVIEW_VERSION )
355 if( DEFINED PARAVIEW_ROOT_DIR)
356 set( PARAVIEW_INCLUDE_DIR ${PARAVIEW_ROOT_DIR}/include)
357 set( PARAVIEW_LIBRARIES_DIR ${PARAVIEW_ROOT_DIR}/lib)
358 else( DEFINED PARAVIEW_ROOT_DIR)
359 set( PARAVIEW_INCLUDE_DIR /usr/include/paraview/)
360 set( PARAVIEW_LIBRARIES_DIR /usr/lib/paraview/:/usr/lib64/paraview/)
361 endif( DEFINED PARAVIEW_ROOT_DIR)
363 #extraction of the paraview version"
364 IF ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h )
365 file(STRINGS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h vtkConfig)
366 ELSE ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h )
367 message(WARNING "Could not find ParaView configuration file vtkPVConfig.h in folder ${PARAVIEW_INCLUDE_DIR}. Postprocessing may not work")
368 ENDIF( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h )
370 FOREACH(line ${vtkConfig})
371 string(FIND "${line}" "#define PARAVIEW_VERSION_FULL " pos)
372 IF(NOT ${pos} EQUAL -1)
373 string(LENGTH ${line} line_length)#length of the tarball
374 MATH(EXPR start_pv_version "${line_length}-6")#line ends with "x.y.z", that counts for 7 characters
375 string(SUBSTRING ${line} ${start_pv_version} 5 PARAVIEW_VERSION)
377 ENDIF(NOT ${pos} EQUAL -1)
378 ENDFOREACH(line vtkConfig)
379 endif(NOT DEFINED PARAVIEW_VERSION)
381 message(STATUS "ParaView version is ${PARAVIEW_VERSION}" )
382 IF ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 3, use VERSION_GREATER_EQUAL if cmake >=3.7
384 ELSE ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 2
386 ENDIF( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )
388 set (PV_LIB_DIR /usr/lib/python${PYTHON2OR3}.7/dist-packages/paraview/:${PARAVIEW_LIBRARIES_DIR})
389 set (PV_PYTHON_DIR /usr/lib/python${PYTHON2OR3}.7/dist-packages/paraview/:/usr/lib64/paraview/site-packages/:/usr/lib64/paraview/site-packages/paraview/:/usr/lib64/paraview/site-packages/vtk/:/usr/lib64/paraview/python${PYTHON2OR3}.7/site-packages/:/usr/lib64/paraview/python${PYTHON2OR3}.7/site-packages/paraview/:/usr/lib64/paraview/python${PYTHON2OR3}.7/site-packages/vtkmodules:/usr/lib/paraview/site-packages/paraview:/usr/lib/paraview/site-packages/paraview/vtk)
392 IF (${CMAKE_VERSION} VERSION_GREATER "3.12.0")
393 find_package(Python ${PYTHON2OR3} REQUIRED COMPONENTS Interpreter Development )
394 SET(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
395 ELSE (${CMAKE_VERSION} VERSION_GREATER "3.12.0")
396 find_package(PythonInterp ${PYTHON2OR3} REQUIRED )
397 find_package(PythonLibs ${PYTHON2OR3} REQUIRED )
398 set(Python_LIBRARIES ${PYTHON_LIBRARIES})
399 set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
400 set(Python_VERSION ${PYTHON_VERSION_STRING})
401 ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.12.0")
403 message(STATUS "Python version is ${Python_VERSION}")
404 find_package (SWIG 3.0 REQUIRED)
406 if (SOLVERLAB_WITH_DOCUMENTATION) #
407 find_package (Doxygen) #
408 set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, doxygen, graphviz, mscgen")
409 set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, doxygen, graphviz, mscgen")
410 if (NOT DOXYGEN_FOUND)
411 message (FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly.")
412 endif(NOT DOXYGEN_FOUND)
414 if (SOLVERLAB_WITH_TESTS) #
415 find_package (CPPUNIT REQUIRED)
417 find_package (XDR REQUIRED)
419 # Enter subdirectories
420 add_subdirectory (CDMATH)
421 if(SOLVERLAB_WITH_COREFLOWS)
422 add_subdirectory (CoreFlows)
423 endif(SOLVERLAB_WITH_COREFLOWS)
427 ${PROJECT_SOURCE_DIR}/env_SOLVERLAB.sh
428 ${CMAKE_INSTALL_PREFIX}/env_SOLVERLAB.sh