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.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 ${CDMATH_SOURCE_DIR}/pre_requis/PETSc/f2cblaslapack-3.4.2.q4.tar.gz
30 CACHE STRING "F2CBLASLAPACK tarball path/url" )
31 set (DOWNLOAD_HDF5 ${CDMATH_SOURCE_DIR}/pre_requis/PETSc/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")
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} )
121 #elseif ( IS_DIRECTORY "/usr/lib/petsc/include" AND EXISTS "/usr/lib/petsc/lib/libpetsc_real.so" ) #Case ubuntu/debian system install
122 # message ( STATUS "PETSc includes found in /usr/lib/petsc/include")
123 # message ( STATUS "PETSc library found in /usr/lib/petsc/lib/libpetsc_real.so")
124 # set(PETSC_DIR /usr/lib/petsc/)
125 # set(PETSC_INCLUDES ${PETSC_DIR}/include ${PETSC_DIR}/include/petsc/mpiuni)
126 # set(PETSC_LIBRARIES ${PETSC_DIR}/lib/libpetsc_real.so)
128 # find_package (PETSc 3.4 REQUIRED)
129 # petsc_get_version ()
130 # set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet.
132 # Define and search slepc variables
133 # if ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
134 # message( STATUS "SLEPc includes found in /usr/lib/slepc/include" )
135 # message( STATUS "SLEPc library found in /usr/lib/slepc/lib/libslepc_real.so" )
136 # set(SLEPC_DIR /usr/lib/slepc/)
137 # set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
138 # set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc_real.so)
139 # set (CPACK_DEBIAN_PACKAGE_REQUIRES "${CPACK_DEBIAN_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet.
140 # else ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
141 # message( FATAL_ERROR "SLEPc not found in the system" )
142 # endif( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" )
144 #elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install
146 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
147 message (STATUS "PETSC not found in the system")
148 message (STATUS "PETSC will be downloaded and compiled from ${DOWNLOAD_PETSC}" )
149 message (STATUS "SLEPC will be downloaded and compiled from ${DOWNLOAD_SLEPC}" )
150 message (STATUS "HDF5 will be downloaded and compiled from ${DOWNLOAD_HDF5}" )
152 #extract tarball name
153 string(LENGTH "${DOWNLOAD_PETSC}" tarball_url_length)#length of the tarball
154 string(FIND "${DOWNLOAD_PETSC}" "/" start_tarball_name REVERSE )# last occurence of "/"
155 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
156 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
157 string(SUBSTRING ${DOWNLOAD_PETSC} ${start_tarball_name} ${tarball_name_length} PETSC_TARBALL_NAME)
159 set(PETSC_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${PETSC_TARBALL_NAME}) # Location of the final install
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}
168 TEST_COMMAND make check
169 INSTALL_COMMAND make all
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 #file (STRINGS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ")
181 #message( STATUS "PETSc version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" )
182 message( STATUS "PETSc, SLEPc and HDF5 will be installed at ${PETSC_INSTALL}")
184 string(SUBSTRING ${PETSC_TARBALL_NAME} 6 ${tarball_name_length} PETSC_VERSION)
185 #define slepc variables
186 set(SLEPC_DIR ${PETSC_INSTALL})
187 set(SLEPC_INCLUDES ${SLEPC_DIR}/include)
188 set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so)
190 #define hdf5 variables
191 if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments
192 if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment
193 set(HDF5_ROOT $ENV{HDF5_ROOT})
194 else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment
195 set(HDF5_ROOT ${PETSC_INSTALL})#HDF5 to be found in petsc installation
196 endif( DEFINED ENV{HDF5_ROOT} )
197 endif( NOT HDF5_ROOT )
198 set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib)
199 set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include)
201 endif ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" )
202 endif ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR )
204 if ( ${PETSC_VERSION} VERSION_GREATER 3.5 )
205 add_definitions(-DPETSC_VERSION_GREATER_3_5)
206 endif( ${PETSC_VERSION} VERSION_GREATER 3.5 )
207 string(REPLACE ";" ":" PETSC_INCLUDES_INSTALL "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_CDMATH.sh
209 ######################################################
210 # Detection or compilation of MEDFile #
211 ######################################################
212 if( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
214 if ( NOT MEDFILE_ROOT_DIR )
215 set(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} )
216 endif( NOT MEDFILE_ROOT_DIR )
218 find_package (MEDFile REQUIRED)
219 message (STATUS "MEDFile found in ${MEDFILE_ROOT_DIR}")
221 else( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
222 #string(FIND "${HDF5_LIBRARIES}" "libhdf5.so" pos)
223 #string(SUBSTRING "${HDF5_LIBRARIES}" 0 ${pos} HDF5_LIBRARY_DIR)
225 message(STATUS "MED will be downloaded and installed from ${DOWNLOAD_MED}")
227 set(MEDFILE_DEFINITIONS "-D${MACHINE} -DMEDFILE_INSTALL_DOC=OFF")#Comment ne pas compiler la doc ?
228 set(MEDFILE_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/med) # Location of the final install
230 #extraction of the tarball archive name
231 string(LENGTH "${DOWNLOAD_MED}" tarball_url_length)#length of the name of the tarball
232 string(FIND "${DOWNLOAD_MED}" "/" start_tarball_name REVERSE )# last occurence of "/"
233 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
234 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
235 string(SUBSTRING ${DOWNLOAD_MED} ${start_tarball_name} ${tarball_name_length} MED_TARBALL_NAME)
237 ExternalProject_Add (MED
238 URL ${DOWNLOAD_MED} #location of med tarball
239 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MED_TARBALL_NAME}
241 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
243 INSTALL_COMMAND make install
244 INSTALL_DIR ${MEDFILE_ROOT_DIR}
245 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
246 LOG_DOWNLOAD TRUE # Wrap download in script to log output
247 LOG_UPDATE TRUE # Wrap update in script to log output
248 LOG_CONFIGURE TRUE # Wrap configure in script to log output
249 LOG_BUILD TRUE # Wrap build in script to log output
250 LOG_TEST TRUE # Wrap test in script to log output
251 LOG_INSTALL TRUE # Wrap install in script to log output
254 set(MEDFILE_INCLUDE_DIRS ${MEDFILE_ROOT_DIR}/include)# Nécessaire pour le medloader et les sous-dossiers mesh, et IJKMesh
255 set(MEDFILE_LIBRARIES ${MEDFILE_ROOT_DIR}/lib)# Nécessaire pour le env_SOLVERLAB.sh
256 set(MEDFILE_C_LIBRARIES med medC)# Nécessaire pour le medloader
258 endif( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
260 add_library(med SHARED IMPORTED)
261 set_property(TARGET med PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmed.so)
262 add_library(medC SHARED IMPORTED)
263 set_property(TARGET medC PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmedC.so)
265 string(REPLACE ";" ":" MEDFILE_LIBRARIES_INSTALL "${MEDFILE_LIBRARIES}")# use colon instead of semicolon in environment file env_SOLVERLAB.sh
267 ######################################################
268 # Detection or compilation of MEDCoupling #
269 ######################################################
270 if( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
272 if( NOT MEDCOUPLING_ROOT_DIR )
273 set(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} )
274 endif( NOT MEDCOUPLING_ROOT_DIR )
276 message (STATUS "Seeking MEDCoupling library in ${MEDCOUPLING_ROOT_DIR}")
278 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)
279 message (FATAL_ERROR "MEDCoupling library not found in ${MEDCOUPLING_ROOT_DIR}")
280 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)
281 message (STATUS "MEDCoupling library found in ${MEDCOUPLING_ROOT_DIR}")
282 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)
284 else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
285 message(STATUS "MEDCoupling will be downloaded and installed from ${DOWNLOAD_MEDCOUPLING}")
286 set(MEDCOUPLING_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/medcoupling) # Location of the final install
287 SET(ENV{HDF5_ROOT} ${HDF5_ROOT})#MEDCoupling install process seems to require an environment variable
289 #extraction of the tarball archive name
290 string(LENGTH "${DOWNLOAD_MEDCOUPLING}" tarball_url_length)#length of the tarball
291 string(FIND "${DOWNLOAD_MEDCOUPLING}" "/" start_tarball_name REVERSE )# last occurence of "/"
292 MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
293 MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
294 string(SUBSTRING ${DOWNLOAD_MEDCOUPLING} ${start_tarball_name} ${tarball_name_length} MEDCOUPLING_TARBALL_NAME)
295 string(SUBSTRING ${MEDCOUPLING_TARBALL_NAME} 12 ${tarball_name_length} MEDCOUPLING_VERSION_NAME)
297 message(STATUS "MEDCoupling version is ${MEDCOUPLING_VERSION_NAME}")
299 ExternalProject_Add (MEDCoupling
300 URL ${DOWNLOAD_MEDCOUPLING} #location of medcoupling tarball
301 SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MEDCOUPLING_TARBALL_NAME}
302 # BUILD_IN_SOURCE FALSE
303 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}
305 INSTALL_COMMAND make install
306 INSTALL_DIR ${MEDCOUPLING_ROOT_DIR}
307 STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis
308 LOG_DOWNLOAD TRUE # Wrap download in script to log output
309 LOG_UPDATE TRUE # Wrap update in script to log output
310 LOG_CONFIGURE TRUE # Wrap configure in script to log output
311 LOG_BUILD TRUE # Wrap build in script to log output
312 LOG_TEST TRUE # Wrap test in script to log output
313 LOG_INSTALL TRUE # Wrap install in script to log output
316 endif( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR} )
318 set(MEDCOUPLING_INCLUDE_DIR ${MEDCOUPLING_ROOT_DIR}/include)
319 set(MEDCOUPLING_LIBRARIES ${MEDCOUPLING_ROOT_DIR}/lib )#for environment file env_SOLVERLAB.sh
321 add_library(medloader SHARED IMPORTED )
322 set_property(TARGET medloader PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so)
323 add_library(medcoupling SHARED IMPORTED )
324 set_property(TARGET medcoupling PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so)
326 if (TARGET MED AND TARGET PETSc)
327 ExternalProject_Add_StepDependencies( MED build PETSc )#PETSc doit être compilé avant MED car c'est PETSc qui compile HDF5
328 endif(TARGET MED AND TARGET PETSc)
330 if (TARGET MED AND TARGET MEDCoupling)
331 ExternalProject_Add_StepDependencies( MEDCoupling build MED )#MED doit être compilé avant MEDCoupling
332 endif(TARGET MED AND TARGET MEDCoupling)
334 if (TARGET PETSc AND TARGET MEDCoupling)
335 ExternalProject_Add_StepDependencies( MEDCoupling build PETSc )#PETSc doit être compilé avant MEDCoupling (car il contient hdf5)
336 endif(TARGET PETSc AND TARGET MEDCoupling)
342 # Paraview variables for env_SOLVERLAB.sh
343 if( NOT DEFINED PARAVIEW_VERSION )
344 if( DEFINED PARAVIEW_ROOT_DIR)
345 set( PARAVIEW_INCLUDE_DIR ${PARAVIEW_ROOT_DIR}/include)
346 set( PARAVIEW_LIBRARIES_DIR ${PARAVIEW_ROOT_DIR}/lib)
347 else( DEFINED PARAVIEW_ROOT_DIR)
348 set( PARAVIEW_INCLUDE_DIR /usr/include/paraview/)
349 set( PARAVIEW_LIBRARIES_DIR /usr/lib/paraview/:/usr/lib64/paraview/)
350 endif( DEFINED PARAVIEW_ROOT_DIR)
352 #extraction of the paraview version"
353 IF ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h )
354 file(STRINGS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h vtkConfig)
355 ELSE ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h )
356 message(WARNING "Could not find ParaView configuration file vtkPVConfig.h in folder ${PARAVIEW_INCLUDE_DIR}. Postprocessing may not work")
357 ENDIF( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h )
359 FOREACH(line ${vtkConfig})
360 string(FIND "${line}" "#define PARAVIEW_VERSION_FULL " pos)
361 IF(NOT ${pos} EQUAL -1)
362 string(LENGTH ${line} line_length)#length of the tarball
363 MATH(EXPR start_pv_version "${line_length}-6")#line ends with "x.y.z", that counts for 7 characters
364 string(SUBSTRING ${line} ${start_pv_version} 5 PARAVIEW_VERSION)
366 ENDIF(NOT ${pos} EQUAL -1)
367 ENDFOREACH(line vtkConfig)
368 endif(NOT DEFINED PARAVIEW_VERSION)
370 message(STATUS "ParaView version is ${PARAVIEW_VERSION}" )
371 IF ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 3, use VERSION_GREATER_EQUAL if cmake >=3.7
373 ELSE ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 2
375 ENDIF( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )
377 set (PV_LIB_DIR /usr/lib/python${PYTHON2OR3}.7/dist-packages/paraview/:${PARAVIEW_LIBRARIES_DIR})
378 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)
381 IF (${CMAKE_VERSION} VERSION_GREATER "3.12.0")
382 find_package(Python ${PYTHON2OR3} REQUIRED COMPONENTS Interpreter Development )
383 SET(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
384 ELSE (${CMAKE_VERSION} VERSION_GREATER "3.12.0")
385 find_package(PythonInterp ${PYTHON2OR3} REQUIRED )
386 find_package(PythonLibs ${PYTHON2OR3} REQUIRED )
387 set(Python_LIBRARIES ${PYTHON_LIBRARIES})
388 set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
389 set(Python_VERSION ${PYTHON_VERSION_STRING})
390 ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.12.0")
392 message(STATUS "Python version is ${Python_VERSION}")
393 find_package (SWIG 3.0 REQUIRED)
395 if (SOLVERLAB_WITH_DOCUMENTATION) #
396 find_package (Doxygen) #
397 set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, doxygen, graphviz, mscgen")
398 set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, doxygen, graphviz, mscgen")
399 if (NOT DOXYGEN_FOUND)
400 message (FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly.")
401 endif(NOT DOXYGEN_FOUND)
403 if (SOLVERLAB_WITH_TESTS) #
404 find_package (CPPUNIT REQUIRED)
406 find_package (XDR REQUIRED)
408 # Enter subdirectories
409 set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/cdmath)
410 add_subdirectory (CDMATH)
411 if(SOLVERLAB_WITH_COREFLOWS)
412 set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../coreflows)
413 add_subdirectory (CoreFlows)
414 endif(SOLVERLAB_WITH_COREFLOWS)
416 set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../)
419 ${PROJECT_SOURCE_DIR}/env_SOLVERLAB.sh
420 ${CMAKE_INSTALL_PREFIX}/env_SOLVERLAB.sh