From: michael Date: Tue, 6 Oct 2020 19:08:04 +0000 (+0200) Subject: Used MEDCoupling_version for compatibility between medCoupling 9.4 and 9.6 X-Git-Tag: V9_6_0~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3dade49040d034aefbd948476c9a6dc4a8e8ab7f;p=tools%2Fsolverlab.git Used MEDCoupling_version for compatibility between medCoupling 9.4 and 9.6 --- diff --git a/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx b/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx index 748be72..31a943c 100644 --- a/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx +++ b/CDMATH/linearsolver/src/SparseMatrixPetsc.cxx @@ -769,7 +769,11 @@ SparseMatrixPetsc::getEigenvectorsDataArrayDouble(int nev, EPSWhich which, doubl nconv=computeSpectrum(nev, &valP, &vecP, which, tol); +#ifdef MEDCoupling_VERSION_VERSION_GREATER_9_4 std::vector< long unsigned int > compoId(1); +#else + std::vector< int > compoId(1); +#endif MEDCoupling::DataArrayDouble *arrays=MEDCoupling::DataArrayDouble::New(); MEDCoupling::DataArrayDouble *array =MEDCoupling::DataArrayDouble::New(); arrays->alloc(_numberOfRows,nconv); diff --git a/CMakeLists.txt b/CMakeLists.txt index d203f18..d24f854 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,6 @@ if( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR}) 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}) @@ -289,13 +288,9 @@ if( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_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}") @@ -308,15 +303,15 @@ else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR}) 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 /${MEDCOUPLING_TARBALL_NAME} -DCMAKE_INSTALL_PREFIX=${MEDCOUPLING_ROOT_DIR} -DCONFIGURATION_ROOT_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 /${MEDCOUPLING_TARBALL_NAME} -DCMAKE_INSTALL_PREFIX=${MEDCOUPLING_ROOT_DIR} -DCONFIGURATION_ROOT_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} @@ -329,16 +324,21 @@ else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{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) @@ -400,7 +400,7 @@ else( DEFINED PARAVIEW_VERSION OR DEFINED ENV{PARAVIEW_VERSION} ) 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.") @@ -431,22 +431,24 @@ ELSE (${CMAKE_VERSION} VERSION_GREATER "3.12.0") 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