endif( NOT MEDFILE_ROOT_DIR )
find_package (MEDFile REQUIRED)
- message (STATUS "MEDFile found in ${MEDFILE_ROOT_DIR}")
else( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR})
set(MEDCOUPLING_ROOT_DIR $ENV{MEDCOUPLING_ROOT_DIR} )
endif( NOT MEDCOUPLING_ROOT_DIR )
- message (STATUS "Seeking MEDCoupling library in ${MEDCOUPLING_ROOT_DIR}")
-
- 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)
- message (FATAL_ERROR "MEDCoupling library not found in ${MEDCOUPLING_ROOT_DIR}")
- 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)
- message (STATUS "MEDCoupling library found in ${MEDCOUPLING_ROOT_DIR}")
- 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)
+ set(MEDCoupling_DIR ${MEDCOUPLING_ROOT_DIR}/cmake_files)
+ find_package(MEDCoupling CONFIG REQUIRED ) # CONFIG is important !
+ message( STATUS "MEDCoupling found. Version is ${MEDCoupling_VERSION}")
else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR})
message(STATUS "MEDCoupling will be downloaded and installed from ${DOWNLOAD_MEDCOUPLING}")
MATH(EXPR start_tarball_name "${start_tarball_name}+1")#start after the occurence of "/"
MATH(EXPR tarball_name_length "${tarball_url_length}-${start_tarball_name}-7")#name ends before .tar.gz that counts for 7 characters
string(SUBSTRING ${DOWNLOAD_MEDCOUPLING} ${start_tarball_name} ${tarball_name_length} MEDCOUPLING_TARBALL_NAME)
- string(SUBSTRING ${MEDCOUPLING_TARBALL_NAME} 12 ${tarball_name_length} MEDCOUPLING_VERSION_NAME)
+ string(SUBSTRING ${MEDCOUPLING_TARBALL_NAME} 12 ${tarball_name_length} MEDCoupling_VERSION)
- message(STATUS "MEDCoupling version is ${MEDCOUPLING_VERSION_NAME}")
+ message(STATUS "MEDCoupling version will be ${MEDCoupling_VERSION}")
ExternalProject_Add (MEDCoupling
URL ${DOWNLOAD_MEDCOUPLING} #location of medcoupling tarball
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MEDCOUPLING_TARBALL_NAME}
# BUILD_IN_SOURCE FALSE
- 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}
+ CONFIGURE_COMMAND cmake <SOURCE_DIR>/${MEDCOUPLING_TARBALL_NAME} -DCMAKE_INSTALL_PREFIX=${MEDCOUPLING_ROOT_DIR} -DCONFIGURATION_ROOT_DIR=<SOURCE_DIR>/configuration-${MEDCoupling_VERSION} -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}
BUILD_COMMAND make
INSTALL_COMMAND make install
INSTALL_DIR ${MEDCOUPLING_ROOT_DIR}
LOG_INSTALL TRUE # Wrap install in script to log output
)
+ add_library(medloader SHARED IMPORTED )
+ set_property(TARGET medloader PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so)
+
endif( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR} )
set(MEDCOUPLING_INCLUDE_DIR ${MEDCOUPLING_ROOT_DIR}/include)
set(MEDCOUPLING_LIBRARIES ${MEDCOUPLING_ROOT_DIR}/lib )#for environment file env_SOLVERLAB.sh
-add_library(medloader SHARED IMPORTED )
-set_property(TARGET medloader PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedloader.so)
add_library(medcoupling SHARED IMPORTED )
set_property(TARGET medcoupling PROPERTY IMPORTED_LOCATION ${MEDCOUPLING_ROOT_DIR}/lib/libmedcoupling.so)
+if ( ${MEDCoupling_VERSION} VERSION_GREATER 9.4 )
+ add_definitions(-DMEDCoupling_VERSION_VERSION_GREATER_9_4)
+endif( ${MEDCoupling_VERSION} VERSION_GREATER 9.4 )
+
if (TARGET MED AND TARGET PETSc)
ExternalProject_Add_StepDependencies( MED build PETSc )#PETSc doit être compilé avant MED car c'est PETSc qui compile HDF5
endif(TARGET MED AND TARGET PETSc)
ENDIF( ${vtkConfig_file} STREQUAL "vtkConfig_file-NOTFOUND" )
endif( DEFINED PARAVIEW_VERSION OR DEFINED ENV{PARAVIEW_VERSION} )
-
+#Choose python 2 or 3
IF ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 3, use VERSION_GREATER_EQUAL if cmake >=3.7
SET(PYTHON2OR3 "3")
message(STATUS "PARAVIEW_VERSION greater than 5.6. We need python3 for postprocessing scripts.")
set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR})
ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.12.0")
+#PyQt5
IF ( NOT PYQT5_ROOT_DIR )
set(PYQT5_ROOT_DIR $ENV{PYQT5_ROOT_DIR} )
ENDIF( NOT PYQT5_ROOT_DIR )
#Matplotlib
-IF ( NOT MATPLOTLIB_ROOT_DIR )
+IF ( NOT MATPLOTLIB_ROOT_DIR )
set(MATPLOTLIB_ROOT_DIR $ENV{MATPLOTLIB_ROOT_DIR} )
-ENDIF(MATPLOTLIB_ROOT_DIR )
+ENDIF( NOT MATPLOTLIB_ROOT_DIR )
-IF ( NOT HDF5_ROOT_DIR )
+#HDF5_ROOT_DIR
+IF ( NOT HDF5_ROOT_DIR )
IF ( ENV{HDF5_ROOT_DIR} )
set(HDF5_ROOT_DIR $ENV{HDF5_ROOT_DIR} )
ELSE( ENV{HDF5_ROOT_DIR} )
set(HDF5_ROOT_DIR ${HDF5_ROOT} )
ENDIF( ENV{HDF5_ROOT_DIR} )
-ENDIF(NOT HDF5_ROOT_DIR )
+ENDIF( NOT HDF5_ROOT_DIR )
#Paraview library paths