From: Bernard Secher Date: Fri, 4 Sep 2020 11:39:43 +0000 (+0200) Subject: update merge Coreflows and CDMATH compilation X-Git-Tag: V9_6_0~56 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5b348e3245364d1f04be159016f1a46447858f73;p=tools%2Fsolverlab.git update merge Coreflows and CDMATH compilation --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45d4b9c --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Compiled Object files +*.slo +*.lo +*.o +*.pyc + +# Compiled Dynamic libraries +*.so +*.dylib + +# Compiled Static libraries +*.lai +*.la +*.a + +# Temporary files +*~ + +# Automatically generated documentation files +*.map + +# Eclipse files +.cproject +.project +.settings/* diff --git a/CDMATH/.gitignore b/CDMATH/.gitignore deleted file mode 100644 index 24bf7e7..0000000 --- a/CDMATH/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -# Compiled Object files -*.slo -*.lo -*.o -*.pyc - -# Compiled Dynamic libraries -*.so -*.dylib - -# Compiled Static libraries -*.lai -*.la -*.a - -# Temporary files -*~ - -# Automatically generated documentation files -doc/* -pre_requis/MEDFile/doc/* -*.map - -# Eclipse files -.cproject -.project -.settings/* diff --git a/CDMATH/CMakeLists.txt b/CDMATH/CMakeLists.txt index 313a04a..efd0963 100755 --- a/CDMATH/CMakeLists.txt +++ b/CDMATH/CMakeLists.txt @@ -10,12 +10,12 @@ set (CDMATH_VERSION_MINOR 0) include(ExternalProject)#For PETSc, MED and MEDCoupling # Project options -option (CDMATH_WITH_PETSC "Compile CDMATH with PETSc linking." OFF) -option (CDMATH_WITH_DOCUMENTATION "Generate documentation with doxygen." OFF) -option (CDMATH_WITH_PYTHON "Compile Python interface for CDMATH." OFF) -option (CDMATH_WITH_POSTPRO "Install postprocessing Python modules." OFF) +option (CDMATH_WITH_PETSC "Compile CDMATH with PETSc linking." ON) +option (CDMATH_WITH_DOCUMENTATION "Generate documentation with doxygen." ON) +option (CDMATH_WITH_PYTHON "Compile Python interface for CDMATH." ON) +option (CDMATH_WITH_POSTPRO "Install postprocessing Python modules." ON) option (CDMATH_WITH_PACKAGE "Generate RPM, Debian and tarball packages." OFF) -option (CDMATH_WITH_TESTS "Compile unit testing." OFF) +option (CDMATH_WITH_TESTS "Compile unit testing." ON) #Path to installed libraries set (PETSC_DIR OFF CACHE STRING "PETSc library path" ) @@ -26,15 +26,15 @@ set (MEDFILE_ROOT_DIR OFF CACHE STRING "MED library path" ) set (MEDCOUPLING_ROOT_DIR OFF CACHE STRING "MEDCoupling library path" ) #url of tarball librairies -set (DOWNLOAD_PETSC http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.13.2.tar.gz +set (DOWNLOAD_PETSC http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.13.tar.gz CACHE STRING "PETSc tarball path/url" ) -set (DOWNLOAD_SLEPC https://slepc.upv.es/download/distrib/slepc-3.13.2.tar.gz +set (DOWNLOAD_SLEPC https://slepc.upv.es/download/distrib/slepc-3.13.4.tar.gz CACHE STRING "SLEPC tarball path/url" ) set (DOWNLOAD_F2CBLASLAPACK ${CDMATH_SOURCE_DIR}/pre_requis/PETSc/f2cblaslapack-3.4.2.q4.tar.gz CACHE STRING "F2CBLASLAPACK tarball path/url" ) set (DOWNLOAD_HDF5 ${CDMATH_SOURCE_DIR}/pre_requis/PETSc/hdf5-1.10.3.tar.gz CACHE STRING "HDF5 tarball path/url" ) -set (DOWNLOAD_MED http://files.salome-platform.org/Salome/other/med-4.0.0.tar.gz +set (DOWNLOAD_MED http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz CACHE STRING "MED tarball path/url") set (DOWNLOAD_MEDCOUPLING http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz CACHE STRING "MEDCoupling tarball path/url" ) @@ -48,356 +48,25 @@ set (CDMATH_SWIG_DIR ${CDMATH_SOURCE_DIR}/swig) set (CDMATH_POSTPRO_DIR ${CDMATH_SOURCE_DIR}/postprocessing) set (TESTS_DIR ${CDMATH_SOURCE_DIR}/tests) -list (APPEND CMAKE_MODULE_PATH "${CDMATH_SOURCE_DIR}/cmake_files") -# PETSc and HDF5 -if (CDMATH_WITH_PETSC OR PETSC_DIR OR DEFINED ENV{PETSC_DIR} ) +###Define CDMATH_INCLUDES and CDMATH_LIBRARIES for the compilation of CoreFlows +set(CDMATH_INCLUDES + ${MEDFILE_INCLUDE_DIRS} ${MEDCOUPLING_INCLUDE_DIR} + ${BASE_DIR}/inc ${MESH_DIR}/inc ${LINEARSOLVER_DIR}/inc + PARENT_SCOPE ) - if ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR) - if (NOT PETSC_DIR) - set(PETSC_DIR $ENV{PETSC_DIR}) - message ( STATUS "Checking variable PETSC_DIR : " $ENV{PETSC_DIR} ) - else (NOT PETSC_DIR) - message ( STATUS "Checking variable PETSC_DIR : " ${PETSC_DIR} ) - endif(NOT PETSC_DIR) - - find_package (PETSc 3.4 REQUIRED) - petsc_get_version () - - message ( STATUS "PETSc found. Version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" ) - set(PETSC_INSTALL ${PETSC_DIR}) - - #Define and search slepc variables - if ( NOT SLEPC_DIR ) - if ( DEFINED ENV{SLEPC_DIR} ) - set(SLEPC_DIR $ENV{SLEPC_DIR}) - else ( DEFINED ENV{SLEPC_DIR} ) - set(SLEPC_DIR ${PETSC_DIR}/${PETSC_ARCH}) - endif( DEFINED ENV{SLEPC_DIR} ) - endif( NOT SLEPC_DIR) - - message ( STATUS "Checking variable SLEPC_DIR" ) - if ( IS_DIRECTORY ${SLEPC_DIR}/include AND EXISTS ${SLEPC_DIR}/lib/libslepc.so) - set(SLEPC_INCLUDES ${SLEPC_DIR}/include) - set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) - message( STATUS "SLEPc found at ${SLEPC_DIR}" ) - else() - message( FATAL_ERROR "SLEPc not found at ${SLEPC_DIR}" ) - endif() - - #define hdf5 variables - if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments - if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment - set(HDF5_ROOT $ENV{HDF5_ROOT}) - else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment - #HDF5 to be found in petsc external packages - set(HDF5_ROOT ${PETSC_DIR}/${PETSC_ARCH})# define hint for hdf5/med installation in petsc external packages - endif( DEFINED ENV{HDF5_ROOT} ) - endif( NOT HDF5_ROOT ) - set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib) - set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include) - else ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR ) - message ( STATUS "PETSC_DIR not set, searching PETSc and SLEPc in the system" ) - - if ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) #Case fedora/redhat system install - message ( STATUS "PETSC includes found in /usr/include/petsc/" ) - message ( STATUS "PETSC library found in /usr/lib64" ) - set(PETSC_DIR /usr/) - set(PETSC_INCLUDES /usr/include/petsc /usr/include/petsc/petsc/mpiuni) - set(PETSC_LIBRARIES /usr/lib64/libpetsc.so) - - 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 - - set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet. - set(PETSC_INSTALL ${PETSC_DIR}) - - #Define and search slepc variables - if ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) - message( STATUS "SLEPc includes found in /usr/include/slepc/" ) - message( STATUS "SLEPc library found in /usr/lib64/slepc/" ) - set(SLEPC_DIR /usr/) - set(SLEPC_INCLUDES ${SLEPC_DIR}/include) - set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) - set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet. - else ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) - message( FATAL_ERROR "SLEPc not found in the system" ) - endif( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) - - #HDF5 to be found in the system - if ( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment - find_package(HDF5 REQUIRED) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhdf5-dev") - set(CPACK_RPM_PACKAGE_REQUIRES "hdf5-devel") - endif( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} ) - - - #elseif ( IS_DIRECTORY "/usr/lib/petsc/include" AND EXISTS "/usr/lib/petsc/lib/libpetsc_real.so" ) #Case ubuntu/debian system install - # message ( STATUS "PETSc includes found in /usr/lib/petsc/include") - # message ( STATUS "PETSc library found in /usr/lib/petsc/lib/libpetsc_real.so") - # set(PETSC_DIR /usr/lib/petsc/) - # set(PETSC_INCLUDES ${PETSC_DIR}/include ${PETSC_DIR}/include/petsc/mpiuni) - # set(PETSC_LIBRARIES ${PETSC_DIR}/lib/libpetsc_real.so) - - # find_package (PETSc 3.4 REQUIRED) - # petsc_get_version () - # set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet. - - # Define and search slepc variables - # if ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" ) - # message( STATUS "SLEPc includes found in /usr/lib/slepc/include" ) - # message( STATUS "SLEPc library found in /usr/lib/slepc/lib/libslepc_real.so" ) - # set(SLEPC_DIR /usr/lib/slepc/) - # set(SLEPC_INCLUDES ${SLEPC_DIR}/include) - # set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc_real.so) - # set (CPACK_DEBIAN_PACKAGE_REQUIRES "${CPACK_DEBIAN_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet. - # else ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" ) - # message( FATAL_ERROR "SLEPc not found in the system" ) - # endif( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" ) - - #elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install - - 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 - message (STATUS "PETSC not found in the system") - message (STATUS "PETSC will be downloaded and compiled from ${DOWNLOAD_PETSC}" ) - message (STATUS "SLEPC will be downloaded and compiled from ${DOWNLOAD_SLEPC}" ) - message (STATUS "HDF5 will be downloaded and compiled from ${DOWNLOAD_HDF5}" ) - - #extract tarball name - string(LENGTH "${DOWNLOAD_PETSC}" tarball_url_length)#length of the tarball - string(FIND "${DOWNLOAD_PETSC}" "/" start_tarball_name REVERSE )# last occurence of "/" - 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_PETSC} ${start_tarball_name} ${tarball_name_length} PETSC_TARBALL_NAME) - - set(PETSC_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${PETSC_TARBALL_NAME}) # Location of the final install - set(PETSC_INSTALL ${CMAKE_INSTALL_PREFIX}/share/petsc)#folder to copy petsc libraries and include files - - ExternalProject_Add (PETSc - URL ${DOWNLOAD_PETSC} - SOURCE_DIR ${PETSC_DIR} - BUILD_IN_SOURCE TRUE - CONFIGURE_COMMAND /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} - BUILD_COMMAND make - TEST_COMMAND make check - INSTALL_COMMAND make all - INSTALL_DIR ${PETSC_DIR} - STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis - LOG_DOWNLOAD TRUE # Wrap download in script to log output - LOG_UPDATE TRUE # Wrap update in script to log output - LOG_CONFIGURE TRUE # Wrap configure in script to log output - LOG_BUILD TRUE # Wrap build in script to log output - LOG_TEST TRUE # Wrap test in script to log output - LOG_INSTALL TRUE # Wrap install in script to log output - ) - - #file (STRINGS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - #message( STATUS "PETSc version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" ) - message( STATUS "PETSc, SLEPc and HDF5 will be installed at ${PETSC_INSTALL}") - - string(SUBSTRING ${PETSC_TARBALL_NAME} 6 ${tarball_name_length} PETSC_VERSION) - #define slepc variables - set(SLEPC_DIR ${PETSC_INSTALL}) - set(SLEPC_INCLUDES ${SLEPC_DIR}/include) - set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) - - #define hdf5 variables - if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments - if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment - set(HDF5_ROOT $ENV{HDF5_ROOT}) - else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment - set(HDF5_ROOT ${PETSC_INSTALL})#HDF5 to be found in petsc installation - endif( DEFINED ENV{HDF5_ROOT} ) - endif( NOT HDF5_ROOT ) - set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib) - set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include) - - endif ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) - endif ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR ) - - if ( ${PETSC_VERSION} VERSION_GREATER 3.5 ) - add_definitions(-DPETSC_VERSION_GREATER_3_5) - endif( ${PETSC_VERSION} VERSION_GREATER 3.5 ) -string(REPLACE ";" ":" PETSC_INCLUDES_INSTALL "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_CDMATH.sh -endif( CDMATH_WITH_PETSC OR PETSC_DIR OR DEFINED ENV{PETSC_DIR} ) - -#MED -if( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR}) - - if ( NOT MEDFILE_ROOT_DIR ) - set(MEDFILE_ROOT_DIR $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}) - #string(FIND "${HDF5_LIBRARIES}" "libhdf5.so" pos) - #string(SUBSTRING "${HDF5_LIBRARIES}" 0 ${pos} HDF5_LIBRARY_DIR) - - message(STATUS "MED will be downloaded and installed from ${DOWNLOAD_MED}") - set(MACHINE PCLINUX) - set(MEDFILE_DEFINITIONS "-D${MACHINE} -DMEDFILE_INSTALL_DOC=OFF")#Comment ne pas compiler la doc ? - set(MEDFILE_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/med) # Location of the final install - - #extraction of the tarball archive name - string(LENGTH "${DOWNLOAD_MED}" tarball_url_length)#length of the name of the tarball - string(FIND "${DOWNLOAD_MED}" "/" start_tarball_name REVERSE )# last occurence of "/" - 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_MED} ${start_tarball_name} ${tarball_name_length} MED_TARBALL_NAME) - - ExternalProject_Add (MED - URL ${DOWNLOAD_MED} #location of med tarball - SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MED_TARBALL_NAME} - BUILD_IN_SOURCE TRUE - CONFIGURE_COMMAND /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 - BUILD_COMMAND make - INSTALL_COMMAND make install - INSTALL_DIR ${MEDFILE_ROOT_DIR} - STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis - LOG_DOWNLOAD TRUE # Wrap download in script to log output - LOG_UPDATE TRUE # Wrap update in script to log output - LOG_CONFIGURE TRUE # Wrap configure in script to log output - LOG_BUILD TRUE # Wrap build in script to log output - LOG_TEST TRUE # Wrap test in script to log output - LOG_INSTALL TRUE # Wrap install in script to log output - ) - - set(MEDFILE_INCLUDE_DIRS ${MEDFILE_ROOT_DIR}/include)# Nécessaire pour le medloader et les sous-dossiers mesh, et IJKMesh - set(MEDFILE_C_LIBRARIES med medC)# Nécessaire pour le medloader - -endif( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR}) - -add_library(med SHARED IMPORTED) -set_property(TARGET med PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmed.so) -add_library(medC SHARED IMPORTED) -set_property(TARGET medC PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmedC.so) - -#MEDCoupling -if( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR}) - - if( NOT 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) - -else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR}) - message(STATUS "MEDCoupling will be downloaded and installed from ${DOWNLOAD_MEDCOUPLING}") - set(MEDCOUPLING_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/medcoupling) # Location of the final install - SET(ENV{HDF5_ROOT} ${HDF5_ROOT})#MEDCoupling install process seems to require an environment variable - - #extraction of the tarball archive name - string(LENGTH "${DOWNLOAD_MEDCOUPLING}" tarball_url_length)#length of the tarball - string(FIND "${DOWNLOAD_MEDCOUPLING}" "/" start_tarball_name REVERSE )# last occurence of "/" - 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) - - message(STATUS "MEDCoupling version is ${MEDCOUPLING_VERSION_NAME}") - - 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} - BUILD_COMMAND make - INSTALL_COMMAND make install - INSTALL_DIR ${MEDCOUPLING_ROOT_DIR} - STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis - LOG_DOWNLOAD TRUE # Wrap download in script to log output - LOG_UPDATE TRUE # Wrap update in script to log output - LOG_CONFIGURE TRUE # Wrap configure in script to log output - LOG_BUILD TRUE # Wrap build in script to log output - LOG_TEST TRUE # Wrap test in script to log output - LOG_INSTALL TRUE # Wrap install in script to log output - ) - -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_CDMATH.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 (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) - -if (TARGET MED AND TARGET MEDCoupling) - ExternalProject_Add_StepDependencies( MEDCoupling build MED )#MED doit être compilé avant MEDCoupling -endif(TARGET MED AND TARGET MEDCoupling) - -if (TARGET PETSc AND TARGET MEDCoupling) - ExternalProject_Add_StepDependencies( MEDCoupling build PETSc )#PETSc doit être compilé avant MEDCoupling (car il contient hdf5) -endif(TARGET PETSc AND TARGET MEDCoupling) +set (CDMATH_LIBRARIES + medC medloader medcoupling + base mesh linearsolver + PARENT_SCOPE ) -# Paraview variables for env_CDMATH.sh -if (CDMATH_WITH_PYTHON AND CDMATH_WITH_POSTPRO) -#find_package(VTK) -#find_package(ParaView) - - #extraction of the paraview version" - IF ( EXISTS "/usr/include/paraview/vtkPVConfig.h" ) - file(STRINGS /usr/include/paraview/vtkPVConfig.h vtkConfig) - ELSE ( EXISTS "/usr/include/paraview/vtkPVConfig.h" ) - message(WARNING "Could not find ParaView configuration file vtkPVConfig.h. Postprocessing won't work") - ENDIF( EXISTS "/usr/include/paraview/vtkPVConfig.h" ) - - FOREACH(line ${vtkConfig}) - string(FIND "${line}" "#define PARAVIEW_VERSION_FULL " pos) - IF(NOT ${pos} EQUAL -1) - string(LENGTH ${line} line_length)#length of the tarball - MATH(EXPR start_pv_version "${line_length}-6")#line ends with "x.y.z", that counts for 7 characters - string(SUBSTRING ${line} ${start_pv_version} 5 PV_VERSION) - break() - ENDIF(NOT ${pos} EQUAL -1) - ENDFOREACH(line vtkConfig) - - message(STATUS "ParaView version is ${PV_VERSION}" ) - IF ( ${PV_VERSION} VERSION_GREATER 5.6.0 OR ${PV_VERSION} VERSION_EQUAL 5.6.0 )#Use python 3, use VERSION_GREATER_EQUAL if cmake >=3.7 - SET(PYTHON2OR3 "3") - ELSE ( ${PV_VERSION} VERSION_GREATER 5.6.0 OR ${PV_VERSION} VERSION_EQUAL 5.6.0 )#Use python 2 - SET(PYTHON2OR3 "2") - ENDIF( ${PV_VERSION} VERSION_GREATER 5.6.0 OR ${PV_VERSION} VERSION_EQUAL 5.6.0 ) - - set (PV_LIB_DIR /usr/lib/python${PYTHON2OR3}.7/dist-packages/paraview/:/usr/lib64/paraview/:/usr/lib/paraview/) - 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) - -endif(CDMATH_WITH_PYTHON AND CDMATH_WITH_POSTPRO) - # Swig interface if (CDMATH_WITH_PYTHON) - IF (${CMAKE_VERSION} VERSION_GREATER "3.12.0") - find_package(Python ${PYTHON2OR3} REQUIRED COMPONENTS Interpreter Development ) - SET(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) - ELSE (${CMAKE_VERSION} VERSION_GREATER "3.12.0") - find_package(PythonInterp ${PYTHON2OR3} REQUIRED ) - find_package(PythonLibs ${PYTHON2OR3} REQUIRED ) - set(Python_LIBRARIES ${PYTHON_LIBRARIES}) - set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) - set(Python_VERSION ${PYTHON_VERSION_STRING}) - ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.12.0") - - message(STATUS "Python version is ${Python_VERSION}") - - find_package (SWIG 3.0 REQUIRED) set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, python-dev, python-numpy, swig") set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, python-devel, numpy, swig") add_subdirectory (${CDMATH_SWIG_DIR}) endif(CDMATH_WITH_PYTHON) -find_package (XDR REQUIRED) add_subdirectory (${BASE_DIR}) add_subdirectory (${MESH_DIR}) @@ -407,14 +76,8 @@ endif(CDMATH_WITH_PETSC) # Documentation if (CDMATH_WITH_DOCUMENTATION) - find_package (Doxygen) - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, doxygen, graphviz, mscgen") - set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, doxygen, graphviz, mscgen") - if (NOT DOXYGEN_FOUND) - message (FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly.") - endif(NOT DOXYGEN_FOUND) configure_file (Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE) - add_custom_target (doc COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile + add_custom_target (docCDMATH COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile SOURCES ${PROJECT_BINARY_DIR}/Doxyfile) if ( IS_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION doc/cdmath-dev-doc) @@ -430,14 +93,13 @@ endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") # Tests if (CDMATH_WITH_TESTS) - find_package (CPPUNIT REQUIRED) enable_testing () add_subdirectory (${TESTS_DIR})#contains c++ and python tests endif(CDMATH_WITH_TESTS) # Packaging if (CDMATH_WITH_PACKAGE) - include (CPackLists.txt) + include (${CDMATH_SOURCE_DIR}/CPackLists.txt) endif(CDMATH_WITH_PACKAGE) # Postprocessing diff --git a/CDMATH/CPackLists.txt b/CDMATH/CPackLists.txt old mode 100644 new mode 100755 index 928ef9b..1ad0ff5 --- a/CDMATH/CPackLists.txt +++ b/CDMATH/CPackLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required (VERSION 2.8) -set (CPACK_PACKAGE_NAME "cdmath") +set (CPACK_PACKAGE_NAME "CDMATH") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Numerical analysis toolbox") set (CPACK_PACKAGE_VENDOR "CEA Saclay") -set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +set (CPACK_PACKAGE_DESCRIPTION_FILE "${CDMATH_SOURCE_DIR}/README.md") set (CPACK_PACKAGE_VERSION_MAJOR "${CDMATH_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${CDMATH_VERSION_MINOR}") set (CPACK_PACKAGE_INSTALL_DIRECTORY cdmath) diff --git a/CDMATH/cmake_files/CorrectWindowsPaths.cmake b/CDMATH/cmake_files/CorrectWindowsPaths.cmake deleted file mode 100644 index e1d5e13..0000000 --- a/CDMATH/cmake_files/CorrectWindowsPaths.cmake +++ /dev/null @@ -1,38 +0,0 @@ -##Copyright (C) johnfettig. -##All rights reserved. -## -##Redistribution and use in source and binary forms, with or without modification, -##are permitted provided that the following conditions are met: -## -##* Redistributions of source code must retain the above copyright notice, this -## list of conditions and the following disclaimer. -## -##* Redistributions in binary form must reproduce the above copyright notice, this -## list of conditions and the following disclaimer in the documentation and/or -## other materials provided with the distribution. -## -##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# CorrectWindowsPaths - this module defines one macro -# -# CONVERT_CYGWIN_PATH( PATH ) -# This uses the command cygpath (provided by cygwin) to convert -# unix-style paths into paths useable by cmake on windows - -macro (CONVERT_CYGWIN_PATH _path) - if (WIN32) - EXECUTE_PROCESS(COMMAND cygpath.exe -m ${${_path}} - OUTPUT_VARIABLE ${_path}) - string (STRIP ${${_path}} ${_path}) - endif (WIN32) -endmacro (CONVERT_CYGWIN_PATH) - diff --git a/CDMATH/cmake_files/FindCDMATH.cmake b/CDMATH/cmake_files/FindCDMATH.cmake deleted file mode 100755 index 87fb033..0000000 --- a/CDMATH/cmake_files/FindCDMATH.cmake +++ /dev/null @@ -1,85 +0,0 @@ -##Copyright (C) arthurtalpaert. -##All rights reserved. -## -##Redistribution and use in source and binary forms, with or without modification, -##are permitted provided that the following conditions are met: -## -##* Redistributions of source code must retain the above copyright notice, this -## list of conditions and the following disclaimer. -## -##* Redistributions in binary form must reproduce the above copyright notice, this -## list of conditions and the following disclaimer in the documentation and/or -## other materials provided with the distribution. -## -##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# - Try to find CDMATH -# Once done this will define -# -# CDMATH_FOUND - system has CDMATH -# CDMATH_INCLUDES - the CDMATH include directories -# CDMATH_LIBRARIES - Link these to use CDMATH -# -# Usage: -# find_package(CDMATH) -# -# Setting these changes the behavior of the search: -# CDMATH_DIR - directory in which CDMATH resides -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -find_path (CDMATH_DIR include/CdmathException.hxx - HINTS ENV CDMATH_DIR - PATHS - /usr - $ENV{HOME}/cdmath - $ENV{HOME}/workspace/cdmath_install - DOC "CDMATH Directory") -message (STATUS "Found CDMATH: ${CDMATH_DIR}") - -# Include directories -# This sets the variable ${CDMATH_INCLUDES}. -set(CDMATH_INCLUDES ${CDMATH_DIR}/include) -if (NOT (IS_DIRECTORY ${CDMATH_INCLUDES}) ) - message (SEND_ERROR "CDMATH_INCLUDES can not be used, ${CDMATH_INCLUDES} does not exist.") -endif () -set(MED_INCLUDES ${CDMATH_DIR}/share/med/include) -if (NOT (IS_DIRECTORY ${MED_INCLUDES}) ) - message (SEND_ERROR "MED_INCLUDES can not be used, ${MED_INCLUDES} does not exist.") -endif () -set(MEDCOUPLING_INCLUDES ${CDMATH_DIR}/share/medcoupling/include) -if (NOT (IS_DIRECTORY ${MEDCOUPLING_INCLUDES}) ) - message (SEND_ERROR "MEDCOUPLING_INCLUDES can not be used, ${MEDCOUPLING_INCLUDES} does not exist.") -endif () - -# CDMATH libraries against which to link -# This sets the variable ${CDMATH_LIBRARIES}. -set(CDMATH_LIBDIR ${CDMATH_DIR}/lib) -if ( NOT (IS_DIRECTORY ${CDMATH_LIBDIR}) ) - message (SEND_ERROR "CDMATH_LIBDIR can not be used, ${CDMATH_LIBDIR} does not exist.") -endif () -find_library (CDMATHBASE_LIB NAMES base PATHS ${CDMATH_LIBDIR}) -find_library (CDMATHMESH_LIB NAMES mesh PATHS ${CDMATH_LIBDIR}) -find_library (MEDC_LIB NAMES medC PATHS ${CDMATH_DIR}/share/med/lib) -find_library (MEDLOADER_LIB NAMES medloader PATHS ${CDMATH_DIR}/share/medcoupling/lib/) -find_library (MEDCOUPLING_LIB NAMES medcoupling PATHS ${CDMATH_DIR}/share/medcoupling/lib/) -#find_library (CDMATHLINEARSOLVER_LIB NAMES linearsolver PATHS ${CDMATH_LIBDIR}) -set (CDMATH_LIBRARIES - ${MEDC_LIB} - ${MEDLOADER_LIB} - ${MEDCOUPLING_LIB} - ${CDMATHBASE_LIB} - ${CDMATHMESH_LIB} -# ${CDMATHLINEARSOLVER_LIB} - ) diff --git a/CDMATH/cmake_files/FindCPPUNIT.cmake b/CDMATH/cmake_files/FindCPPUNIT.cmake deleted file mode 100755 index 4193644..0000000 --- a/CDMATH/cmake_files/FindCPPUNIT.cmake +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for cppunit ...") - -# ------ - -IF(CPPUNIT_IS_MANDATORY STREQUAL 0) - SET(CPPUNIT_IS_MANDATORY 0) - SET(CPPUNIT_IS_OPTIONAL 1) -ENDIF(CPPUNIT_IS_MANDATORY STREQUAL 0) -IF(CPPUNIT_IS_OPTIONAL STREQUAL 0) - SET(CPPUNIT_IS_MANDATORY 1) - SET(CPPUNIT_IS_OPTIONAL 0) -ENDIF(CPPUNIT_IS_OPTIONAL STREQUAL 0) -IF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL) - SET(CPPUNIT_IS_MANDATORY 0) - SET(CPPUNIT_IS_OPTIONAL 1) -ENDIF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL) - -# ------ - -SET(CPPUNIT_STATUS 1) -IF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) - SET(CPPUNIT_STATUS 0) - MESSAGE(STATUS "cppunit disabled from command line.") -ENDIF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) - -# ------ - -IF(CPPUNIT_STATUS) - IF(WITH_CPPUNIT) - SET(CPPUNIT_ROOT_USER ${WITH_CPPUNIT}) - ELSE(WITH_CPPUNIT) - SET(CPPUNIT_ROOT_USER $ENV{CPPUNIT_ROOT}) - ENDIF(WITH_CPPUNIT) -ENDIF(CPPUNIT_STATUS) - -# ----- - -IF(CPPUNIT_STATUS) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(CPPUNIT_ROOT_USER) - SET(CPPUNIT_FIND_PATHS_OPTION) - ENDIF(CPPUNIT_ROOT_USER) -ENDIF(CPPUNIT_STATUS) - -# ----- - -IF(CPPUNIT_STATUS) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDE_PATHS ${CPPUNIT_ROOT_USER} ${CPPUNIT_ROOT_USER}/include) - ELSE(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDE_PATHS) - ENDIF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDE_TO_FIND cppunit/extensions/HelperMacros.h) - FIND_PATH(CPPUNIT_INCLUDE_DIR ${CPPUNIT_INCLUDE_TO_FIND} PATHS ${CPPUNIT_INCLUDE_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - IF(CPPUNIT_INCLUDE_DIR) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_INCLUDES -I${CPPUNIT_INCLUDE_DIR})# to be removed - IF(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) - SET(CPPUNIT_INCLUDE_DIRS) - ELSE(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) - SET(CPPUNIT_INCLUDE_DIRS ${CPPUNIT_INCLUDE_DIR}) - ENDIF(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) - ENDIF(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} found in ${CPPUNIT_INCLUDE_DIR}") - ELSE(CPPUNIT_INCLUDE_DIR) - SET(CPPUNIT_STATUS 0) - IF(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found in ${CPPUNIT_INCLUDE_PATHS}, check your CPPUNIT installation.") - ELSE(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") - ENDIF(CPPUNIT_ROOT_USER) - ENDIF(CPPUNIT_INCLUDE_DIR) -ENDIF(CPPUNIT_STATUS) - -# ---- - -IF(CPPUNIT_STATUS) - IF(CPPUNIT_ROOT_USER) - SET(CPPUNIT_LIB_PATHS ${CPPUNIT_ROOT_USER}/lib) - ELSE(CPPUNIT_ROOT_USER) - SET(CPPUNIT_LIB_PATHS) - ENDIF(CPPUNIT_ROOT_USER) -ENDIF(CPPUNIT_STATUS) - -IF(CPPUNIT_STATUS) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Debug) - FIND_LIBRARY(CPPUNIT_LIB cppunitd_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) - FIND_LIBRARY(CPPUNIT_LIB cppunit_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) - ELSE(WINDOWS) - FIND_LIBRARY(CPPUNIT_LIB cppunit PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) - ENDIF(WINDOWS) - SET(CPPUNIT_LIBS) - IF(CPPUNIT_LIB) - SET(CPPUNIT_LIBS ${CPPUNIT_LIBS} ${CPPUNIT_LIB}) - MESSAGE(STATUS "cppunit lib found: ${CPPUNIT_LIB}") - ELSE(CPPUNIT_LIB) - SET(CPPUNIT_STATUS 0) - IF(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "cppunit lib not found in ${CPPUNIT_LIB_PATHS}, check your CPPUNIT installation.") - ELSE(CPPUNIT_ROOT_USER) - MESSAGE(STATUS "cppunit lib not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") - ENDIF(CPPUNIT_ROOT_USER) - ENDIF(CPPUNIT_LIB) -ENDIF(CPPUNIT_STATUS) - -# ---- - -IF(CPPUNIT_STATUS) - SET(CPPUNIT_IS_OK 1) - SET(CPPUNIT_DEFINITIONS) - IF(WINDOWS) - SET(CPPUNIT_INCLUDES ${CPPUNIT_INCLUDES} -DCPPUNIT_DLL) - SET(CPPUNIT_DEFINITIONS "-DCPPUNIT_DLL") - ENDIF(WINDOWS) -ELSE(CPPUNIT_STATUS) - IF(CPPUNIT_IS_MANDATORY) - MESSAGE(FATAL_ERROR "cppunit not found ... mandatory ... abort") - ELSE(CPPUNIT_IS_MANDATORY) - MESSAGE(STATUS "cppunit not found ... optional ... disabled") - ENDIF(CPPUNIT_IS_MANDATORY) -ENDIF(CPPUNIT_STATUS) - -# ------ diff --git a/CDMATH/cmake_files/FindMEDFile.cmake b/CDMATH/cmake_files/FindMEDFile.cmake deleted file mode 100644 index 48b99ac..0000000 --- a/CDMATH/cmake_files/FindMEDFile.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# - Find MED file installation -# -# The following variable are set: -# MEDFILE_INCLUDE_DIRS -# MEDFILE_LIBRARIES -# MEDFILE_C_LIBRARIES -# MEDFILE_F_LIBRARIES -# -# The CMake (or environment) variable MEDFILE_ROOT_DIR can be set to -# guide the detection and indicate a root directory to look into. -# -############################################################################ -# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for medfile ...") - -# ------ - -SET(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} CACHE PATH "Path to the MEDFile.") -IF(MEDFILE_ROOT_DIR) - LIST(APPEND CMAKE_PREFIX_PATH "${MEDFILE_ROOT_DIR}") -ENDIF(MEDFILE_ROOT_DIR) - -FIND_PATH(MEDFILE_INCLUDE_DIRS med.h) -#FIND_PROGRAM(MDUMP mdump) -FIND_LIBRARY(MEDFILE_C_LIBRARIES NAMES medC) -FIND_LIBRARY(MEDFILE_F_LIBRARIES NAMES med) -IF(MEDFILE_F_LIBRARIES) - SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES} ${MEDFILE_F_LIBRARIES}) -ELSE(MEDFILE_F_LIBRARIES) - SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES}) -ENDIF(MEDFILE_F_LIBRARIES) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(MEDFile REQUIRED_VARS MEDFILE_INCLUDE_DIRS MEDFILE_LIBRARIES) diff --git a/CDMATH/cmake_files/FindMatplotlib.cmake b/CDMATH/cmake_files/FindMatplotlib.cmake deleted file mode 100644 index 974887e..0000000 --- a/CDMATH/cmake_files/FindMatplotlib.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# - Find the matplotlib libraries -# This module finds IF matplotlib is installed, and sets the following variables -# indicating where it is. -# -# MATPLOTLIB_FOUND - was matplotlib found -# MATPLOTLIB_VERSION - the version of matplotlib found as a string -# MATPLOTLIB_VERSION_MAJOR - the major version number of matplotlib -# MATPLOTLIB_VERSION_MINOR - the minor version number of matplotlib -# MATPLOTLIB_VERSION_PATCH - the patch version number of matplotlib -# MATPLOTLIB_PATH_DIRS - path to the matplotlib include files - -IF(PYTHONINTERP_FOUND) - # Try to import matplotlib into Python interpreter. Python - # interpreter was found previously as required package, so - # don't take care about this. - execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" - "import matplotlib as m; print(m.__version__); print(m.__path__[0]);" - RESULT_VARIABLE _MATPLOTLIB_SEARCH_SUCCESS - OUTPUT_VARIABLE _MATPLOTLIB_VALUES - ERROR_VARIABLE _MATPLOTLIB_ERROR_VALUE - OUTPUT_STRIP_TRAILING_WHITESPACE) - - IF(_MATPLOTLIB_SEARCH_SUCCESS MATCHES 0) - set(MATPLOTLIB_FOUND TRUE) - - # Convert the process output into a list - string(REGEX REPLACE ";" "\\\\;" _MATPLOTLIB_VALUES ${_MATPLOTLIB_VALUES}) - string(REGEX REPLACE "\n" ";" _MATPLOTLIB_VALUES ${_MATPLOTLIB_VALUES}) - list(GET _MATPLOTLIB_VALUES 0 MATPLOTLIB_VERSION) - list(GET _MATPLOTLIB_VALUES 1 MATPLOTLIB_PATH_DIRS) - - # Make sure all directory separators are '/' - string(REGEX REPLACE "\\\\" "/" MATPLOTLIB_PATH_DIRS ${MATPLOTLIB_PATH_DIRS}) - - # Get the major and minor version numbers - string(REGEX REPLACE "\\." ";" _MATPLOTLIB_VERSION_LIST ${MATPLOTLIB_VERSION}) - list(GET _MATPLOTLIB_VERSION_LIST 0 MATPLOTLIB_VERSION_MAJOR) - list(GET _MATPLOTLIB_VERSION_LIST 1 MATPLOTLIB_VERSION_MINOR) - list(GET _MATPLOTLIB_VERSION_LIST 2 MATPLOTLIB_VERSION_PATCH) - ELSE() - set(MATPLOTLIB_FOUND FALSE) - ENDIF() -ELSE() - set(MATPLOTLIB_FOUND FALSE) -ENDIF() - diff --git a/CDMATH/cmake_files/FindPETSc.cmake b/CDMATH/cmake_files/FindPETSc.cmake deleted file mode 100755 index a81c9f9..0000000 --- a/CDMATH/cmake_files/FindPETSc.cmake +++ /dev/null @@ -1,351 +0,0 @@ -# - Try to find PETSc -# Once done this will define -# -# PETSC_FOUND - system has PETSc -# PETSC_INCLUDES - the PETSc include directories -# PETSC_LIBRARIES - Link these to use PETSc -# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI -# PETSC_DEFINITIONS - Compiler switches for using PETSc -# PETSC_MPIEXEC - Executable for running MPI programs -# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR) -# -# Usage: -# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0 -# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler -# find_package(PETSc) - same as above -# -# Setting these changes the behavior of the search -# PETSC_DIR - directory in which PETSc resides -# PETSC_ARCH - build architecture -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -set(PETSC_VALID_COMPONENTS - C - CXX) - -if(NOT PETSc_FIND_COMPONENTS) - set(PETSC_LANGUAGE_BINDINGS "C") -else() - # Right now, this is designed for compatability with the --with-clanguage option, so - # only allow one item in the components list. - list(LENGTH ${PETSc_FIND_COMPONENTS} components_length) - if(${components_length} GREATER 1) - message(FATAL_ERROR "Only one component for PETSc is allowed to be specified") - endif() - # This is a stub for allowing multiple components should that time ever come. Perhaps - # to also test Fortran bindings? - foreach(component ${PETSc_FIND_COMPONENTS}) - list(FIND PETSC_VALID_COMPONENTS ${component} component_location) - if(${component_location} EQUAL -1) - message(FATAL_ERROR "\"${component}\" is not a valid PETSc component.") - else() - list(APPEND PETSC_LANGUAGE_BINDINGS ${component}) - endif() - endforeach() -endif() - -function (petsc_get_version) - if (EXISTS "${PETSC_DIR}/petscversion.h" OR EXISTS "${PETSC_DIR}/include/petscversion.h" OR EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h") - if (EXISTS "${PETSC_DIR}/include/petscversion.h") - file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - elseif( EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" ) - file (STRINGS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - else() - file (STRINGS "${PETSC_DIR}/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - endif() - foreach (line ${vstrings}) - string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define") - list (GET fields 1 var) - list (GET fields 2 val) - set (${var} ${val} PARENT_SCOPE) - set (${var} ${val}) # Also in local scope so we have access below - endforeach () - - if (PETSC_VERSION_RELEASE) - set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE) - else () - # make dev version compare higher than any patch level of a released version - set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE) - endif () - else () - message (SEND_ERROR "PETSC_DIR can not be used, file ${PETSC_DIR}/include/petscversion.h does not exist") - endif () -endfunction () - -find_path (PETSC_DIR include/petsc.h - HINTS ENV PETSC_DIR - PATHS - #RedHat paths - /usr/include/petsc - # Debian paths - /usr/lib/petscdir/3.12.4 /usr/lib/petscdir/3.12 #Ubuntu 20.04 - /usr/lib/petscdir/3.7.6 /usr/lib/petscdir/3.7 #Ubuntu 18.04 - /usr/lib/petscdir/3.6.2 /usr/lib/petscdir/3.6 #Ubuntu 16.04 - /usr/lib/petscdir/3.5.1 /usr/lib/petscdir/3.5 - /usr/lib/petscdir/3.4.2 /usr/lib/petscdir/3.4 - /usr/lib/petscdir/3.3 /usr/lib/petscdir/3.2 /usr/lib/petscdir/3.1 - /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 - # MacPorts path - /opt/local/lib/petsc - $ENV{HOME}/petsc - DOC "PETSc Directory") - -find_program (MAKE_EXECUTABLE NAMES make gmake) - -if (PETSC_DIR AND NOT PETSC_ARCH) - set (_petsc_arches - $ENV{PETSC_ARCH} # If set, use environment variable first - linux-gnu-c-debug linux-gnu-c-opt # old Debian defaults (petsc compilation) - arch-linux-c-opt or arch-linux-c-debug # new Debian defaults (petsc compilation) - x86_64-linux-gnu-real i686-linux-gnu-real # Debian defaults (petsc system installation) - arch-linux2-c-opt or arch-linux2-c-debug # old RedHat defaults (petsc compilation) - x86_64-redhat-linux-gnu i686-redhat-linux-gnu # RedHat defaults (petsc apt installation) - x86_64-unknown-linux-gnu i386-unknown-linux-gnu) - set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - foreach (arch ${_petsc_arches}) - if (NOT PETSC_ARCH) - find_path (petscconf petscconf.h - HINTS ${PETSC_DIR} - PATH_SUFFIXES ${arch}/include bmake/${arch} - NO_DEFAULT_PATH) - if (petscconf) - set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture") - endif (petscconf) - endif (NOT PETSC_ARCH) - endforeach (arch) - set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) -endif (PETSC_DIR AND NOT PETSC_ARCH) - -set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS - INCLUDE_DIR INCLUDE_CONF) -include (FindPackageMultipass) -find_package_multipass (PETSc petsc_config_current - STATES DIR ARCH - DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves}) - -# Determine whether the PETSc layout is old-style (through 2.3.3) or -# new-style (>= 3.0.0) -if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables") # > 3.5 - set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules") - set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") -elseif (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3 - set (petsc_conf_rules "${PETSC_DIR}/conf/rules") - set (petsc_conf_variables "${PETSC_DIR}/conf/variables") -elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3 - set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules") - set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables") -elseif (PETSC_DIR) - message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation") -endif () - -if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current) - petsc_get_version() - - # Put variables into environment since they are needed to get - # configuration (petscvariables) in the PETSc makefile - set (ENV{PETSC_DIR} "${PETSC_DIR}") - set (ENV{PETSC_ARCH} "${PETSC_ARCH}") - - # A temporary makefile to probe the PETSc configuration - set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc") - file (WRITE "${petsc_config_makefile}" -"## This file was autogenerated by FindPETSc.cmake -# PETSC_DIR = ${PETSC_DIR} -# PETSC_ARCH = ${PETSC_ARCH} -include ${petsc_conf_rules} -include ${petsc_conf_variables} -show : -\t-@echo -n \${\${VARIABLE}} -") - - macro (PETSC_GET_VARIABLE name var) - set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name} - OUTPUT_VARIABLE ${var} - RESULT_VARIABLE petsc_return) - endmacro (PETSC_GET_VARIABLE) - petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir) - petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external) - petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line) - petsc_get_variable (PETSC_INCLUDE petsc_include) - petsc_get_variable (PCC petsc_cc) - petsc_get_variable (PCC_FLAGS petsc_cc_flags) - petsc_get_variable (MPIEXEC petsc_mpiexec) - # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid! - file (REMOVE ${petsc_config_makefile}) - - include (ResolveCompilerPaths) - # Extract include paths and libraries from compile command line - resolve_includes (petsc_includes_all "${petsc_cpp_line}") - - #on windows we need to make sure we're linking against the right - #runtime library - if (WIN32) - if (petsc_cc_flags MATCHES "-MT") - set(using_md False) - foreach(flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - set(using_md True) - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - if(${using_md} MATCHES "True") - message(WARNING "PETSc was built with /MT, but /MD is currently set. - See http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F") - endif(${using_md} MATCHES "True") - endif (petsc_cc_flags MATCHES "-MT") - endif (WIN32) - - include (CorrectWindowsPaths) - convert_cygwin_path(petsc_lib_dir) - message (STATUS "petsc_lib_dir ${petsc_lib_dir}") - - macro (PETSC_FIND_LIBRARY suffix name) - set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again - if (WIN32) - set (libname lib${name}) #windows expects "libfoo", linux expects "foo" - else (WIN32) - set (libname ${name}) - endif (WIN32) - find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH) - set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}") - mark_as_advanced (PETSC_LIBRARY_${suffix}) - endmacro (PETSC_FIND_LIBRARY suffix name) - - # Look for petscvec first, if it doesn't exist, we must be using single-library - petsc_find_library (VEC petscvec) - if (PETSC_LIBRARY_VEC) - petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced) - petsc_find_library (MAT petscmat) - petsc_find_library (DM petscdm) - petsc_find_library (KSP petscksp) - petsc_find_library (SNES petscsnes) - petsc_find_library (TS petscts) - macro (PETSC_JOIN libs deps) - list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}}) - endmacro (PETSC_JOIN libs deps) - petsc_join (VEC SYS) - petsc_join (MAT VEC) - petsc_join (DM MAT) - petsc_join (KSP DM) - petsc_join (SNES KSP) - petsc_join (TS SNES) - petsc_join (ALL TS) - else () - set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec - petsc_find_library (SINGLE petsc) #check existence of libpetsc.so - if (NOT PETSC_LIBRARY_SINGLE) - petsc_find_library (SINGLE petsc_real) #check existence of libpetsc_real.so - endif() - if (NOT PETSC_LIBRARY_SINGLE) - petsc_find_library (SINGLE petsc_complex) #check existence of libpetsc_complex.so - endif() - foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}") - endforeach () - endif () - if (PETSC_LIBRARY_TS) - message (STATUS "Recognized PETSc install with separate libraries for each package") - else () - message (STATUS "Recognized PETSc install with single library for all packages") - endif () - - include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns) - macro (PETSC_TEST_RUNS includes libraries runs) - if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C") - set(_PETSC_ERR_FUNC "CHKERRQ(ierr)") - elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX") - set(_PETSC_ERR_FUNC "CHKERRXX(ierr)") - endif() - if (PETSC_VERSION VERSION_GREATER 3.1) - set (_PETSC_TSDestroy "TSDestroy(&ts)") - else () - set (_PETSC_TSDestroy "TSDestroy(ts)") - endif () - - set(_PETSC_TEST_SOURCE " -static const char help[] = \"PETSc test program.\"; -#include -int main(int argc,char *argv[]) { - PetscErrorCode ierr; - TS ts; - - ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC}; - ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC}; - ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC}; - ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC}; - ierr = PetscFinalize();${_PETSC_ERR_FUNC}; - return 0; -} -") - multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}") - if (${${runs}}) - set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL - "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE) - endif (${${runs}}) - endmacro (PETSC_TEST_RUNS) - - - find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH) - find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH) - mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF) - set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR}) - - petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal) - if (petsc_works_minimal) - message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.") - set (petsc_includes_needed "${petsc_includes_minimal}") - else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes) - if (petsc_works_allincludes) # It does, we just need all the includes ( - message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).") - set (petsc_includes_needed ${petsc_includes_all}) - else (petsc_works_allincludes) # We are going to need to link the external libs explicitly - resolve_libraries (petsc_libraries_external "${petsc_libs_external}") - foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external}) - endforeach (pkg) - petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries) - if (petsc_works_alllibraries) - message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.") - set (petsc_includes_needed ${petsc_includes_minimal}) - else (petsc_works_alllibraries) - # It looks like we really need everything, should have listened to Matt - set (petsc_includes_needed ${petsc_includes_all}) - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all) - if (petsc_works_all) # We fail anyways - message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.") - else (petsc_works_all) # We fail anyways - message (STATUS "PETSc could not be used, maybe the install is broken.") - endif (petsc_works_all) - endif (petsc_works_alllibraries) - endif (petsc_works_allincludes) - endif (petsc_works_minimal) - - # We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous - if (${PETSC_VERSION} VERSION_LESS 3.1) - set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE) - else () - set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE) - endif () - # Sometimes this can be used to assist FindMPI.cmake - set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE) - set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE) - set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE) - set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE) - # Note that we have forced values for all these choices. If you - # change these, you are telling the system to trust you that they - # work. It is likely that you will end up with a broken build. - mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS) -endif () - -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (PETSc - "PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH." - PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) diff --git a/CDMATH/cmake_files/FindPYTHON.cmake b/CDMATH/cmake_files/FindPYTHON.cmake deleted file mode 100755 index 8139e53..0000000 --- a/CDMATH/cmake_files/FindPYTHON.cmake +++ /dev/null @@ -1,181 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#[=======================================================================[.rst: -FindPython ----------- - -Find Python interpreter, compiler and development environment (include -directories and libraries). - -Three components are supported: - -* ``Interpreter``: search for Python interpreter. -* ``Compiler``: search for Python compiler. Only offered by IronPython. -* ``Development``: search for development artifacts (include directories and - libraries). - -If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. - -To ensure consistent versions between components ``Interpreter``, ``Compiler`` -and ``Development``, specify all components at the same time:: - - find_package (Python COMPONENTS Interpreter Development) - -This module looks preferably for version 3 of Python. If not found, version 2 -is searched. -To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and -:module:`FindPython2` modules rather than this one. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module defines the following :ref:`Imported Targets `: - -``Python::Interpreter`` - Python interpreter. Target defined if component ``Interpreter`` is found. -``Python::Compiler`` - Python compiler. Target defined if component ``Compiler`` is found. -``Python::Python`` - Python library. Target defined if component ``Development`` is found. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module will set the following variables in your project -(see :ref:`Standard Variable Names `): - -``Python_FOUND`` - System has the Python requested components. -``Python_Interpreter_FOUND`` - System has the Python interpreter. -``Python_EXECUTABLE`` - Path to the Python interpreter. -``Python_INTERPRETER_ID`` - A short string unique to the interpreter. Possible values include: - * Python - * ActivePython - * Anaconda - * Canopy - * IronPython -``Python_STDLIB`` - Standard platform independent installation directory. - - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. -``Python_STDARCH`` - Standard platform dependent installation directory. - - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. -``Python_SITELIB`` - Third-party platform independent installation directory. - - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. -``Python_SITEARCH`` - Third-party platform dependent installation directory. - - Information returned by - ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. -``Python_Compiler_FOUND`` - System has the Python compiler. -``Python_COMPILER`` - Path to the Python compiler. Only offered by IronPython. -``Python_COMPILER_ID`` - A short string unique to the compiler. Possible values include: - * IronPython -``Python_Development_FOUND`` - System has the Python development artifacts. -``Python_INCLUDE_DIRS`` - The Python include directories. -``Python_LIBRARIES`` - The Python libraries. -``Python_LIBRARY_DIRS`` - The Python library directories. -``Python_RUNTIME_LIBRARY_DIRS`` - The Python runtime library directories. -``Python_VERSION`` - Python version. -``Python_VERSION_MAJOR`` - Python major version. -``Python_VERSION_MINOR`` - Python minor version. -``Python_VERSION_PATCH`` - Python patch version. - -Hints -^^^^^ - -``Python_ROOT_DIR`` - Define the root directory of a Python installation. - -``Python_USE_STATIC_LIBS`` - * If not defined, search for shared libraries and static libraries in that - order. - * If set to TRUE, search **only** for static libraries. - * If set to FALSE, search **only** for shared libraries. - -Commands -^^^^^^^^ - -This module defines the command ``Python_add_library`` which have the same -semantic as :command:`add_library` but take care of Python module naming rules -(only applied if library is of type ``MODULE``) and add dependency to target -``Python::Python``:: - - Python_add_library (my_module MODULE src1.cpp) - -If library type is not specified, ``MODULE`` is assumed. -#]=======================================================================] - - -set (_PYTHON_PREFIX Python) - -if (DEFINED Python_FIND_VERSION) - set (_Python_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR}) - - include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) -else() - # iterate over versions in quiet and NOT required modes to avoid multiple - # "Found" messages and prematurally failure. - set (_Python_QUIETLY ${Python_FIND_QUIETLY}) - set (_Python_REQUIRED ${Python_FIND_REQUIRED}) - set (Python_FIND_QUIETLY TRUE) - set (Python_FIND_REQUIRED FALSE) - - set (_Python_REQUIRED_VERSIONS 3 2) - set (_Python_REQUIRED_VERSION_LAST 2) - - foreach (_Python_REQUIRED_VERSION_MAJOR IN LISTS _Python_REQUIRED_VERSIONS) - set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR}) - include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) - if (Python_FOUND OR - _Python_REQUIRED_VERSION_MAJOR EQUAL _Python_REQUIRED_VERSION_LAST) - break() - endif() - # clean-up some CACHE variables to ensure look-up restart from scratch - foreach (_Python_ITEM IN LISTS _Python_CACHED_VARS) - unset (${_Python_ITEM} CACHE) - endforeach() - endforeach() - - unset (Python_FIND_VERSION) - - set (Python_FIND_QUIETLY ${_Python_QUIETLY}) - set (Python_FIND_REQUIRED ${_Python_REQUIRED}) - if (Python_FIND_REQUIRED OR NOT Python_FIND_QUIETLY) - # call again validation command to get "Found" or error message - find_package_handle_standard_args (Python HANDLE_COMPONENTS - REQUIRED_VARS ${_Python_REQUIRED_VARS} - VERSION_VAR Python_VERSION) - endif() -endif() - -if (COMMAND __Python_add_library) - macro (Python_add_library) - __Python_add_library (Python ${ARGV}) - endmacro() -endif() - -unset (_PYTHON_PREFIX) diff --git a/CDMATH/cmake_files/FindPackageMultipass.cmake b/CDMATH/cmake_files/FindPackageMultipass.cmake deleted file mode 100644 index fa350a9..0000000 --- a/CDMATH/cmake_files/FindPackageMultipass.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# PackageMultipass - this module defines two macros -# -# FIND_PACKAGE_MULTIPASS (Name CURRENT -# STATES VAR0 VAR1 ... -# DEPENDENTS DEP0 DEP1 ...) -# -# This function creates a cache entry _CURRENT which -# the user can set to "NO" to trigger a reconfiguration of the package. -# The first time this function is called, the values of -# _VAR0, ... are saved. If _CURRENT -# is false or if any STATE has changed since the last time -# FIND_PACKAGE_MULTIPASS() was called, then CURRENT will be set to "NO", -# otherwise CURRENT will be "YES". IF not CURRENT, then -# _DEP0, ... will be FORCED to NOTFOUND. -# Example: -# find_path (FOO_DIR include/foo.h) -# FIND_PACKAGE_MULTIPASS (Foo foo_current -# STATES DIR -# DEPENDENTS INCLUDES LIBRARIES) -# if (NOT foo_current) -# # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES -# endif (NOT foo_current) -# -# MULTIPASS_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS LANGUAGE) -# Always runs the given test, use this when you need to re-run tests -# because parent variables have made old cache entries stale. The LANGUAGE -# variable is either C or CXX indicating which compiler the test should -# use. -# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS) -# DEPRECATED! This is only included for backwards compatability. Use -# the more general MULTIPASS_SOURCE_RUNS instead. -# Always runs the given test, use this when you need to re-run tests -# because parent variables have made old cache entries stale. - -macro (FIND_PACKAGE_MULTIPASS _name _current) - string (TOUPPER ${_name} _NAME) - set (_args ${ARGV}) - list (REMOVE_AT _args 0 1) - - set (_states_current "YES") - list (GET _args 0 _cmd) - if (_cmd STREQUAL "STATES") - list (REMOVE_AT _args 0) - list (GET _args 0 _state) - while (_state AND NOT _state STREQUAL "DEPENDENTS") - # The name of the stored value for the given state - set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state}) - if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") - set (_states_current "NO") - endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") - set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE) - list (REMOVE_AT _args 0) - list (GET _args 0 _state) - endwhile (_state AND NOT _state STREQUAL "DEPENDENTS") - endif (_cmd STREQUAL "STATES") - - set (_stored ${_NAME}_CURRENT) - if (NOT ${_stored}) - set (${_stored} "YES" CACHE BOOL "Is the configuration for ${_name} current? Set to \"NO\" to reconfigure." FORCE) - set (_states_current "NO") - endif (NOT ${_stored}) - - set (${_current} ${_states_current}) - if (NOT ${_current} AND PACKAGE_MULTIPASS_${_name}_CALLED) - message (STATUS "Clearing ${_name} dependent variables") - # Clear all the dependent variables so that the module can reset them - list (GET _args 0 _cmd) - if (_cmd STREQUAL "DEPENDENTS") - list (REMOVE_AT _args 0) - foreach (dep ${_args}) - set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - endforeach (dep) - endif (_cmd STREQUAL "DEPENDENTS") - set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - endif () - set (PACKAGE_MULTIPASS_${name}_CALLED YES CACHE INTERNAL "Private" FORCE) -endmacro (FIND_PACKAGE_MULTIPASS) - - -macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language) - include (Check${language}SourceRuns) - # This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the - # *name* of the return variable doesn't change, then the test does - # not need to be re-run. We keep an internal count which we - # increment to guarantee that every test name is unique. If we've - # gotten here, then the configuration has changed enough that the - # test *needs* to be rerun. - if (NOT MULTIPASS_TEST_COUNT) - set (MULTIPASS_TEST_COUNT 00) - endif (NOT MULTIPASS_TEST_COUNT) - math (EXPR _tmp "${MULTIPASS_TEST_COUNT} + 1") # Why can't I add to a cache variable? - set (MULTIPASS_TEST_COUNT ${_tmp} CACHE INTERNAL "Unique test ID") - set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs}) - set (CMAKE_REQUIRED_INCLUDES ${includes}) - set (CMAKE_REQUIRED_LIBRARIES ${libraries}) - if(${language} STREQUAL "C") - check_c_source_runs ("${source}" ${testname}) - elseif(${language} STREQUAL "CXX") - check_cxx_source_runs ("${source}" ${testname}) - endif() - set (${runs} "${${testname}}") -endmacro (MULTIPASS_SOURCE_RUNS) - -macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs) - multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C") -endmacro (MULTIPASS_C_SOURCE_RUNS) diff --git a/CDMATH/cmake_files/FindParaView.cmake b/CDMATH/cmake_files/FindParaView.cmake deleted file mode 100755 index c6b786d..0000000 --- a/CDMATH/cmake_files/FindParaView.cmake +++ /dev/null @@ -1,224 +0,0 @@ -#[==[.md -# paraview-config.cmake - -This file is used by CMake when finding ParaView. - -The following variables are provided by this module: - - * `ParaView_VERSION`: The version of ParaView found. - * `ParaView_PREFIX_PATH`: Install prefix for ParaView. - * `PARAVIEW_USE_QT`: If ParaView's Qt GUI is available. - * `PARAVIEW_USE_MPI`: If ParaView is built with MPI support. - * `PARAVIEW_USE_PYTHON`: If ParaView is built with Python support. - * `PARAVIEW_PYTHONPATH`: Where ParaView's Python modules live under the - install prefix. Unset if Python is not available. - * `PARAVIEW_PLUGIN_SUBDIR`: The subdirectory under the library directory for - plugins. - * `ParaView_CLIENT_XML_FILES`: XML files for client applications to use to - reproduce ParaView's menu items. Only provided if `PARAVIEW_USE_QT` - is set. - * `ParaView_LIBRARIES`: The list of modules specified by `COMPONENTS` and - `OPTIONAL_COMPONENTS`. This may be used in `MODULES` arguments in the API - (e.g., `vtk_module_autoinit`). All modules are also targets and may be - linked to using `target_link_libraries`. -#]==] - -set(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save "${CMAKE_MODULE_PATH}") -list(INSERT CMAKE_MODULE_PATH 0 - "${CMAKE_CURRENT_LIST_DIR}") - -set("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save" "${CMAKE_PREFIX_PATH}") -include("${CMAKE_CURRENT_LIST_DIR}/paraview-prefix.cmake") -set("${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH" - "${_vtk_module_import_prefix}") -unset(_vtk_module_import_prefix) -list(INSERT CMAKE_PREFIX_PATH 0 - "${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}") - -set("${CMAKE_FIND_PACKAGE_NAME}_VERSION" "@PARAVIEW_VERSION_FULL@") - -unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND") - -set(_paraview_use_external_vtk "@PARAVIEW_USE_EXTERNAL_VTK@") -set(_paraview_find_package_args) -if (NOT _paraview_use_external_vtk) - list(APPEND _paraview_find_package_args - PATHS "${CMAKE_CURRENT_LIST_DIR}/vtk" - NO_DEFAULT_PATH) -endif () -if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - list(APPEND _paraview_find_package_args - QUIET) -endif () -find_package(VTK REQUIRED - ${_paraview_find_package_args}) -if (NOT VTK_FOUND) - set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) -endif () -unset(_paraview_find_package_args) -unset(_paraview_use_external_vtk) - -set(PARAVIEW_USE_QT "@PARAVIEW_USE_QT@") -set(PARAVIEW_USE_MPI "@PARAVIEW_USE_MPI@") -set(PARAVIEW_USE_PYTHON "@PARAVIEW_USE_PYTHON@") -set(PARAVIEW_PLUGIN_SUBDIR "paraview@paraview_version_suffix@/plugins") - -if (PARAVIEW_USE_PYTHON) - set(PARAVIEW_PYTHONPATH "@PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX@") - include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPython-targets.cmake") - # Unset this for now; these targets will be defined later. - unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND") - unset("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE") -endif () - -include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-properties.cmake") - -include("${CMAKE_CURRENT_LIST_DIR}/paraview-find-package-helpers.cmake" OPTIONAL) -include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake") - -include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview_plugins-targets-depends.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-targets.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview-plugin-properties.cmake") - -include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTools-targets.cmake" OPTIONAL) - -include("${CMAKE_CURRENT_LIST_DIR}/ParaViewClient.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPlugin.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/ParaViewServerManager.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTesting.cmake") -include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapClientServer.cmake") - -if (@PARAVIEW_USE_PYTHON@) # PARAVIEW_USE_PYTHON - include("${CMAKE_CURRENT_LIST_DIR}/paraview.modules-vtk-python-module-properties.cmake") -endif () - -if (@PARAVIEW_USE_QT@) # PARAVIEW_USE_QT - include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Client-targets.cmake") - include("${CMAKE_CURRENT_LIST_DIR}/ParaView-client-xml.cmake") -endif () - -set(_paraview_components_to_check) -foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") - if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND") - # It was already not-found (likely due to `find-package` failures). - elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}") - list(APPEND _paraview_components_to_check - "${_paraview_component}") - else () - set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0) - list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE" - "The ${_paraview_component} component is not available.") - endif () -endforeach () -unset(_paraview_component) - -set(_paraview_vtk_components) - -while (_paraview_components_to_check) - list(GET _paraview_components_to_check 0 _paraview_component) - list(REMOVE_AT _paraview_components_to_check 0) - if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND") - # We've already made a determiniation. - continue () - endif () - - get_property(_paraview_dependencies - TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}" - PROPERTY "INTERFACE_paraview_module_depends") - string(REPLACE "${CMAKE_FIND_PACKAGE_NAME}::" "" _paraview_dependencies "${_paraview_dependencies}") - set(_paraview_all_dependencies_checked TRUE) - foreach (_paraview_dependency IN LISTS _paraview_dependencies) - # Handle VTK module dependencies. - string(FIND "${_paraview_component}" "VTK::" _paraview_vtk_idx) - if (NOT _paraview_vtk_idx EQUAL -1) - unset(_paraview_vtk_idx) - if (NOT TARGET "${_paraview_dependency}") - set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0) - list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE" - "Failed to find the ${_paraview_dependency} module.") - endif () - continue () - endif () - unset(_paraview_vtk_idx) - - if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND") - if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND) - set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0) - list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE" - "Failed to find the ${_paraview_dependency} component.") - endif () - else () - # Check its dependencies. - list(APPEND _paraview_components_to_check - "${_paraview_dependency}") - set(_paraview_all_found FALSE) - endif () - endforeach () - if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND") - if (_paraview_all_dependencies_checked) - set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 1) - else () - list(APPEND _paraview_components_to_check - "${_paraview_component}") - endif () - endif () - unset(_paraview_all_dependencies_checked) - unset(_paraview_dependency) - unset(_paraview_dependencies) -endwhile () -unset(_paraview_component) -unset(_paraview_components_to_check) - -set(_paraview_missing_components) -foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") - if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND AND ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_paraview_component}) - list(APPEND _paraview_missing_components - "${_paraview_component}") - endif () -endforeach () - -if (_paraview_missing_components) - list(REMOVE_DUPLICATES _paraview_missing_components) - list(SORT _paraview_missing_components) - string(REPLACE ";" ", " _paraview_missing_components "${_paraview_missing_components}") - set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) - set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" - "Could not find the ${CMAKE_FIND_PACKAGE_NAME} package with the following required components: ${_paraview_missing_components}.") -endif () -unset(_paraview_missing_components) - -set("${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES") -if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND") - # If nothing went wrong, we've successfully found the package. - set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1) - # Build the `_LIBRARIES` variable. - foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") - list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES" - "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}") - endforeach () - unset(_paraview_component) -endif () - -set(CMAKE_PREFIX_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save}") -unset("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save") - -set(CMAKE_MODULE_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save}") -unset(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save) - -# Compatibility with old code. -if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) - set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-deprecated.cmake") -elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 5.7) - set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-compat.cmake") -else () - set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-error.cmake") -endif () - -# 5.8 renamed these variables, so provide them if 5.8 is not the minimum -# requested. -if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION OR - ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS "5.8") - set(PARAVIEW_BUILD_QT_GUI "${PARAVIEW_USE_QT}") - set(PARAVIEW_ENABLE_PYTHON "${PARAVIEW_USE_PYTHON}") -endif () diff --git a/CDMATH/cmake_files/FindVTK.cmake b/CDMATH/cmake_files/FindVTK.cmake deleted file mode 100644 index ad4990d..0000000 --- a/CDMATH/cmake_files/FindVTK.cmake +++ /dev/null @@ -1,142 +0,0 @@ -# - Find a VTK installation or build tree. -# The following variables are set if VTK is found. If VTK is not -# found, VTK_FOUND is set to false. -# VTK_FOUND - Set to true when VTK is found. -# VTK_USE_FILE - CMake file to use VTK. -# VTK_MAJOR_VERSION - The VTK major version number. -# VTK_MINOR_VERSION - The VTK minor version number -# (odd non-release). -# VTK_BUILD_VERSION - The VTK patch level -# (meaningless for odd minor). -# VTK_INCLUDE_DIRS - Include directories for VTK -# VTK_LIBRARY_DIRS - Link directories for VTK libraries -# VTK_KITS - List of VTK kits, in CAPS -# (COMMON,IO,) etc. -# VTK_LANGUAGES - List of wrapped languages, in CAPS -# (TCL, PYHTON,) etc. -# The following cache entries must be set by the user to locate VTK: -# VTK_DIR - The directory containing VTKConfig.cmake. -# This is either the root of the build tree, -# or the lib/vtk directory. This is the -# only cache entry. -# The following variables are set for backward compatibility and -# should not be used in new code: -# USE_VTK_FILE - The full path to the UseVTK.cmake file. -# This is provided for backward -# compatibility. Use VTK_USE_FILE -# instead. -# - -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distributed this file outside of CMake, substitute the full -# License text for the above reference.) - -# Assume not found. -SET(VTK_FOUND 0) - -# VTK 4.0 did not provide VTKConfig.cmake. -IF("${VTK_FIND_VERSION}" VERSION_LESS 4.1) - SET(_VTK_40_ALLOW 1) - IF(VTK_FIND_VERSION) - SET(_VTK_40_ONLY 1) - ENDIF() -ENDIF() - -# Construct consitent error messages for use below. -SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") -IF(_VTK_40_ALLOW) - SET(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") -ENDIF() -SET(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") - -# Check whether VTK 4.0 has already been found. -IF(_VTK_40_ALLOW AND VTK_DIR) - IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - SET(VTK_FOUND 1) - INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. - ENDIF() -ENDIF() - -# Use the Config mode of the find_package() command to find VTKConfig. -# If this succeeds (possibly because VTK_DIR is already set), the -# command will have already loaded VTKConfig.cmake and set VTK_FOUND. -IF(NOT _VTK_40_ONLY AND NOT VTK_FOUND) - FIND_PACKAGE(VTK QUIET NO_MODULE) -ENDIF() - -# Special search for VTK 4.0. -IF(_VTK_40_ALLOW AND NOT VTK_DIR) - # Old scripts may set these directories in the CMakeCache.txt file. - # They can tell us where to find VTKConfig.cmake. - SET(VTK_DIR_SEARCH_LEGACY "") - IF(VTK_BINARY_PATH AND USE_BUILT_VTK) - SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) - ENDIF(VTK_BINARY_PATH AND USE_BUILT_VTK) - IF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} - ${VTK_INSTALL_PATH}/lib/vtk) - ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) - - # Look for UseVTK.cmake in build trees or under /include/vtk. - FIND_PATH(VTK_DIR - NAMES UseVTK.cmake - PATH_SUFFIXES vtk-4.0 vtk - HINTS $ENV{VTK_DIR} - - PATHS - - # Support legacy cache files. - ${VTK_DIR_SEARCH_LEGACY} - - # Read from the CMakeSetup registry entries. It is likely that - # VTK will have been recently built. - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] - - # Help the user find it if we cannot. - DOC "The ${VTK_DIR_DESCRIPTION}" - ) - - IF(VTK_DIR) - IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) - SET(VTK_FOUND 1) - INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. - ELSE() - # We found the wrong version. Pretend we did not find it. - SET(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) - ENDIF() - ENDIF() -ENDIF() - -#----------------------------------------------------------------------------- -IF(VTK_FOUND) - # Set USE_VTK_FILE for backward-compatability. - SET(USE_VTK_FILE ${VTK_USE_FILE}) -ELSE(VTK_FOUND) - # VTK not found, explain to the user how to specify its location. - IF(VTK_FIND_REQUIRED) - MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE}) - ELSE(VTK_FIND_REQUIRED) - IF(NOT VTK_FIND_QUIETLY) - MESSAGE(STATUS ${VTK_DIR_MESSAGE}) - ENDIF(NOT VTK_FIND_QUIETLY) - ENDIF(VTK_FIND_REQUIRED) -ENDIF(VTK_FOUND) - diff --git a/CDMATH/cmake_files/FindXDR.cmake b/CDMATH/cmake_files/FindXDR.cmake deleted file mode 100644 index be0d6ac..0000000 --- a/CDMATH/cmake_files/FindXDR.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -MESSAGE(STATUS "Check for XDR ...") - -INCLUDE(FindPackageHandleStandardArgs) - -FIND_PATH(XDR_INCLUDE_DIRS rpc/xdr.h PATH_SUFFIXES tirpc) -IF(XDR_INCLUDE_DIRS) - SET(XDR_DEFINITIONS "-DHAS_XDR") -ENDIF(XDR_INCLUDE_DIRS) - -IF(WIN32) - FIND_LIBRARY(XDR_LIBRARIES xdr) # To get the .lib file from XDR - FIND_PATH(XDR_INCLUDE_DIRS2 stdint.h PATH_SUFFIXES src/msvc) # To get the stdint.h from XDR (needed by types.h) - IF(XDR_INCLUDE_DIRS) - IF(XDR_INCLUDE_DIRS2) - LIST(APPEND XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}") - ELSE() - SET(XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}") # Make the detection fail - ENDIF() - ENDIF() - FIND_PACKAGE_HANDLE_STANDARD_ARGS(XDR REQUIRED_VARS XDR_INCLUDE_DIRS XDR_LIBRARIES) -ELSE(WIN32) - FIND_LIBRARY(XDR_LIBRARY NAMES tirpc xdr) - IF(NOT XDR_LIBRARY) - MESSAGE(STATUS "Could not find XDR libraries ...") - ELSE() - MESSAGE(STATUS "Found XDR libraries ${XDR_LIBRARY} ...") - SET(XDR_LIBRARIES ${XDR_LIBRARY}) - ENDIF() - FIND_PACKAGE_HANDLE_STANDARD_ARGS(XDR REQUIRED_VARS XDR_INCLUDE_DIRS) -ENDIF(WIN32) diff --git a/CDMATH/cmake_files/ResolveCompilerPaths.cmake b/CDMATH/cmake_files/ResolveCompilerPaths.cmake deleted file mode 100644 index 6610e30..0000000 --- a/CDMATH/cmake_files/ResolveCompilerPaths.cmake +++ /dev/null @@ -1,105 +0,0 @@ -# ResolveCompilerPaths - this module defines two macros -# -# RESOLVE_LIBRARIES (XXX_LIBRARIES LINK_LINE) -# This macro is intended to be used by FindXXX.cmake modules. -# It parses a compiler link line and resolves all libraries -# (-lfoo) using the library path contexts (-L/path) in scope. -# The result in XXX_LIBRARIES is the list of fully resolved libs. -# Example: -# -# RESOLVE_LIBRARIES (FOO_LIBRARIES "-L/A -la -L/B -lb -lc -ld") -# -# will be resolved to -# -# FOO_LIBRARIES:STRING="/A/liba.so;/B/libb.so;/A/libc.so;/usr/lib/libd.so" -# -# if the filesystem looks like -# -# /A: liba.so libc.so -# /B: liba.so libb.so -# /usr/lib: liba.so libb.so libc.so libd.so -# -# and /usr/lib is a system directory. -# -# Note: If RESOLVE_LIBRARIES() resolves a link line differently from -# the native linker, there is a bug in this macro (please report it). -# -# RESOLVE_INCLUDES (XXX_INCLUDES INCLUDE_LINE) -# This macro is intended to be used by FindXXX.cmake modules. -# It parses a compile line and resolves all includes -# (-I/path/to/include) to a list of directories. Other flags are ignored. -# Example: -# -# RESOLVE_INCLUDES (FOO_INCLUDES "-I/A -DBAR='\"irrelevant -I/string here\"' -I/B") -# -# will be resolved to -# -# FOO_INCLUDES:STRING="/A;/B" -# -# assuming both directories exist. -# Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry) -include (CorrectWindowsPaths) - -macro (RESOLVE_LIBRARIES LIBS LINK_LINE) - string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}") - set (_libs_found) - set (_directory_list) - foreach (token ${_all_tokens}) - if (token MATCHES "-L([^\" ]+|\"[^\"]+\")") - # If it's a library path, add it to the list - string (REGEX REPLACE "^-L" "" token ${token}) - string (REGEX REPLACE "//" "/" token ${token}) - convert_cygwin_path(token) - list (APPEND _directory_list ${token}) - elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))") - # It's a library, resolve the path by looking in the list and then (by default) in system directories - if (WIN32) #windows expects "libfoo", linux expects "foo" - string (REGEX REPLACE "^-l" "lib" token ${token}) - else (WIN32) - string (REGEX REPLACE "^-l" "" token ${token}) - endif (WIN32) - set (_root) - if (token MATCHES "^/") # We have an absolute path - #separate into a path and a library name: - string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token}) - string (REGEX MATCH ".*[^${libname}$]" libpath ${token}) - convert_cygwin_path(libpath) - set (_directory_list ${_directory_list} ${libpath}) - set (token ${libname}) - endif (token MATCHES "^/") - set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_library (_lib ${token} HINTS ${_directory_list} ${_root}) - if (_lib) - string (REPLACE "//" "/" _lib ${_lib}) - list (APPEND _libs_found ${_lib}) - else (_lib) - message (STATUS "Unable to find library ${token}") - endif (_lib) - endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")") - endforeach (token) - set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) - # only the LAST occurence of each library is required since there should be no circular dependencies - if (_libs_found) - list (REVERSE _libs_found) - list (REMOVE_DUPLICATES _libs_found) - list (REVERSE _libs_found) - endif (_libs_found) - set (${LIBS} "${_libs_found}") -endmacro (RESOLVE_LIBRARIES) - -macro (RESOLVE_INCLUDES INCS COMPILE_LINE) - string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}") - set (_incs_found "") - foreach (token ${_all_tokens}) - string (REGEX REPLACE "^-I" "" token ${token}) - string (REGEX REPLACE "//" "/" token ${token}) - convert_cygwin_path(token) - if (EXISTS ${token}) - list (APPEND _incs_found ${token}) - else (EXISTS ${token}) - message (STATUS "Include directory ${token} does not exist") - endif (EXISTS ${token}) - endforeach (token) - list (REMOVE_DUPLICATES _incs_found) - set (${INCS} "${_incs_found}") -endmacro (RESOLVE_INCLUDES) diff --git a/CDMATH/env_CDMATH.sh b/CDMATH/env_CDMATH.sh index a7ab61b..d878806 100755 --- a/CDMATH/env_CDMATH.sh +++ b/CDMATH/env_CDMATH.sh @@ -7,7 +7,7 @@ export PETSC_INCLUDES=@PETSC_INCLUDES_INSTALL@ export PETSC_LIBRARIES=@PETSC_DIR@/@PETSC_ARCH@/lib export MEDFILE_ROOT_DIR=@MEDFILE_ROOT_DIR@ export MEDFILE_INCLUDE_DIRS=@MEDFILE_INCLUDE_DIRS@ -export MEDFILE_LIBRARIES=@MEDFILE_ROOT_DIR@/lib +export MEDFILE_LIBRARIES=@MEDFILE_LIBRARIES@ export MEDCOUPLING_ROOT_DIR=@MEDCOUPLING_ROOT_DIR@ export MEDCOUPLING_INCLUDE_DIR=@MEDCOUPLING_INCLUDE_DIR@ export MEDCOUPLING_LIBRARIES=@MEDCOUPLING_LIBRARIES@ diff --git a/CDMATH/pre_requis/PETSc/CMakeLists.txt b/CDMATH/pre_requis/PETSc/CMakeLists.txt new file mode 100755 index 0000000..5458c75 --- /dev/null +++ b/CDMATH/pre_requis/PETSc/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(PETSc) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + + + diff --git a/CDMATH/pre_requis/PETSc/f2cblaslapack-3.4.2.q4.tar.gz b/CDMATH/pre_requis/PETSc/f2cblaslapack-3.4.2.q4.tar.gz new file mode 100755 index 0000000..1ec3ecc Binary files /dev/null and b/CDMATH/pre_requis/PETSc/f2cblaslapack-3.4.2.q4.tar.gz differ diff --git a/CDMATH/pre_requis/PETSc/hdf5-1.10.3.tar.gz b/CDMATH/pre_requis/PETSc/hdf5-1.10.3.tar.gz new file mode 100755 index 0000000..7de101d Binary files /dev/null and b/CDMATH/pre_requis/PETSc/hdf5-1.10.3.tar.gz differ diff --git a/CDMATH/tests/CMakeLists.txt b/CDMATH/tests/CMakeLists.txt index d476cdf..f37e09a 100755 --- a/CDMATH/tests/CMakeLists.txt +++ b/CDMATH/tests/CMakeLists.txt @@ -60,7 +60,7 @@ if (CDMATH_WITH_PYTHON AND CDMATH_WITH_PETSC AND CDMATH_WITH_POSTPRO) add_subdirectory (${examples_dir}) add_subdirectory (validation) - add_custom_target (tests COMMAND ctest -O tests.log) + add_custom_target (tests_CDMATH COMMAND ctest -O tests.log) add_custom_target (check COMMAND ctest -E 'validation|Example')# may be replace ctest -E with ctest -LE add_custom_target (examples COMMAND ctest -R Example)# may be replace ctest -R with ctest -L add_custom_target (validation COMMAND ctest -R validation)# may be replace ctest -R with ctest -L diff --git a/CDMATH/tests/examples/Laplace-BeltramiSpectrum3DEF/CMakeLists.txt b/CDMATH/tests/examples/Laplace-BeltramiSpectrum3DEF/CMakeLists.txt deleted file mode 100644 index bfcc0d6..0000000 --- a/CDMATH/tests/examples/Laplace-BeltramiSpectrum3DEF/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ - -if (CDMATH_WITH_PYTHON AND CDMATH_WITH_PETSC AND CDMATH_WITH_POSTPRO) - - SET(MESH_FILE ../../ressources/meshSphere.med ) - SET(MESH_NAME "Sphere" ) - - ADD_TEST(ExampleSpectrumLaplaceBeltrami_3DFE_SPHERE ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SpectrumFiniteElements3DLaplace-Beltrami.py ${MESH_FILE} ${MESH_NAME} ) - SET_PROPERTY(TEST ExampleSpectrumLaplaceBeltrami_3DFE_SPHERE PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/medcoupling:${CMAKE_INSTALL_PREFIX}/lib/med:${PETSC_DIR}/${PETSC_ARCH}/lib:${HDF5_ROOT_DIR}/lib:${PV_LIB_DIR}") - SET_PROPERTY(TEST ExampleSpectrumLaplaceBeltrami_3DFE_SPHERE APPEND PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/cdmath:${CMAKE_INSTALL_PREFIX}/bin/cdmath:${CMAKE_INSTALL_PREFIX}/${MEDCOUPLING_INSTALL_PYTHON}:${CMAKE_INSTALL_PREFIX}/bin/cdmath/postprocessing:${PV_PYTHON_DIR}") - - SET(MESH_FILE ../../ressources/meshTorus.med ) - SET(MESH_NAME "Torus" ) - - ADD_TEST(ExampleSpectrumLaplaceBeltrami_3DFE_TORUS ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SpectrumFiniteElements3DLaplace-Beltrami.py ${MESH_FILE} ${MESH_NAME} ) - SET_PROPERTY(TEST ExampleSpectrumLaplaceBeltrami_3DFE_TORUS PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/medcoupling:${CMAKE_INSTALL_PREFIX}/lib/med:${PETSC_DIR}/${PETSC_ARCH}/lib:${HDF5_ROOT_DIR}/lib:${PV_LIB_DIR}") - SET_PROPERTY(TEST ExampleSpectrumLaplaceBeltrami_3DFE_TORUS APPEND PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/cdmath:${CMAKE_INSTALL_PREFIX}/bin/cdmath:${CMAKE_INSTALL_PREFIX}/${MEDCOUPLING_INSTALL_PYTHON}:${CMAKE_INSTALL_PREFIX}/bin/cdmath/postprocessing:${PV_PYTHON_DIR}") - - SET(MESH_FILE ../../ressources/meshCubeSkin.med ) - SET(MESH_NAME "CubeSkin" ) - - ADD_TEST(ExampleSpectrumLaplaceBeltrami_3DFE_CUBESKIN ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SpectrumFiniteElements3DLaplace-Beltrami.py ${MESH_FILE} ${MESH_NAME} ) - SET_PROPERTY(TEST ExampleSpectrumLaplaceBeltrami_3DFE_CUBESKIN PROPERTY ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:${CMAKE_INSTALL_PREFIX}/lib/medcoupling:${CMAKE_INSTALL_PREFIX}/lib/med:${PETSC_DIR}/${PETSC_ARCH}/lib:${HDF5_ROOT_DIR}/lib:${PV_LIB_DIR}") - SET_PROPERTY(TEST ExampleSpectrumLaplaceBeltrami_3DFE_CUBESKIN APPEND PROPERTY ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/cdmath:${CMAKE_INSTALL_PREFIX}/bin/cdmath:${CMAKE_INSTALL_PREFIX}/${MEDCOUPLING_INSTALL_PYTHON}:${CMAKE_INSTALL_PREFIX}/bin/cdmath/postprocessing:${PV_PYTHON_DIR}") - -endif (CDMATH_WITH_PYTHON AND CDMATH_WITH_PETSC AND CDMATH_WITH_POSTPRO) - - diff --git a/CDMATH/tests/examples/Laplace-BeltramiSpectrum3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py b/CDMATH/tests/examples/Laplace-BeltramiSpectrum3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py deleted file mode 100644 index dd753c5..0000000 --- a/CDMATH/tests/examples/Laplace-BeltramiSpectrum3DEF/SpectrumFiniteElements3DLaplace-Beltrami.py +++ /dev/null @@ -1,138 +0,0 @@ -# -*-coding:utf-8 -* -#=============================================================================================================================== -# Name : Calcul EF du spectre de l'opérateur de Laplace-Beltrami -\triangle sur une surface en 3D -# Author : Michael Ndjinga -# Copyright : CEA Saclay 2020 -# Description : Utilisation de la méthode des éléménts finis P1 avec champs discrétisés aux noeuds d'un maillage triangulaire -# Création et sauvegarde des champs résultant en utilisant la librairie CDMATH -#================================================================================================================================ - -import cdmath -from math import pow -import numpy as np -import PV_routines -import VTK_routines -import paraview.simple as pvs -import sys - -#Chargement du maillage triangulaire de la surface -#================================================= -my_mesh = cdmath.Mesh(sys.argv[1]) -mesh_name=sys.argv[2] -if(not my_mesh.isTriangular()) : - raise ValueError("Wrong cell types : mesh is not made of triangles") -if(my_mesh.getMeshDimension()!=2) : - raise ValueError("Wrong mesh dimension : expected a surface of dimension 2") -if(my_mesh.getSpaceDimension()!=3) : - raise ValueError("Wrong space dimension : expected a space of dimension 3") - -nbNodes = my_mesh.getNumberOfNodes() -nbCells = my_mesh.getNumberOfCells() - -print("Mesh building/loading done") -print("nb of nodes=", nbNodes) -print("nb of cells=", nbCells) - -maxNbNeighbours = my_mesh.getMaxNbNeighbours(cdmath.NODES)+1#This is to determine the number of non zero coefficients in the sparse finite element rigidity matrix - -# Construction de la matrice de rigidité -#======================================= -Rigidite=cdmath.SparseMatrixPetsc(nbNodes,nbNodes,maxNbNeighbours)# warning : third argument is number of non zero coefficients per line - -# Vecteurs gradient de la fonction de forme associée à chaque noeud d'un triangle -GradShapeFunc0=cdmath.Vector(3) -GradShapeFunc1=cdmath.Vector(3) -GradShapeFunc2=cdmath.Vector(3) - -normalFace0=cdmath.Vector(3) -normalFace1=cdmath.Vector(3) - -nodal_volumes=cdmath.Vector(nbNodes) - -#On parcourt les triangles du domaine -for i in range(nbCells): - - Ci=my_mesh.getCell(i) - - #Contribution à la matrice de rigidité - nodeId0=Ci.getNodeId(0) - nodeId1=Ci.getNodeId(1) - nodeId2=Ci.getNodeId(2) - N0=my_mesh.getNode(nodeId0) - N1=my_mesh.getNode(nodeId1) - N2=my_mesh.getNode(nodeId2) - - #Build normal to cell Ci - normalFace0[0]=Ci.getNormalVector(0,0) - normalFace0[1]=Ci.getNormalVector(0,1) - normalFace0[2]=Ci.getNormalVector(0,2) - normalFace1[0]=Ci.getNormalVector(1,0) - normalFace1[1]=Ci.getNormalVector(1,1) - normalFace1[2]=Ci.getNormalVector(1,2) - - normalCell = normalFace0.crossProduct(normalFace1) - normalCell = normalCell/normalCell.norm() - - cellMat=cdmath.Matrix(4) - cellMat[0,0]=N0.x() - cellMat[0,1]=N0.y() - cellMat[0,2]=N0.z() - cellMat[1,0]=N1.x() - cellMat[1,1]=N1.y() - cellMat[1,2]=N1.z() - cellMat[2,0]=N2.x() - cellMat[2,1]=N2.y() - cellMat[2,2]=N2.z() - cellMat[3,0]=normalCell[0] - cellMat[3,1]=normalCell[1] - cellMat[3,2]=normalCell[2] - cellMat[0,3]=1 - cellMat[1,3]=1 - cellMat[2,3]=1 - cellMat[3,3]=0 - - #Formule des gradients voir EF P1 -> calcul déterminants - GradShapeFunc0[0]= cellMat.partMatrix(0,0).determinant()/2 - GradShapeFunc0[1]=-cellMat.partMatrix(0,1).determinant()/2 - GradShapeFunc0[2]= cellMat.partMatrix(0,2).determinant()/2 - GradShapeFunc1[0]=-cellMat.partMatrix(1,0).determinant()/2 - GradShapeFunc1[1]= cellMat.partMatrix(1,1).determinant()/2 - GradShapeFunc1[2]=-cellMat.partMatrix(1,2).determinant()/2 - GradShapeFunc2[0]= cellMat.partMatrix(2,0).determinant()/2 - GradShapeFunc2[1]=-cellMat.partMatrix(2,1).determinant()/2 - GradShapeFunc2[2]= cellMat.partMatrix(2,2).determinant()/2 - - #Création d'un tableau (numéro du noeud, gradient de la fonction de forme - GradShapeFuncs={nodeId0 : GradShapeFunc0} - GradShapeFuncs[nodeId1]=GradShapeFunc1 - GradShapeFuncs[nodeId2]=GradShapeFunc2 - - # Remplissage de la matrice de rigidité et du second membre - for j in [nodeId0,nodeId1,nodeId2] : - nodal_volumes[j]+=Ci.getMeasure()/3 - #Contribution de la cellule triangulaire i à la ligne j du système linéaire - for k in [nodeId0,nodeId1,nodeId2] : - Rigidite.addValue(j,k,GradShapeFuncs[j]*GradShapeFuncs[k]/Ci.getMeasure()) - -print("Linear system matrix building done") - -# Conditionnement de la matrice de rigidité -#========================================== -cond = Rigidite.getConditionNumber(True) -print("Condition number is ",cond) - -# Spectre de la matrice de rigidité -#================================== -#Symétrisation de la matrice de rigidité -for i in range(nbNodes): - nodal_volumes[i]=1/nodal_volumes[i] -Rigidite.leftDiagonalScale(nodal_volumes) - -nev=9 -d=Rigidite.getEigenvectorsDataArrayDouble(nev) -my_eigenfield = cdmath.Field("Eigenvectors field", cdmath.NODES, my_mesh, nev) -my_eigenfield.setFieldByDataArrayDouble(d) - -# Sauvegarde du champ résultat -#=========================== -my_eigenfield.writeVTK("spectrumFiniteElementsOn"+mesh_name+"Poisson") diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9b16209 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,424 @@ +cmake_minimum_required (VERSION 3.1) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Project name +project (SOLVERLAB C CXX) +set (SOLVERLAB_VERSION_MAJOR 0) +set (SOLVERLAB_VERSION_MINOR 1) + +option (SOLVERLAB_WITH_DOCUMENTATION "Generate SOLVERLAB documentation" ON) +option (SOLVERLAB_WITH_PYTHON "Compile Python interface of SOLVERLAB" ON) +option (SOLVERLAB_WITH_GUI "Compile a Graphic user Interface for SOLVERLAB" OFF) +option (SOLVERLAB_WITH_PACKAGE "Generate RPM, Debian and tarball packages" OFF) +option (SOLVERLAB_WITH_COREFLOWS "Generate COREFLOWS module" ON) +option (SOLVERLAB_WITH_TESTS "Generate SOLVERLAB example tests" ON) + +#Path to installed libraries +set (PETSC_DIR OFF CACHE STRING "PETSc library path" ) +set (SLEPC_DIR OFF CACHE STRING "SLEPc library path" ) +set (HDF5_ROOT OFF CACHE STRING "HDF5 library path" )#For the compilation of MED with a specific version of HDF5 +set (MEDFILE_ROOT_DIR OFF CACHE STRING "MED library path" ) +set (MEDCOUPLING_ROOT_DIR OFF CACHE STRING "MEDCoupling library path" ) + +#url of tarball librairies +set (DOWNLOAD_PETSC http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.13.tar.gz + CACHE STRING "PETSc tarball path/url" ) +set (DOWNLOAD_SLEPC https://slepc.upv.es/download/distrib/slepc-3.13.4.tar.gz + CACHE STRING "SLEPC tarball path/url" ) +set (DOWNLOAD_F2CBLASLAPACK ${CDMATH_SOURCE_DIR}/pre_requis/PETSc/f2cblaslapack-3.4.2.q4.tar.gz + CACHE STRING "F2CBLASLAPACK tarball path/url" ) +set (DOWNLOAD_HDF5 ${CDMATH_SOURCE_DIR}/pre_requis/PETSc/hdf5-1.10.3.tar.gz + CACHE STRING "HDF5 tarball path/url" ) +set (DOWNLOAD_MED http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz + CACHE STRING "MED tarball path/url") +set (DOWNLOAD_MEDCOUPLING http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz + CACHE STRING "MEDCoupling tarball path/url" ) + +list (APPEND CMAKE_MODULE_PATH "${SOLVERLAB_SOURCE_DIR}/cmake_files") + +###################################################### +# Detection or compilation of PETSc+SLEPc+HDF5 # +###################################################### + if ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR) + if (NOT PETSC_DIR) + set(PETSC_DIR $ENV{PETSC_DIR}) + message ( STATUS "Checking variable PETSC_DIR : " $ENV{PETSC_DIR} ) + else (NOT PETSC_DIR) + message ( STATUS "Checking variable PETSC_DIR : " ${PETSC_DIR} ) + endif(NOT PETSC_DIR) + + find_package (PETSc 3.4 REQUIRED) + petsc_get_version () + + message ( STATUS "PETSc found. Version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" ) + set(PETSC_INSTALL ${PETSC_DIR}) + + #Define and search slepc variables + if ( NOT SLEPC_DIR ) + if ( DEFINED ENV{SLEPC_DIR} ) + set(SLEPC_DIR $ENV{SLEPC_DIR}) + else ( DEFINED ENV{SLEPC_DIR} ) + set(SLEPC_DIR ${PETSC_DIR}/${PETSC_ARCH}) + endif( DEFINED ENV{SLEPC_DIR} ) + endif( NOT SLEPC_DIR) + + message ( STATUS "Checking variable SLEPC_DIR" ) + if ( IS_DIRECTORY ${SLEPC_DIR}/include AND EXISTS ${SLEPC_DIR}/lib/libslepc.so) + set(SLEPC_INCLUDES ${SLEPC_DIR}/include) + set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) + message( STATUS "SLEPc found at ${SLEPC_DIR}" ) + else() + message( FATAL_ERROR "SLEPc not found at ${SLEPC_DIR}" ) + endif() + + #define hdf5 variables + if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments + if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment + set(HDF5_ROOT $ENV{HDF5_ROOT}) + else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment + #HDF5 to be found in petsc external packages + set(HDF5_ROOT ${PETSC_DIR}/${PETSC_ARCH})# define hint for hdf5/med installation in petsc external packages + endif( DEFINED ENV{HDF5_ROOT} ) + endif( NOT HDF5_ROOT ) + set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib) + set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include) + else ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR ) + message ( STATUS "PETSC_DIR not set, searching PETSc and SLEPc in the system" ) + + if ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) #Case fedora/redhat system install + message ( STATUS "PETSC includes found in /usr/include/petsc/" ) + message ( STATUS "PETSC library found in /usr/lib64" ) + set(PETSC_DIR /usr/) + set(PETSC_INCLUDES /usr/include/petsc /usr/include/petsc/petsc/mpiuni) + set(PETSC_LIBRARIES /usr/lib64/libpetsc.so) + + 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 + + set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet. + set(PETSC_INSTALL ${PETSC_DIR}) + + #Define and search slepc variables + if ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) + message( STATUS "SLEPc includes found in /usr/include/slepc/" ) + message( STATUS "SLEPc library found in /usr/lib64/slepc/" ) + set(SLEPC_DIR /usr/) + set(SLEPC_INCLUDES ${SLEPC_DIR}/include) + set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) + set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet. + else ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) + message( FATAL_ERROR "SLEPc not found in the system" ) + endif( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) + + #HDF5 to be found in the system + if ( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment + find_package(HDF5 REQUIRED) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libhdf5-dev") + set(CPACK_RPM_PACKAGE_REQUIRES "hdf5-devel") + endif( NOT HDF5_ROOT AND NOT DEFINED ENV{HDF5_ROOT} ) + + + #elseif ( IS_DIRECTORY "/usr/lib/petsc/include" AND EXISTS "/usr/lib/petsc/lib/libpetsc_real.so" ) #Case ubuntu/debian system install + # message ( STATUS "PETSc includes found in /usr/lib/petsc/include") + # message ( STATUS "PETSc library found in /usr/lib/petsc/lib/libpetsc_real.so") + # set(PETSC_DIR /usr/lib/petsc/) + # set(PETSC_INCLUDES ${PETSC_DIR}/include ${PETSC_DIR}/include/petsc/mpiuni) + # set(PETSC_LIBRARIES ${PETSC_DIR}/lib/libpetsc_real.so) + + # find_package (PETSc 3.4 REQUIRED) + # petsc_get_version () + # set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet. + + # Define and search slepc variables + # if ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" ) + # message( STATUS "SLEPc includes found in /usr/lib/slepc/include" ) + # message( STATUS "SLEPc library found in /usr/lib/slepc/lib/libslepc_real.so" ) + # set(SLEPC_DIR /usr/lib/slepc/) + # set(SLEPC_INCLUDES ${SLEPC_DIR}/include) + # set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc_real.so) + # set (CPACK_DEBIAN_PACKAGE_REQUIRES "${CPACK_DEBIAN_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet. + # else ( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" ) + # message( FATAL_ERROR "SLEPc not found in the system" ) + # endif( IS_DIRECTORY "/usr/lib/slepc/include" AND EXISTS "/usr/lib/slepc/lib/libslepc_real.so" ) + + #elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install + + 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 + message (STATUS "PETSC not found in the system") + message (STATUS "PETSC will be downloaded and compiled from ${DOWNLOAD_PETSC}" ) + message (STATUS "SLEPC will be downloaded and compiled from ${DOWNLOAD_SLEPC}" ) + message (STATUS "HDF5 will be downloaded and compiled from ${DOWNLOAD_HDF5}" ) + + #extract tarball name + string(LENGTH "${DOWNLOAD_PETSC}" tarball_url_length)#length of the tarball + string(FIND "${DOWNLOAD_PETSC}" "/" start_tarball_name REVERSE )# last occurence of "/" + 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_PETSC} ${start_tarball_name} ${tarball_name_length} PETSC_TARBALL_NAME) + + set(PETSC_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${PETSC_TARBALL_NAME}) # Location of the final install + set(PETSC_INSTALL ${CMAKE_INSTALL_PREFIX}/share/petsc)#folder to copy petsc libraries and include files + + ExternalProject_Add (PETSc + URL ${DOWNLOAD_PETSC} + SOURCE_DIR ${PETSC_DIR} + BUILD_IN_SOURCE TRUE + CONFIGURE_COMMAND /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} + BUILD_COMMAND make + TEST_COMMAND make check + INSTALL_COMMAND make all + INSTALL_DIR ${PETSC_DIR} + STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis + LOG_DOWNLOAD TRUE # Wrap download in script to log output + LOG_UPDATE TRUE # Wrap update in script to log output + LOG_CONFIGURE TRUE # Wrap configure in script to log output + LOG_BUILD TRUE # Wrap build in script to log output + LOG_TEST TRUE # Wrap test in script to log output + LOG_INSTALL TRUE # Wrap install in script to log output + ) + + #file (STRINGS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") + #message( STATUS "PETSc version is ${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" ) + message( STATUS "PETSc, SLEPc and HDF5 will be installed at ${PETSC_INSTALL}") + + string(SUBSTRING ${PETSC_TARBALL_NAME} 6 ${tarball_name_length} PETSC_VERSION) + #define slepc variables + set(SLEPC_DIR ${PETSC_INSTALL}) + set(SLEPC_INCLUDES ${SLEPC_DIR}/include) + set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) + + #define hdf5 variables + if ( NOT HDF5_ROOT )#hdf5 is not defined in cmake arguments + if ( DEFINED ENV{HDF5_ROOT} )#hdf5 is defined in the environment + set(HDF5_ROOT $ENV{HDF5_ROOT}) + else( DEFINED ENV{HDF5_ROOT} )#hdf5 is not defined in the environment + set(HDF5_ROOT ${PETSC_INSTALL})#HDF5 to be found in petsc installation + endif( DEFINED ENV{HDF5_ROOT} ) + endif( NOT HDF5_ROOT ) + set(HDF5_LIBRARY_DIR ${HDF5_ROOT}/lib) + set(HDF5_INCLUDE_DIRS ${HDF5_ROOT}/include) + + endif ( IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so" ) + endif ( DEFINED ENV{PETSC_DIR} OR PETSC_DIR ) + + if ( ${PETSC_VERSION} VERSION_GREATER 3.5 ) + add_definitions(-DPETSC_VERSION_GREATER_3_5) + endif( ${PETSC_VERSION} VERSION_GREATER 3.5 ) +string(REPLACE ";" ":" PETSC_INCLUDES_INSTALL "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_CDMATH.sh + +###################################################### +# Detection or compilation of MEDFile # +###################################################### +if( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR}) + + if ( NOT MEDFILE_ROOT_DIR ) + set(MEDFILE_ROOT_DIR $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}) + #string(FIND "${HDF5_LIBRARIES}" "libhdf5.so" pos) + #string(SUBSTRING "${HDF5_LIBRARIES}" 0 ${pos} HDF5_LIBRARY_DIR) + + message(STATUS "MED will be downloaded and installed from ${DOWNLOAD_MED}") + set(MACHINE PCLINUX) + set(MEDFILE_DEFINITIONS "-D${MACHINE} -DMEDFILE_INSTALL_DOC=OFF")#Comment ne pas compiler la doc ? + set(MEDFILE_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/med) # Location of the final install + + #extraction of the tarball archive name + string(LENGTH "${DOWNLOAD_MED}" tarball_url_length)#length of the name of the tarball + string(FIND "${DOWNLOAD_MED}" "/" start_tarball_name REVERSE )# last occurence of "/" + 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_MED} ${start_tarball_name} ${tarball_name_length} MED_TARBALL_NAME) + + ExternalProject_Add (MED + URL ${DOWNLOAD_MED} #location of med tarball + SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis/${MED_TARBALL_NAME} + BUILD_IN_SOURCE TRUE + CONFIGURE_COMMAND /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 + BUILD_COMMAND make + INSTALL_COMMAND make install + INSTALL_DIR ${MEDFILE_ROOT_DIR} + STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis + LOG_DOWNLOAD TRUE # Wrap download in script to log output + LOG_UPDATE TRUE # Wrap update in script to log output + LOG_CONFIGURE TRUE # Wrap configure in script to log output + LOG_BUILD TRUE # Wrap build in script to log output + LOG_TEST TRUE # Wrap test in script to log output + LOG_INSTALL TRUE # Wrap install in script to log output + ) + + set(MEDFILE_INCLUDE_DIRS ${MEDFILE_ROOT_DIR}/include)# Nécessaire pour le medloader et les sous-dossiers mesh, et IJKMesh + set(MEDFILE_LIBRARIES ${MEDFILE_ROOT_DIR}/lib)# Nécessaire pour le env_SOLVERLAB.sh + set(MEDFILE_C_LIBRARIES med medC)# Nécessaire pour le medloader + +endif( MEDFILE_ROOT_DIR OR DEFINED ENV{MEDFILE_ROOT_DIR}) + +add_library(med SHARED IMPORTED) +set_property(TARGET med PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmed.so) +add_library(medC SHARED IMPORTED) +set_property(TARGET medC PROPERTY IMPORTED_LOCATION ${MEDFILE_ROOT_DIR}/lib/libmedC.so) + +string(REPLACE ";" ":" MEDFILE_LIBRARIES_INSTALL "${MEDFILE_LIBRARIES}")# use colon instead of semicolon in environment file env_SOLVERLAB.sh + +###################################################### +# Detection or compilation of MEDCoupling # +###################################################### +if( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR}) + + if( NOT 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) + +else( MEDCOUPLING_ROOT_DIR OR DEFINED ENV{MEDCOUPLING_ROOT_DIR}) + message(STATUS "MEDCoupling will be downloaded and installed from ${DOWNLOAD_MEDCOUPLING}") + set(MEDCOUPLING_ROOT_DIR ${CMAKE_INSTALL_PREFIX}/share/medcoupling) # Location of the final install + SET(ENV{HDF5_ROOT} ${HDF5_ROOT})#MEDCoupling install process seems to require an environment variable + + #extraction of the tarball archive name + string(LENGTH "${DOWNLOAD_MEDCOUPLING}" tarball_url_length)#length of the tarball + string(FIND "${DOWNLOAD_MEDCOUPLING}" "/" start_tarball_name REVERSE )# last occurence of "/" + 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) + + message(STATUS "MEDCoupling version is ${MEDCOUPLING_VERSION_NAME}") + + 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} + BUILD_COMMAND make + INSTALL_COMMAND make install + INSTALL_DIR ${MEDCOUPLING_ROOT_DIR} + STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/pre_requis + LOG_DOWNLOAD TRUE # Wrap download in script to log output + LOG_UPDATE TRUE # Wrap update in script to log output + LOG_CONFIGURE TRUE # Wrap configure in script to log output + LOG_BUILD TRUE # Wrap build in script to log output + LOG_TEST TRUE # Wrap test in script to log output + LOG_INSTALL TRUE # Wrap install in script to log output + ) + +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 (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) + +if (TARGET MED AND TARGET MEDCoupling) + ExternalProject_Add_StepDependencies( MEDCoupling build MED )#MED doit être compilé avant MEDCoupling +endif(TARGET MED AND TARGET MEDCoupling) + +if (TARGET PETSc AND TARGET MEDCoupling) + ExternalProject_Add_StepDependencies( MEDCoupling build PETSc )#PETSc doit être compilé avant MEDCoupling (car il contient hdf5) +endif(TARGET PETSc AND TARGET MEDCoupling) + +#################### +# Final operations # +#################### + +# Paraview variables for env_SOLVERLAB.sh +if( NOT DEFINED PARAVIEW_VERSION ) + if( DEFINED PARAVIEW_ROOT_DIR) + set( PARAVIEW_INCLUDE_DIR ${PARAVIEW_ROOT_DIR}/include) + set( PARAVIEW_LIBRARIES_DIR ${PARAVIEW_ROOT_DIR}/lib) + else( DEFINED PARAVIEW_ROOT_DIR) + set( PARAVIEW_INCLUDE_DIR /usr/include/paraview/) + set( PARAVIEW_LIBRARIES_DIR /usr/lib/paraview/:/usr/lib64/paraview/) + endif( DEFINED PARAVIEW_ROOT_DIR) + + #extraction of the paraview version" + IF ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h ) + file(STRINGS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h vtkConfig) + ELSE ( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h ) + message(WARNING "Could not find ParaView configuration file vtkPVConfig.h in folder ${PARAVIEW_INCLUDE_DIR}. Postprocessing may not work") + ENDIF( EXISTS ${PARAVIEW_INCLUDE_DIR}/vtkPVConfig.h ) + + FOREACH(line ${vtkConfig}) + string(FIND "${line}" "#define PARAVIEW_VERSION_FULL " pos) + IF(NOT ${pos} EQUAL -1) + string(LENGTH ${line} line_length)#length of the tarball + MATH(EXPR start_pv_version "${line_length}-6")#line ends with "x.y.z", that counts for 7 characters + string(SUBSTRING ${line} ${start_pv_version} 5 PARAVIEW_VERSION) + break() + ENDIF(NOT ${pos} EQUAL -1) + ENDFOREACH(line vtkConfig) +endif(NOT DEFINED PARAVIEW_VERSION) + +message(STATUS "ParaView version is ${PARAVIEW_VERSION}" ) +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") +ELSE ( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" )#Use python 2 + SET(PYTHON2OR3 "2") +ENDIF( ${PARAVIEW_VERSION} STRGREATER "5.6" OR ${PARAVIEW_VERSION} STREQUAL "5.6" ) + + set (PV_LIB_DIR /usr/lib/python${PYTHON2OR3}.7/dist-packages/paraview/:${PARAVIEW_LIBRARIES_DIR}) + 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) + +# Find python +IF (${CMAKE_VERSION} VERSION_GREATER "3.12.0") + find_package(Python ${PYTHON2OR3} REQUIRED COMPONENTS Interpreter Development ) + SET(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) +ELSE (${CMAKE_VERSION} VERSION_GREATER "3.12.0") + find_package(PythonInterp ${PYTHON2OR3} REQUIRED ) + find_package(PythonLibs ${PYTHON2OR3} REQUIRED ) + set(Python_LIBRARIES ${PYTHON_LIBRARIES}) + set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) + set(Python_VERSION ${PYTHON_VERSION_STRING}) +ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.12.0") + +message(STATUS "Python version is ${Python_VERSION}") +find_package (SWIG 3.0 REQUIRED) + +if (SOLVERLAB_WITH_DOCUMENTATION) # + find_package (Doxygen) # + set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, doxygen, graphviz, mscgen") + set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, doxygen, graphviz, mscgen") + if (NOT DOXYGEN_FOUND) + message (FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly.") + endif(NOT DOXYGEN_FOUND) +endif() +if (SOLVERLAB_WITH_TESTS) # + find_package (CPPUNIT REQUIRED) +endif() +find_package (XDR REQUIRED) + +# Enter subdirectories +set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/cdmath) +add_subdirectory (CDMATH) +if(SOLVERLAB_WITH_COREFLOWS) + set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../coreflows) + add_subdirectory (CoreFlows) +endif(SOLVERLAB_WITH_COREFLOWS) + +set( CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/../) +# Configuration file +configure_file( + ${PROJECT_SOURCE_DIR}/env_SOLVERLAB.sh + ${CMAKE_INSTALL_PREFIX}/env_SOLVERLAB.sh + @ONLY +) + + diff --git a/CoreFlows/CMakeLists.txt b/CoreFlows/CMakeLists.txt index 3da857a..56e3088 100755 --- a/CoreFlows/CMakeLists.txt +++ b/CoreFlows/CMakeLists.txt @@ -7,9 +7,8 @@ project (CoreFlows C CXX) set (COREFLOWS_VERSION_MAJOR 0) set (COREFLOWS_VERSION_MINOR 1) -option (CMAKE_BUILD_TYPE "Debug or Release compilation" Release) -option (COREFLOWS_WITH_DOCUMENTATION "Generate documentation for CoreFlows use." OFF) -option (COREFLOWS_WITH_PYTHON "Compile Python interface for COREFLOWS." OFF) +option (COREFLOWS_WITH_DOCUMENTATION "Generate documentation for CoreFlows use." ON) +option (COREFLOWS_WITH_PYTHON "Compile Python interface for COREFLOWS." ON) option (COREFLOWS_WITH_GUI "Compile Graphic user Interface for COREFLOWS." OFF) option (COREFLOWS_WITH_PACKAGE "Generate RPM, Debian and tarball packages." OFF) @@ -29,101 +28,9 @@ endif () # # #----------------------------------------------------------------------------------------------------------# -list (APPEND CMAKE_MODULE_PATH "${CoreFlows_SOURCE_DIR}/cmake_files") # - -# CDMATH ---------------------------------------------------------------------------------------------------# -find_package (CDMATH REQUIRED) # -#-----------------------------------------------------------------------------------------------------------# - - -# PETSC ----------------------------------------------------------------------------------------------------# -message ( STATUS "Checking variable PETSC_DIR : " $ENV{PETSC_DIR} ) - -if ( NOT PETSC_DIR AND NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") #Case fedora/redhat system install - message ( STATUS "PETSC includes found in /usr/include/petsc/" ) - message ( STATUS "PETSC library found in /usr/lib64" ) - set(PETSC_DIR /usr/) - set(PETSC_ARCH lib64) - set(PETSC_INCLUDES /usr/include/petsc /usr/include/petsc/petsc/mpiuni) - set(PETSC_INCLUDES_PATH /usr/include/petsc:/usr/include/petsc/petsc/mpiuni) - set(PETSC_LIBRARIES /usr/lib64/libpetsc.so) - set(PETSC_VERSION "3.7") #3.7 for fedora 25/26 , 3.9 for fedora 29 , 3.10 for fedora 30, , 3.12 for fedora 32 - set(CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, petsc-devel (>= 3.4)") # This is not fully working yet. - - #Define and search slepc variables - if ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) - message( STATUS "SLEPc includes found in /usr/include/slepc/" ) - message( STATUS "SLEPc library found in /usr/lib64/slepc/" ) - set(SLEPC_DIR /usr/) - set(SLEPC_INCLUDES ${SLEPC_DIR}/include) - set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) - set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, slepc-devel (>= 3.4)") # This is not fully working yet. - else ( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) - message( FATAL_ERROR "SLEPc not found in the system" ) - endif( IS_DIRECTORY "/usr/include/slepc/" AND EXISTS "/usr/lib64/libslepc.so" ) - -#elseif ( IS_DIRECTORY "/usr/lib/petsc/") #Case ubuntu/debian system install -# message ( STATUS "PETSC found in /usr/lib/petsc/" ) -# set(PETSC_DIR /usr/lib/petsc/) -# set(PETSC_ARCH ) -# find_package (PETSc 3.4 REQUIRED) -# petsc_get_version () -# set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, petsc-dev (>= 3.4)") # This is not fully working yet. - -#elseif ( IS_DIRECTORY "/usr/local/lib/python2.7/dist-packages/petsc") #Case ubuntu/debian system pip install -# message ( STATUS "PETSC found in /usr/local/lib/python2.7/dist-packages/petsc" ) -# set(PETSC_DIR /usr/local/lib/python2.7/dist-packages/petsc/) -# set(PETSC_ARCH lib) -# set(PETSC_INCLUDES $PETSC_DIR/include /usr/include/openmpi) -# set(PETSC_INCLUDES_PATH $PETSC_DIR/include:/usr/include/openmpi) -# set(PETSC_LIBRARIES $PETSC_DIR/lib/libpetsc.so) -# set(PETSC_VERSION "3.8") #value for Ubuntu 16.04 - -else ( NOT PETSC_DIR AND NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") - if(NOT PETSC_DIR) - set(PETSC_DIR $ENV{PETSC_DIR}) - endif(NOT PETSC_DIR) - - find_package (PETSc 3.4 REQUIRED) - petsc_get_version () - string(REPLACE ";" ":" PETSC_INCLUDES_PATH "${PETSC_INCLUDES}")# use colon instead of semicolon in environment file env_CoreFlows.sh - - #Define and search slepc variables - if ( NOT SLEPC_DIR ) - if ( DEFINED ENV{SLEPC_DIR} ) - set(SLEPC_DIR $ENV{SLEPC_DIR}) - else ( DEFINED ENV{SLEPC_DIR} ) - set(SLEPC_DIR ${PETSC_DIR}/${PETSC_ARCH}) - endif( DEFINED ENV{SLEPC_DIR} ) - endif( NOT SLEPC_DIR) - - message ( STATUS "Checking variable SLEPC_DIR" ) - if ( IS_DIRECTORY ${SLEPC_DIR}/include AND EXISTS ${SLEPC_DIR}/lib/libslepc.so) - set(SLEPC_INCLUDES ${SLEPC_DIR}/include) - set(SLEPC_LIBRARIES ${SLEPC_DIR}/lib/libslepc.so) - message( STATUS "SLEPc found at ${SLEPC_DIR}" ) - else() - message( FATAL_ERROR "SLEPc not found at ${SLEPC_DIR}" ) - endif() - -endif( NOT PETSC_DIR AND NOT DEFINED ENV{PETSC_DIR} AND IS_DIRECTORY "/usr/include/petsc/" AND EXISTS "/usr/lib64/libpetsc.so") - -if (${PETSC_VERSION} VERSION_GREATER 3.5) - add_definitions(-DPETSC_VERSION_GREATER_3_5) -endif () - -#-----------------------------------------------------------------------------------------------------------# - - - # Swig interface -------------------------------------------------------------------------------------------# # if (COREFLOWS_WITH_PYTHON) # - find_package (PYTHON REQUIRED) # - find_package (SWIG 3.0 REQUIRED) - - set (PV_LIB_DIR /usr/lib/python2.7/dist-packages/:/usr/lib/python3.7/dist-packages/:/usr/lib64/paraview/) - set (PV_PYTHON_DIR /usr/lib/python2.7/dist-packages:/usr/lib64/paraview/site-packages/:/usr/lib64/paraview/site-packages/paraview/:/usr/lib64/paraview/site-packages/vtk/:/usr/lib64/paraview/python2.7/site-packages/:/usr/lib64/paraview/python2.7/site-packages/paraview/:/usr/lib64/paraview/python2.7/site-packages/vtkmodules:/usr/lib64/paraview/python3.7/site-packages/:/usr/lib64/paraview/python3.7/site-packages/paraview/:/usr/lib64/paraview/python3.7/site-packages/vtkmodules) set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, python-dev, python-numpy, swig") # set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, python-devel, numpy, swig") # set (CoreFlows_SWIG_DIR ${CoreFlows_SOURCE_DIR}/swig) # @@ -137,8 +44,6 @@ set (CoreFlows_EXAMPLES ${CoreFlows_SOURCE_DIR}/examples) set( CoreFlows_INCLUDES ${CDMATH_INCLUDES} # - ${MED_INCLUDES} # - ${MEDCOUPLING_INCLUDES} # ${PETSC_INCLUDES} # ${CoreFlows_SRC}/inc # ) # @@ -152,19 +57,13 @@ endif () # Documentation --------------------------------------------------------------------------------------------# # if (COREFLOWS_WITH_DOCUMENTATION) # - find_package (Doxygen) # - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, doxygen, graphviz, mscgen") # - set (CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES}, doxygen, graphviz, mscgen") # - if (NOT DOXYGEN_FOUND) # - message (FATAL_ERROR "Doxygen is needed to build the documentation. Please install it correctly.") # - endif (NOT DOXYGEN_FOUND) # configure_file (Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY IMMEDIATE) # FILE(GLOB_RECURSE CoreFlows_Documentation ${CoreFlows_SOURCE_DIR}/Documentation *.dox) # SET(Documentation_SRC # ${PROJECT_BINARY_DIR}/Doxyfile # ${CoreFlows_Documentation} # ) # - add_custom_target (doc COMMAND ${DOXYGEN_EXECUTABLE} # + add_custom_target (docCoreFlows COMMAND ${DOXYGEN_EXECUTABLE} # SOURCES ${PROJECT_BINARY_DIR}/Doxyfile) # install (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION share/doc/CoreFlows OPTIONAL) # INSTALL(FILES ${CoreFlows_SOURCE_DIR}/Documentation/CoreFlows.pdf DESTINATION share/doc/CoreFlows OPTIONAL) # @@ -223,5 +122,5 @@ configure_file( # Packaging if (COREFLOWS_WITH_PACKAGE) - include (CPackLists.txt) + include (${CoreFlows_SOURCE_DIR}/CPackLists.txt) endif () diff --git a/CoreFlows/CPackLists.txt b/CoreFlows/CPackLists.txt index 2fc1567..482798f 100755 --- a/CoreFlows/CPackLists.txt +++ b/CoreFlows/CPackLists.txt @@ -4,7 +4,7 @@ set (CPACK_PACKAGE_NAME "coreflows") set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "CFD simulation environment") set (CPACK_PACKAGE_VENDOR "CEA Saclay") -set (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +set (CPACK_PACKAGE_DESCRIPTION_FILE "${CDMATH_SOURCE_DIR}/README.md") set (CPACK_PACKAGE_VERSION_MAJOR "${COREFLOWS_VERSION_MAJOR}") set (CPACK_PACKAGE_VERSION_MINOR "${COREFLOWS_VERSION_MINOR}") diff --git a/CoreFlows/cmake_files/CodeCoverage.cmake b/CoreFlows/cmake_files/CodeCoverage.cmake deleted file mode 100755 index 30327e8..0000000 --- a/CoreFlows/cmake_files/CodeCoverage.cmake +++ /dev/null @@ -1,192 +0,0 @@ -# Copyright (c) 2012 - 2015, Lars Bilke -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# -# 2012-01-31, Lars Bilke -# - Enable Code Coverage -# -# 2013-09-17, Joakim Söderberg -# - Added support for Clang. -# - Some additional usage instructions. -# -# USAGE: - -# 0. (Mac only) If you use Xcode 5.1 make sure to patch geninfo as described here: -# http://stackoverflow.com/a/22404544/80480 -# -# 1. Copy this file into your cmake modules path. -# -# 2. Add the following line to your CMakeLists.txt: -# INCLUDE(CodeCoverage) -# -# 3. Set compiler flags to turn off optimization and enable coverage: -# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") -# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") -# -# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target -# which runs your test executable and produces a lcov code coverage report: -# Example: -# SETUP_TARGET_FOR_COVERAGE( -# my_coverage_target # Name for custom target. -# test_driver # Name of the test driver executable that runs the tests. -# # NOTE! This should always have a ZERO as exit code -# # otherwise the coverage generation will not complete. -# coverage # Name of output directory. -# ) -# -# 4. Build a Debug build: -# cmake -DCMAKE_BUILD_TYPE=Debug .. -# make -# make my_coverage_target -# -# - -# Check prereqs -FIND_PROGRAM( GCOV_PATH gcov ) -FIND_PROGRAM( LCOV_PATH lcov ) -FIND_PROGRAM( GENHTML_PATH genhtml ) -FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) - -IF(NOT GCOV_PATH) - MESSAGE(FATAL_ERROR "gcov not found! Aborting...") -ENDIF() # NOT GCOV_PATH - -IF(NOT CMAKE_COMPILER_IS_GNUCXX) - # Clang version 3.0.0 and greater now supports gcov as well. - MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") - - IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") - ENDIF() -ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX - -SET(CMAKE_CXX_FLAGS_COVERAGE - "-g -O0 --coverage -fprofile-arcs -ftest-coverage" - CACHE STRING "Flags used by the C++ compiler during coverage builds." - FORCE ) -SET(CMAKE_C_FLAGS_COVERAGE - "-g -O0 --coverage -fprofile-arcs -ftest-coverage" - CACHE STRING "Flags used by the C compiler during coverage builds." - FORCE ) -SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE - "" - CACHE STRING "Flags used for linking binaries during coverage builds." - FORCE ) -SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE - "" - CACHE STRING "Flags used by the shared libraries linker during coverage builds." - FORCE ) -MARK_AS_ADVANCED( - CMAKE_CXX_FLAGS_COVERAGE - CMAKE_C_FLAGS_COVERAGE - CMAKE_EXE_LINKER_FLAGS_COVERAGE - CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) - -IF ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage")) - MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) -ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" - - -# Param _targetname The name of new the custom make target -# Param _testrunner The name of the target which runs the tests. -# MUST return ZERO always, even on errors. -# If not, no coverage report will be created! -# Param _outputname lcov output is generated as _outputname.info -# HTML report is generated in _outputname/index.html -# Optional fourth parameter is passed as arguments to _testrunner -# Pass them in list form, e.g.: "-j;2" for -j 2 -FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) - - IF(NOT LCOV_PATH) - MESSAGE(FATAL_ERROR "lcov not found! Aborting...") - ENDIF() # NOT LCOV_PATH - - IF(NOT GENHTML_PATH) - MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") - ENDIF() # NOT GENHTML_PATH - - # Setup target - ADD_CUSTOM_TARGET(${_targetname} - - # Cleanup lcov - ${LCOV_PATH} --directory . --zerocounters - - # Run tests - COMMAND ${_testrunner} ${ARGV3} - - # Capturing lcov counters and generating report - COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info - COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned - COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned - COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned - - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." - ) - - # Show info where to find the report - ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD - COMMAND ; - COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." - ) - -ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE - -# Param _targetname The name of new the custom make target -# Param _testrunner The name of the target which runs the tests -# Param _outputname cobertura output is generated as _outputname.xml -# Optional fourth parameter is passed as arguments to _testrunner -# Pass them in list form, e.g.: "-j;2" for -j 2 -FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname) - - IF(NOT PYTHON_EXECUTABLE) - MESSAGE(FATAL_ERROR "Python not found! Aborting...") - ENDIF() # NOT PYTHON_EXECUTABLE - - IF(NOT GCOVR_PATH) - MESSAGE(FATAL_ERROR "gcovr not found! Aborting...") - ENDIF() # NOT GCOVR_PATH - - ADD_CUSTOM_TARGET(${_targetname} - - # Run tests - ${_testrunner} ${ARGV3} - - # Running gcovr - COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} - COMMENT "Running gcovr to produce Cobertura code coverage report." - ) - - # Show info where to find the report - ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD - COMMAND ; - COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." - ) -ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA diff --git a/CoreFlows/cmake_files/CorrectWindowsPaths.cmake b/CoreFlows/cmake_files/CorrectWindowsPaths.cmake deleted file mode 100755 index e1d5e13..0000000 --- a/CoreFlows/cmake_files/CorrectWindowsPaths.cmake +++ /dev/null @@ -1,38 +0,0 @@ -##Copyright (C) johnfettig. -##All rights reserved. -## -##Redistribution and use in source and binary forms, with or without modification, -##are permitted provided that the following conditions are met: -## -##* Redistributions of source code must retain the above copyright notice, this -## list of conditions and the following disclaimer. -## -##* Redistributions in binary form must reproduce the above copyright notice, this -## list of conditions and the following disclaimer in the documentation and/or -## other materials provided with the distribution. -## -##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# CorrectWindowsPaths - this module defines one macro -# -# CONVERT_CYGWIN_PATH( PATH ) -# This uses the command cygpath (provided by cygwin) to convert -# unix-style paths into paths useable by cmake on windows - -macro (CONVERT_CYGWIN_PATH _path) - if (WIN32) - EXECUTE_PROCESS(COMMAND cygpath.exe -m ${${_path}} - OUTPUT_VARIABLE ${_path}) - string (STRIP ${${_path}} ${_path}) - endif (WIN32) -endmacro (CONVERT_CYGWIN_PATH) - diff --git a/CoreFlows/cmake_files/FindCDMATH.cmake b/CoreFlows/cmake_files/FindCDMATH.cmake deleted file mode 100755 index 85892d1..0000000 --- a/CoreFlows/cmake_files/FindCDMATH.cmake +++ /dev/null @@ -1,85 +0,0 @@ -##Copyright (C) arthurtalpaert. -##All rights reserved. -## -##Redistribution and use in source and binary forms, with or without modification, -##are permitted provided that the following conditions are met: -## -##* Redistributions of source code must retain the above copyright notice, this -## list of conditions and the following disclaimer. -## -##* Redistributions in binary form must reproduce the above copyright notice, this -## list of conditions and the following disclaimer in the documentation and/or -## other materials provided with the distribution. -## -##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# - Try to find CDMATH -# Once done this will define -# -# CDMATH_FOUND - system has CDMATH -# CDMATH_INCLUDES - the CDMATH include directories -# CDMATH_LIBRARIES - Link these to use CDMATH -# -# Usage: -# find_package(CDMATH) -# -# Setting these changes the behavior of the search: -# CDMATH_DIR - directory in which CDMATH resides -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -find_path (CDMATH_DIR include/CdmathException.hxx - HINTS ENV CDMATH_DIR - PATHS - /usr - $ENV{HOME}/cdmath - $ENV{HOME}/workspace/cdmath_install - DOC "CDMATH Directory") -message (STATUS "Found CDMATH: ${CDMATH_DIR}") - -# Include directories -# This sets the variable ${CDMATH_INCLUDES}. -set(CDMATH_INCLUDES ${CDMATH_DIR}/include) -if (NOT (IS_DIRECTORY ${CDMATH_INCLUDES}) ) - message (SEND_ERROR "CDMATH_INCLUDES can not be used, ${CDMATH_INCLUDES} does not exist.") -endif () -set(MED_INCLUDES $ENV{MEDFILE_INCLUDE_DIRS}) -if (NOT (IS_DIRECTORY ${MED_INCLUDES}) ) - message (SEND_ERROR "MED_INCLUDES can not be used, ${MED_INCLUDES} does not exist.") -endif () -set(MEDCOUPLING_INCLUDES $ENV{MEDCOUPLING_INCLUDE_DIR}) -if (NOT (IS_DIRECTORY ${MEDCOUPLING_INCLUDES}) ) - message (SEND_ERROR "MEDCOUPLING_INCLUDES can not be used, ${MEDCOUPLING_INCLUDES} does not exist.") -endif () - -# CDMATH libraries against which to link -# This sets the variable ${CDMATH_LIBRARIES}. -set(CDMATH_LIBDIR ${CDMATH_DIR}/lib) -if ( NOT (IS_DIRECTORY ${CDMATH_LIBDIR}) ) - message (SEND_ERROR "CDMATH_LIBDIR can not be used, ${CDMATH_LIBDIR} does not exist.") -endif () -find_library (CDMATHBASE_LIB NAMES base PATHS ${CDMATH_LIBDIR}) -find_library (CDMATHMESH_LIB NAMES mesh PATHS ${CDMATH_LIBDIR}) -find_library (MEDC_LIB NAMES medC PATHS $ENV{MEDFILE_LIBRARIES}) -find_library (MEDLOADER_LIB NAMES medloader PATHS $ENV{MEDCOUPLING_LIBRARIES}) -find_library (MEDCOUPLING_LIB NAMES medcoupling PATHS $ENV{MEDCOUPLING_LIBRARIES}) -find_library (CDMATHLINEARSOLVER_LIB NAMES linearsolver PATHS ${CDMATH_LIBDIR}) -set (CDMATH_LIBRARIES - ${MEDC_LIB} - ${MEDLOADER_LIB} - ${MEDCOUPLING_LIB} - ${CDMATHBASE_LIB} - ${CDMATHMESH_LIB} - ${CDMATHLINEARSOLVER_LIB} - ) diff --git a/CoreFlows/cmake_files/FindPETSc.cmake b/CoreFlows/cmake_files/FindPETSc.cmake deleted file mode 100644 index a81c9f9..0000000 --- a/CoreFlows/cmake_files/FindPETSc.cmake +++ /dev/null @@ -1,351 +0,0 @@ -# - Try to find PETSc -# Once done this will define -# -# PETSC_FOUND - system has PETSc -# PETSC_INCLUDES - the PETSc include directories -# PETSC_LIBRARIES - Link these to use PETSc -# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI -# PETSC_DEFINITIONS - Compiler switches for using PETSc -# PETSC_MPIEXEC - Executable for running MPI programs -# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR) -# -# Usage: -# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0 -# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler -# find_package(PETSc) - same as above -# -# Setting these changes the behavior of the search -# PETSC_DIR - directory in which PETSc resides -# PETSC_ARCH - build architecture -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -set(PETSC_VALID_COMPONENTS - C - CXX) - -if(NOT PETSc_FIND_COMPONENTS) - set(PETSC_LANGUAGE_BINDINGS "C") -else() - # Right now, this is designed for compatability with the --with-clanguage option, so - # only allow one item in the components list. - list(LENGTH ${PETSc_FIND_COMPONENTS} components_length) - if(${components_length} GREATER 1) - message(FATAL_ERROR "Only one component for PETSc is allowed to be specified") - endif() - # This is a stub for allowing multiple components should that time ever come. Perhaps - # to also test Fortran bindings? - foreach(component ${PETSc_FIND_COMPONENTS}) - list(FIND PETSC_VALID_COMPONENTS ${component} component_location) - if(${component_location} EQUAL -1) - message(FATAL_ERROR "\"${component}\" is not a valid PETSc component.") - else() - list(APPEND PETSC_LANGUAGE_BINDINGS ${component}) - endif() - endforeach() -endif() - -function (petsc_get_version) - if (EXISTS "${PETSC_DIR}/petscversion.h" OR EXISTS "${PETSC_DIR}/include/petscversion.h" OR EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h") - if (EXISTS "${PETSC_DIR}/include/petscversion.h") - file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - elseif( EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" ) - file (STRINGS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - else() - file (STRINGS "${PETSC_DIR}/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") - endif() - foreach (line ${vstrings}) - string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define") - list (GET fields 1 var) - list (GET fields 2 val) - set (${var} ${val} PARENT_SCOPE) - set (${var} ${val}) # Also in local scope so we have access below - endforeach () - - if (PETSC_VERSION_RELEASE) - set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE) - else () - # make dev version compare higher than any patch level of a released version - set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE) - endif () - else () - message (SEND_ERROR "PETSC_DIR can not be used, file ${PETSC_DIR}/include/petscversion.h does not exist") - endif () -endfunction () - -find_path (PETSC_DIR include/petsc.h - HINTS ENV PETSC_DIR - PATHS - #RedHat paths - /usr/include/petsc - # Debian paths - /usr/lib/petscdir/3.12.4 /usr/lib/petscdir/3.12 #Ubuntu 20.04 - /usr/lib/petscdir/3.7.6 /usr/lib/petscdir/3.7 #Ubuntu 18.04 - /usr/lib/petscdir/3.6.2 /usr/lib/petscdir/3.6 #Ubuntu 16.04 - /usr/lib/petscdir/3.5.1 /usr/lib/petscdir/3.5 - /usr/lib/petscdir/3.4.2 /usr/lib/petscdir/3.4 - /usr/lib/petscdir/3.3 /usr/lib/petscdir/3.2 /usr/lib/petscdir/3.1 - /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 - # MacPorts path - /opt/local/lib/petsc - $ENV{HOME}/petsc - DOC "PETSc Directory") - -find_program (MAKE_EXECUTABLE NAMES make gmake) - -if (PETSC_DIR AND NOT PETSC_ARCH) - set (_petsc_arches - $ENV{PETSC_ARCH} # If set, use environment variable first - linux-gnu-c-debug linux-gnu-c-opt # old Debian defaults (petsc compilation) - arch-linux-c-opt or arch-linux-c-debug # new Debian defaults (petsc compilation) - x86_64-linux-gnu-real i686-linux-gnu-real # Debian defaults (petsc system installation) - arch-linux2-c-opt or arch-linux2-c-debug # old RedHat defaults (petsc compilation) - x86_64-redhat-linux-gnu i686-redhat-linux-gnu # RedHat defaults (petsc apt installation) - x86_64-unknown-linux-gnu i386-unknown-linux-gnu) - set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - foreach (arch ${_petsc_arches}) - if (NOT PETSC_ARCH) - find_path (petscconf petscconf.h - HINTS ${PETSC_DIR} - PATH_SUFFIXES ${arch}/include bmake/${arch} - NO_DEFAULT_PATH) - if (petscconf) - set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture") - endif (petscconf) - endif (NOT PETSC_ARCH) - endforeach (arch) - set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) -endif (PETSC_DIR AND NOT PETSC_ARCH) - -set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS - INCLUDE_DIR INCLUDE_CONF) -include (FindPackageMultipass) -find_package_multipass (PETSc petsc_config_current - STATES DIR ARCH - DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves}) - -# Determine whether the PETSc layout is old-style (through 2.3.3) or -# new-style (>= 3.0.0) -if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables") # > 3.5 - set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules") - set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") -elseif (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3 - set (petsc_conf_rules "${PETSC_DIR}/conf/rules") - set (petsc_conf_variables "${PETSC_DIR}/conf/variables") -elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3 - set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules") - set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables") -elseif (PETSC_DIR) - message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation") -endif () - -if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current) - petsc_get_version() - - # Put variables into environment since they are needed to get - # configuration (petscvariables) in the PETSc makefile - set (ENV{PETSC_DIR} "${PETSC_DIR}") - set (ENV{PETSC_ARCH} "${PETSC_ARCH}") - - # A temporary makefile to probe the PETSc configuration - set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc") - file (WRITE "${petsc_config_makefile}" -"## This file was autogenerated by FindPETSc.cmake -# PETSC_DIR = ${PETSC_DIR} -# PETSC_ARCH = ${PETSC_ARCH} -include ${petsc_conf_rules} -include ${petsc_conf_variables} -show : -\t-@echo -n \${\${VARIABLE}} -") - - macro (PETSC_GET_VARIABLE name var) - set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name} - OUTPUT_VARIABLE ${var} - RESULT_VARIABLE petsc_return) - endmacro (PETSC_GET_VARIABLE) - petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir) - petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external) - petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line) - petsc_get_variable (PETSC_INCLUDE petsc_include) - petsc_get_variable (PCC petsc_cc) - petsc_get_variable (PCC_FLAGS petsc_cc_flags) - petsc_get_variable (MPIEXEC petsc_mpiexec) - # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid! - file (REMOVE ${petsc_config_makefile}) - - include (ResolveCompilerPaths) - # Extract include paths and libraries from compile command line - resolve_includes (petsc_includes_all "${petsc_cpp_line}") - - #on windows we need to make sure we're linking against the right - #runtime library - if (WIN32) - if (petsc_cc_flags MATCHES "-MT") - set(using_md False) - foreach(flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag_var} MATCHES "/MD") - set(using_md True) - endif(${flag_var} MATCHES "/MD") - endforeach(flag_var) - if(${using_md} MATCHES "True") - message(WARNING "PETSc was built with /MT, but /MD is currently set. - See http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F") - endif(${using_md} MATCHES "True") - endif (petsc_cc_flags MATCHES "-MT") - endif (WIN32) - - include (CorrectWindowsPaths) - convert_cygwin_path(petsc_lib_dir) - message (STATUS "petsc_lib_dir ${petsc_lib_dir}") - - macro (PETSC_FIND_LIBRARY suffix name) - set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again - if (WIN32) - set (libname lib${name}) #windows expects "libfoo", linux expects "foo" - else (WIN32) - set (libname ${name}) - endif (WIN32) - find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH) - set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}") - mark_as_advanced (PETSC_LIBRARY_${suffix}) - endmacro (PETSC_FIND_LIBRARY suffix name) - - # Look for petscvec first, if it doesn't exist, we must be using single-library - petsc_find_library (VEC petscvec) - if (PETSC_LIBRARY_VEC) - petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced) - petsc_find_library (MAT petscmat) - petsc_find_library (DM petscdm) - petsc_find_library (KSP petscksp) - petsc_find_library (SNES petscsnes) - petsc_find_library (TS petscts) - macro (PETSC_JOIN libs deps) - list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}}) - endmacro (PETSC_JOIN libs deps) - petsc_join (VEC SYS) - petsc_join (MAT VEC) - petsc_join (DM MAT) - petsc_join (KSP DM) - petsc_join (SNES KSP) - petsc_join (TS SNES) - petsc_join (ALL TS) - else () - set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec - petsc_find_library (SINGLE petsc) #check existence of libpetsc.so - if (NOT PETSC_LIBRARY_SINGLE) - petsc_find_library (SINGLE petsc_real) #check existence of libpetsc_real.so - endif() - if (NOT PETSC_LIBRARY_SINGLE) - petsc_find_library (SINGLE petsc_complex) #check existence of libpetsc_complex.so - endif() - foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}") - endforeach () - endif () - if (PETSC_LIBRARY_TS) - message (STATUS "Recognized PETSc install with separate libraries for each package") - else () - message (STATUS "Recognized PETSc install with single library for all packages") - endif () - - include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns) - macro (PETSC_TEST_RUNS includes libraries runs) - if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C") - set(_PETSC_ERR_FUNC "CHKERRQ(ierr)") - elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX") - set(_PETSC_ERR_FUNC "CHKERRXX(ierr)") - endif() - if (PETSC_VERSION VERSION_GREATER 3.1) - set (_PETSC_TSDestroy "TSDestroy(&ts)") - else () - set (_PETSC_TSDestroy "TSDestroy(ts)") - endif () - - set(_PETSC_TEST_SOURCE " -static const char help[] = \"PETSc test program.\"; -#include -int main(int argc,char *argv[]) { - PetscErrorCode ierr; - TS ts; - - ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC}; - ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC}; - ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC}; - ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC}; - ierr = PetscFinalize();${_PETSC_ERR_FUNC}; - return 0; -} -") - multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}") - if (${${runs}}) - set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL - "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE) - endif (${${runs}}) - endmacro (PETSC_TEST_RUNS) - - - find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH) - find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH) - mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF) - set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR}) - - petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal) - if (petsc_works_minimal) - message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.") - set (petsc_includes_needed "${petsc_includes_minimal}") - else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes) - if (petsc_works_allincludes) # It does, we just need all the includes ( - message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).") - set (petsc_includes_needed ${petsc_includes_all}) - else (petsc_works_allincludes) # We are going to need to link the external libs explicitly - resolve_libraries (petsc_libraries_external "${petsc_libs_external}") - foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) - list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external}) - endforeach (pkg) - petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries) - if (petsc_works_alllibraries) - message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.") - set (petsc_includes_needed ${petsc_includes_minimal}) - else (petsc_works_alllibraries) - # It looks like we really need everything, should have listened to Matt - set (petsc_includes_needed ${petsc_includes_all}) - petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all) - if (petsc_works_all) # We fail anyways - message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.") - else (petsc_works_all) # We fail anyways - message (STATUS "PETSc could not be used, maybe the install is broken.") - endif (petsc_works_all) - endif (petsc_works_alllibraries) - endif (petsc_works_allincludes) - endif (petsc_works_minimal) - - # We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous - if (${PETSC_VERSION} VERSION_LESS 3.1) - set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE) - else () - set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE) - endif () - # Sometimes this can be used to assist FindMPI.cmake - set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE) - set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE) - set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE) - set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE) - # Note that we have forced values for all these choices. If you - # change these, you are telling the system to trust you that they - # work. It is likely that you will end up with a broken build. - mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS) -endif () - -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (PETSc - "PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH." - PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) diff --git a/CoreFlows/cmake_files/FindPYTHON.cmake b/CoreFlows/cmake_files/FindPYTHON.cmake deleted file mode 100755 index f9e7c6e..0000000 --- a/CoreFlows/cmake_files/FindPYTHON.cmake +++ /dev/null @@ -1,239 +0,0 @@ -# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE -# -# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# ------ - -MESSAGE(STATUS "Check for python ...") - -# ------ - -IF(PYTHON_IS_MANDATORY STREQUAL 0) - SET(PYTHON_IS_MANDATORY 0) - SET(PYTHON_IS_OPTIONAL 1) -ENDIF(PYTHON_IS_MANDATORY STREQUAL 0) -IF(PYTHON_IS_OPTIONAL STREQUAL 0) - SET(PYTHON_IS_MANDATORY 1) - SET(PYTHON_IS_OPTIONAL 0) -ENDIF(PYTHON_IS_OPTIONAL STREQUAL 0) -IF(NOT PYTHON_IS_MANDATORY AND NOT PYTHON_IS_OPTIONAL) - SET(PYTHON_IS_MANDATORY 1) - SET(PYTHON_IS_OPTIONAL 0) -ENDIF(NOT PYTHON_IS_MANDATORY AND NOT PYTHON_IS_OPTIONAL) - -# ------ - -SET(PYTHON_STATUS 1) -IF(WITHOUT_PYTHON OR WITH_PYTHON STREQUAL 0) - SET(PYTHON_STATUS 0) - MESSAGE(STATUS "python disabled from command line.") -ENDIF(WITHOUT_PYTHON OR WITH_PYTHON STREQUAL 0) - -# ------ - -IF(PYTHON_STATUS) - IF(WITH_PYTHON) - SET(PYTHON_ROOT_USER ${WITH_PYTHON}) - ENDIF(WITH_PYTHON) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_ROOT_USER $ENV{PYTHON_ROOT}) - ENDIF(NOT PYTHON_ROOT_USER) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_ROOT_USER $ENV{PYTHONHOME}) - ENDIF(NOT PYTHON_ROOT_USER) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_ROOT_USER /usr) - ENDIF(NOT PYTHON_ROOT_USER) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION) - ENDIF(PYTHON_ROOT_USER) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - SET(PYTHON_EXECUTABLE_TO_FIND python) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - SET(PYTHON_EXECUTABLE_TO_FIND python_d) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - SET(PYTHON_EXECUTABLE_TO_FIND python) - ENDIF(WINDOWS) - IF(NOT PYTHON_ROOT_USER) - SET(PYTHON_EXECUTABLE_PATHS) - ELSE(NOT PYTHON_ROOT_USER) - IF(WINDOWS) - SET(PYTHON_EXECUTABLE_PATHS ${PYTHON_ROOT_USER}) - ELSE(WINDOWS) - SET(PYTHON_EXECUTABLE_PATHS ${PYTHON_ROOT_USER}/bin) - ENDIF(WINDOWS) - ENDIF(NOT PYTHON_ROOT_USER) - FIND_PROGRAM(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE_TO_FIND} PATHS ${PYTHON_EXECUTABLE_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - IF(PYTHON_EXECUTABLE) - MESSAGE(STATUS "python found: ${PYTHON_EXECUTABLE}") - IF(PYTHON_EXECUTABLE STREQUAL /usr/bin/python) - ELSE(PYTHON_EXECUTABLE STREQUAL /usr/bin/python) - SET(PYTHON_ROOT_USER ${PYTHON_EXECUTABLE}) - GET_FILENAME_COMPONENT(PYTHON_ROOT_USER ${PYTHON_ROOT_USER} PATH) - IF(NOT WINDOWS) - GET_FILENAME_COMPONENT(PYTHON_ROOT_USER ${PYTHON_ROOT_USER} PATH) - ENDIF(NOT WINDOWS) - ENDIF(PYTHON_EXECUTABLE STREQUAL /usr/bin/python) - ELSE(PYTHON_EXECUTABLE) - IF(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_EXECUTABLE_TO_FIND} not found in ${PYTHON_EXECUTABLE_PATHS}, check your PYTHON installation.") - ELSE(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_EXECUTABLE_TO_FIND} not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.") - ENDIF(PYTHON_ROOT_USER) - SET(PYTHON_STATUS 0) - ENDIF(PYTHON_EXECUTABLE) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.stdout.write(sys.version[:3])" - OUTPUT_VARIABLE PYTHON_VERSION - ) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION NO_DEFAULT_PATH) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_FIND_PATHS_OPTION) - ENDIF(PYTHON_ROOT_USER) -ENDIF(PYTHON_STATUS) - -# ------ - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - SET(PYTHON_INCLUDE_PATHS ${PYTHON_ROOT_USER}/include ${PYTHON_ROOT_USER}/include/python${PYTHON_VERSION}) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_INCLUDE_PATHS /usr/include/python${PYTHON_VERSION}) - ENDIF(PYTHON_ROOT_USER) - SET(PYTHON_INCLUDE_TO_FIND Python.h) - FIND_PATH(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_TO_FIND} PATHS ${PYTHON_INCLUDE_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - SET(PYTHON_DEFINITIONS) - IF(PYTHON_INCLUDE_DIR) - SET(PYTHON_INCLUDES -I${PYTHON_INCLUDE_DIR})# to remove - SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) - IF(WINDOWS) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON)# to remove - SET(PYTHON_DEFINITIONS "-DHAVE_DEBUG_PYTHON") - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ENDIF(WINDOWS) - MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} found in ${PYTHON_INCLUDE_DIR}") - ELSE(PYTHON_INCLUDE_DIR) - SET(PYTHON_STATUS 0) - IF(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} not found in ${PYTHON_INCLUDE_PATHS}, check your PYTHON installation.") - ELSE(PYTHON_ROOT_USER) - MESSAGE(STATUS "${PYTHON_INCLUDE_TO_FIND} not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.") - ENDIF(PYTHON_ROOT_USER) - ENDIF(PYTHON_INCLUDE_DIR) -ENDIF(PYTHON_STATUS) - -# ---- - -IF(PYTHON_STATUS) - IF(PYTHON_ROOT_USER) - IF(WINDOWS) - SET(PYTHON_LIB_PATHS ${PYTHON_ROOT_USER}/libs) - ELSE(WINDOWS) - SET(PYTHON_LIB_PATHS ${PYTHON_ROOT_USER}/lib ${PYTHON_ROOT_USER}/lib/python${PYTHON_VERSION}/config) - ENDIF(WINDOWS) - ELSE(PYTHON_ROOT_USER) - SET(PYTHON_LIB_PATHS) - ENDIF(PYTHON_ROOT_USER) - IF(WINDOWS) - STRING(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOT ${PYTHON_VERSION}) - IF(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION_WITHOUT_DOT} PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION_WITHOUT_DOT}_d PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) - ELSE(WINDOWS) - FIND_LIBRARY(PYTHON_LIB python${PYTHON_VERSION} PATHS ${PYTHON_LIB_PATHS} ${PYTHON_FIND_PATHS_OPTION}) - ENDIF(WINDOWS) - SET(PYTHON_LIBS) - IF(PYTHON_LIB) - SET(PYTHON_LIBS ${PYTHON_LIBS} ${PYTHON_LIB}) - MESSAGE(STATUS "python lib found: ${PYTHON_LIB}") - ELSE(PYTHON_LIB) - SET(PYTHON_STATUS 0) - IF(PYTHON_ROOT_USER) - MESSAGE(STATUS "python lib not found in ${PYTHON_LIB_PATHS}, check your PYTHON installation.") - ELSE(PYTHON_ROOT_USER) - MESSAGE(STATUS "python lib not found on system, try to use WITH_PYTHON option or PYTHON_ROOT environment variable.") - ENDIF(PYTHON_ROOT_USER) - ENDIF(PYTHON_LIB) -ENDIF(PYTHON_STATUS) - -# ---- - -SET(NUMPY_STATUS 0) -IF(PYTHON_STATUS) - EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import numpy ; import sys ; sys.stdout.write(numpy.get_include())" - OUTPUT_VARIABLE NUMPY_INCLUDE_DIR - ERROR_QUIET - ) - IF(NUMPY_INCLUDE_DIR) - SET(NUMPY_STATUS 1) - ENDIF(NUMPY_INCLUDE_DIR) - IF(NUMPY_STATUS) - SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DWITH_NUMPY -I${NUMPY_INCLUDE_DIR})# to remove - SET(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR}) - SET(PYTHON_DEFINITIONS "${PYTHON_DEFINITIONS} -DWITH_NUMPY") - MESSAGE(STATUS "numpy found : ${NUMPY_INCLUDE_DIR}") - ELSE(NUMPY_STATUS) - MESSAGE(STATUS "numpy not found") - ENDIF(NUMPY_STATUS) -ENDIF(PYTHON_STATUS) - -# ---- - -IF(PYTHON_STATUS) - SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES})# to remove - SET(PYLOGLEVEL WARNING) -ELSE(PYTHON_STATUS) - IF(PYTHON_IS_MANDATORY) - MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort") - ELSE(PYTHON_IS_MANDATORY) - MESSAGE(STATUS "python not found ... optional ... disabled") - ENDIF(PYTHON_IS_MANDATORY) -ENDIF(PYTHON_STATUS) diff --git a/CoreFlows/cmake_files/FindPackageMultipass.cmake b/CoreFlows/cmake_files/FindPackageMultipass.cmake deleted file mode 100755 index fa350a9..0000000 --- a/CoreFlows/cmake_files/FindPackageMultipass.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# PackageMultipass - this module defines two macros -# -# FIND_PACKAGE_MULTIPASS (Name CURRENT -# STATES VAR0 VAR1 ... -# DEPENDENTS DEP0 DEP1 ...) -# -# This function creates a cache entry _CURRENT which -# the user can set to "NO" to trigger a reconfiguration of the package. -# The first time this function is called, the values of -# _VAR0, ... are saved. If _CURRENT -# is false or if any STATE has changed since the last time -# FIND_PACKAGE_MULTIPASS() was called, then CURRENT will be set to "NO", -# otherwise CURRENT will be "YES". IF not CURRENT, then -# _DEP0, ... will be FORCED to NOTFOUND. -# Example: -# find_path (FOO_DIR include/foo.h) -# FIND_PACKAGE_MULTIPASS (Foo foo_current -# STATES DIR -# DEPENDENTS INCLUDES LIBRARIES) -# if (NOT foo_current) -# # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES -# endif (NOT foo_current) -# -# MULTIPASS_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS LANGUAGE) -# Always runs the given test, use this when you need to re-run tests -# because parent variables have made old cache entries stale. The LANGUAGE -# variable is either C or CXX indicating which compiler the test should -# use. -# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS) -# DEPRECATED! This is only included for backwards compatability. Use -# the more general MULTIPASS_SOURCE_RUNS instead. -# Always runs the given test, use this when you need to re-run tests -# because parent variables have made old cache entries stale. - -macro (FIND_PACKAGE_MULTIPASS _name _current) - string (TOUPPER ${_name} _NAME) - set (_args ${ARGV}) - list (REMOVE_AT _args 0 1) - - set (_states_current "YES") - list (GET _args 0 _cmd) - if (_cmd STREQUAL "STATES") - list (REMOVE_AT _args 0) - list (GET _args 0 _state) - while (_state AND NOT _state STREQUAL "DEPENDENTS") - # The name of the stored value for the given state - set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state}) - if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") - set (_states_current "NO") - endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") - set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE) - list (REMOVE_AT _args 0) - list (GET _args 0 _state) - endwhile (_state AND NOT _state STREQUAL "DEPENDENTS") - endif (_cmd STREQUAL "STATES") - - set (_stored ${_NAME}_CURRENT) - if (NOT ${_stored}) - set (${_stored} "YES" CACHE BOOL "Is the configuration for ${_name} current? Set to \"NO\" to reconfigure." FORCE) - set (_states_current "NO") - endif (NOT ${_stored}) - - set (${_current} ${_states_current}) - if (NOT ${_current} AND PACKAGE_MULTIPASS_${_name}_CALLED) - message (STATUS "Clearing ${_name} dependent variables") - # Clear all the dependent variables so that the module can reset them - list (GET _args 0 _cmd) - if (_cmd STREQUAL "DEPENDENTS") - list (REMOVE_AT _args 0) - foreach (dep ${_args}) - set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - endforeach (dep) - endif (_cmd STREQUAL "DEPENDENTS") - set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) - endif () - set (PACKAGE_MULTIPASS_${name}_CALLED YES CACHE INTERNAL "Private" FORCE) -endmacro (FIND_PACKAGE_MULTIPASS) - - -macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language) - include (Check${language}SourceRuns) - # This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the - # *name* of the return variable doesn't change, then the test does - # not need to be re-run. We keep an internal count which we - # increment to guarantee that every test name is unique. If we've - # gotten here, then the configuration has changed enough that the - # test *needs* to be rerun. - if (NOT MULTIPASS_TEST_COUNT) - set (MULTIPASS_TEST_COUNT 00) - endif (NOT MULTIPASS_TEST_COUNT) - math (EXPR _tmp "${MULTIPASS_TEST_COUNT} + 1") # Why can't I add to a cache variable? - set (MULTIPASS_TEST_COUNT ${_tmp} CACHE INTERNAL "Unique test ID") - set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs}) - set (CMAKE_REQUIRED_INCLUDES ${includes}) - set (CMAKE_REQUIRED_LIBRARIES ${libraries}) - if(${language} STREQUAL "C") - check_c_source_runs ("${source}" ${testname}) - elseif(${language} STREQUAL "CXX") - check_cxx_source_runs ("${source}" ${testname}) - endif() - set (${runs} "${${testname}}") -endmacro (MULTIPASS_SOURCE_RUNS) - -macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs) - multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C") -endmacro (MULTIPASS_C_SOURCE_RUNS) diff --git a/CoreFlows/cmake_files/ResolveCompilerPaths.cmake b/CoreFlows/cmake_files/ResolveCompilerPaths.cmake deleted file mode 100755 index c4c2717..0000000 --- a/CoreFlows/cmake_files/ResolveCompilerPaths.cmake +++ /dev/null @@ -1,129 +0,0 @@ -##Copyright (C) jedbrown, johnfettig. -##All rights reserved. -## -##Redistribution and use in source and binary forms, with or without modification, -##are permitted provided that the following conditions are met: -## -##* Redistributions of source code must retain the above copyright notice, this -## list of conditions and the following disclaimer. -## -##* Redistributions in binary form must reproduce the above copyright notice, this -## list of conditions and the following disclaimer in the documentation and/or -## other materials provided with the distribution. -## -##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# ResolveCompilerPaths - this module defines two macros -# -# RESOLVE_LIBRARIES (XXX_LIBRARIES LINK_LINE) -# This macro is intended to be used by FindXXX.cmake modules. -# It parses a compiler link line and resolves all libraries -# (-lfoo) using the library path contexts (-L/path) in scope. -# The result in XXX_LIBRARIES is the list of fully resolved libs. -# Example: -# -# RESOLVE_LIBRARIES (FOO_LIBRARIES "-L/A -la -L/B -lb -lc -ld") -# -# will be resolved to -# -# FOO_LIBRARIES:STRING="/A/liba.so;/B/libb.so;/A/libc.so;/usr/lib/libd.so" -# -# if the filesystem looks like -# -# /A: liba.so libc.so -# /B: liba.so libb.so -# /usr/lib: liba.so libb.so libc.so libd.so -# -# and /usr/lib is a system directory. -# -# Note: If RESOLVE_LIBRARIES() resolves a link line differently from -# the native linker, there is a bug in this macro (please report it). -# -# RESOLVE_INCLUDES (XXX_INCLUDES INCLUDE_LINE) -# This macro is intended to be used by FindXXX.cmake modules. -# It parses a compile line and resolves all includes -# (-I/path/to/include) to a list of directories. Other flags are ignored. -# Example: -# -# RESOLVE_INCLUDES (FOO_INCLUDES "-I/A -DBAR='\"irrelevant -I/string here\"' -I/B") -# -# will be resolved to -# -# FOO_INCLUDES:STRING="/A;/B" -# -# assuming both directories exist. -# Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry) -include (CorrectWindowsPaths) - -macro (RESOLVE_LIBRARIES LIBS LINK_LINE) - string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}") - set (_libs_found) - set (_directory_list) - foreach (token ${_all_tokens}) - if (token MATCHES "-L([^\" ]+|\"[^\"]+\")") - # If it's a library path, add it to the list - string (REGEX REPLACE "^-L" "" token ${token}) - string (REGEX REPLACE "//" "/" token ${token}) - convert_cygwin_path(token) - list (APPEND _directory_list ${token}) - elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))") - # It's a library, resolve the path by looking in the list and then (by default) in system directories - if (WIN32) #windows expects "libfoo", linux expects "foo" - string (REGEX REPLACE "^-l" "lib" token ${token}) - else (WIN32) - string (REGEX REPLACE "^-l" "" token ${token}) - endif (WIN32) - set (_root) - if (token MATCHES "^/") # We have an absolute path - #separate into a path and a library name: - string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token}) - string (REGEX MATCH ".*[^${libname}$]" libpath ${token}) - convert_cygwin_path(libpath) - set (_directory_list ${_directory_list} ${libpath}) - set (token ${libname}) - endif (token MATCHES "^/") - set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) - find_library (_lib ${token} HINTS ${_directory_list} ${_root}) - if (_lib) - string (REPLACE "//" "/" _lib ${_lib}) - list (APPEND _libs_found ${_lib}) - else (_lib) - message (STATUS "Unable to find library ${token}") - endif (_lib) - endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")") - endforeach (token) - set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) - # only the LAST occurence of each library is required since there should be no circular dependencies - if (_libs_found) - list (REVERSE _libs_found) - list (REMOVE_DUPLICATES _libs_found) - list (REVERSE _libs_found) - endif (_libs_found) - set (${LIBS} "${_libs_found}") -endmacro (RESOLVE_LIBRARIES) - -macro (RESOLVE_INCLUDES INCS COMPILE_LINE) - string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}") - set (_incs_found) - foreach (token ${_all_tokens}) - string (REGEX REPLACE "^-I" "" token ${token}) - string (REGEX REPLACE "//" "/" token ${token}) - convert_cygwin_path(token) - if (EXISTS ${token}) - list (APPEND _incs_found ${token}) - else (EXISTS ${token}) - message (STATUS "Include directory ${token} does not exist") - endif (EXISTS ${token}) - endforeach (token) - list (REMOVE_DUPLICATES _incs_found) - set (${INCS} "${_incs_found}") -endmacro (RESOLVE_INCLUDES) diff --git a/CoreFlows/examples/CMakeLists.txt b/CoreFlows/examples/CMakeLists.txt index d96eaff..00d91cc 100755 --- a/CoreFlows/examples/CMakeLists.txt +++ b/CoreFlows/examples/CMakeLists.txt @@ -11,7 +11,7 @@ if (COREFLOWS_WITH_PYTHON ) endif (COREFLOWS_WITH_PYTHON ) -add_custom_target (tests COMMAND ctest -O testsCoreFlows.log) +add_custom_target (tests_CoreFlows COMMAND ctest -O testsCoreFlows.log) add_custom_target (SinglePhase COMMAND ctest -R SinglePhase)# may be replace ctest -R with ctest -L add_custom_target (DriftModel COMMAND ctest -R DriftModel) # may be replace ctest -R with ctest -L @@ -19,20 +19,20 @@ add_custom_target (IsothermalTwoFluid COMMAND ctest -R IsothermalTwoFluid)# may add_custom_target ( FiveEqsTwoFluid COMMAND ctest -R FiveEqsTwoFluid)# may be replace ctest -R with ctest -L add_custom_target (DiffusionEquation COMMAND ctest -R DiffusionEquation -E StationaryDiffusionEquation)# may be replace ctest -R with ctest -L -add_custom_target (diffusion COMMAND ctest -R DiffusionEquation)# may be replace ctest -R with ctest -L +add_custom_target (diffusion_tests COMMAND ctest -R DiffusionEquation)# may be replace ctest -R with ctest -L add_custom_target (TransportEquation COMMAND ctest -R TransportEquation)# may be replace ctest -R with ctest -L -add_custom_target (transport COMMAND ctest -R TransportEquation)# may be replace ctest -R with ctest -L +add_custom_target (transport_tests COMMAND ctest -R TransportEquation)# may be replace ctest -R with ctest -L add_custom_target (StationaryDiffusionEquation COMMAND ctest -R StationaryDiffusionEquation)# may be replace ctest -R with ctest -L add_custom_target (convergence COMMAND ctest -R convergence)# may be replace ctest -R with ctest -L -add_custom_target (fv COMMAND ctest -R FV)# may be replace ctest -R with ctest -L -add_custom_target (FV COMMAND ctest -R FV)# may be replace ctest -R with ctest -L -add_custom_target (fe COMMAND ctest -R FE)# may be replace ctest -R with ctest -L -add_custom_target (FE COMMAND ctest -R FE)# may be replace ctest -R with ctest -L -add_custom_target (1D COMMAND ctest -R 1D)# may be replace ctest -R with ctest -L -add_custom_target (2D COMMAND ctest -R 2D)# may be replace ctest -R with ctest -L -add_custom_target (3D COMMAND ctest -R 3D)# may be replace ctest -R with ctest -L +add_custom_target (fv_tests COMMAND ctest -R FV)# may be replace ctest -R with ctest -L +add_custom_target (FV_tests COMMAND ctest -R FV)# may be replace ctest -R with ctest -L +add_custom_target (fe_tests COMMAND ctest -R FE)# may be replace ctest -R with ctest -L +add_custom_target (FE_tests COMMAND ctest -R FE)# may be replace ctest -R with ctest -L +add_custom_target (1D_tests COMMAND ctest -R 1D)# may be replace ctest -R with ctest -L +add_custom_target (2D_tests COMMAND ctest -R 2D)# may be replace ctest -R with ctest -L +add_custom_target (3D_tests COMMAND ctest -R 3D)# may be replace ctest -R with ctest -L add_custom_target (Dirichlet COMMAND ctest -R Dirichlet)# may be replace ctest -R with ctest -L add_custom_target (Neumann COMMAND ctest -R Neumann)# may be replace ctest -R with ctest -L diff --git a/CoreFlows/examples/Python/Convergence/StationaryDiffusion/synthesis/CMakeLists.txt b/CoreFlows/examples/Python/Convergence/StationaryDiffusion/synthesis/CMakeLists.txt index 9bb25e7..3938ca8 100644 --- a/CoreFlows/examples/Python/Convergence/StationaryDiffusion/synthesis/CMakeLists.txt +++ b/CoreFlows/examples/Python/Convergence/StationaryDiffusion/synthesis/CMakeLists.txt @@ -11,4 +11,4 @@ SET(TABLES file(COPY ${NOTEBOOK} ${TABLES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -add_custom_target ( notebook COMMAND jupyter-nbconvert --to notebook --execute convergence_synthesis_StationaryDiffusion.ipynb ) +add_custom_target ( notebook_CoreFlows COMMAND jupyter-nbconvert --to notebook --execute convergence_synthesis_StationaryDiffusion.ipynb ) diff --git a/CoreFlows/swig/CMakeLists.txt b/CoreFlows/swig/CMakeLists.txt index 0ad4399..e4a0bdc 100755 --- a/CoreFlows/swig/CMakeLists.txt +++ b/CoreFlows/swig/CMakeLists.txt @@ -5,7 +5,7 @@ SET_SOURCE_FILES_PROPERTIES(CoreFlows.i PROPERTIES C OFF) SET_SOURCE_FILES_PROPERTIES(CoreFlows.i PROPERTIES SWIG_DEFINITIONS "-shadow") INCLUDE_DIRECTORIES( - ${PYTHON_INCLUDE_DIRS} + ${Python_INCLUDE_DIRS} ${CoreFlows_INCLUDES} # ) diff --git a/README.md b/README.md new file mode 100755 index 0000000..9332aaa --- /dev/null +++ b/README.md @@ -0,0 +1,117 @@ +SOLVERLAB +====== + +SOLVERLAB is a geometrical and numerical C++/Python library designed for numerical analysts who work on the discretisation of partial differential equations on general shapes and meshes and would rather focus on high-level scripting. The goal is to provide simple MATLAB style functions for the generation and manipulation of meshes, fields and matrices. The library originates from [CDMATH](http://cdmath.jimdo.com), a collaborative workgroup with the same name. It is based on the [MEDcoupling](https://docs.salome-platform.org/latest/dev/MEDCoupling/tutorial/index.html) C++/python library of the [SALOME](http://www.salome-platform.org/) project for the handling of meshes and fields, and on the C++ library [PETSC](https://www.mcs.anl.gov/petsc/) for the handling of matrices and linear solvers. + +SOLVERLAB includes PDE systems +arising from the modeling of nuclear reactor cores which involves fluid dynamics, heat and neutron diffusion as well as solid elasticity. It +is a simple environment meant at students and researchers for teachind and promote new numerical +methods on general geometries with unstructured meshes. +The main research objectives of SOLVERLAB are the study of + +- Numerical schemes for compressible flows at low Mach numbers on general meshes +- Well balanced schemes for stiff source terms (heat source, phase change, pressure losses) +- Numerical handling of flow inversion, phase disappearance and counter-currents in two phase flows +- Numerical handling of stiff porosity or cross section functions +- Schemes that preserve the phasic volume fraction α ∈ [0, 1] +- Convergence of finite volume methods +- New preconditioners for implicit methods for two phase flows +- The coupling of fluid models or multiphysics coupling (eg thermal hydraulics and neutronics or thermal hydraulics and solid thermics) + +The library is currently developed for linux distributions and is maintained on Ubuntu 16.04 LTS and 18.04 LTS, as well as on Fedora 24, 26, 28, 29 and 30. + +Examples of use +--------------- +- [Examples of stable numerical methods for the 1D linear transport equation](CDMATH/tests/doc/1DTransportEquation/RegularGrid/TransportEquation1D_RegularGrid.ipynb) +- [Shock formation and numerical capture issues for the 1D Burgers' equations](tests/doc/1DBurgersEquation/BurgersEquation1D.ipynb) +- [Influence of the mesh on the convergence and low Mach precision for the UPWIND finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_Upwind_SQUARE.ipynb) +- [Influence of the mesh on the convergence and low Mach precision for the CENTERED finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_Centered_SQUARE.ipynb) +- [Influence of the mesh on the convergence and low Mach precision for the STAGGERED finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_Staggered_SQUARE_squares.ipynb) +- [Influence of the mesh on the convergence and low Mach precision for the PSEUDO-STAGGERED (colocated) finite volume method applied to the 2D wave system](CDMATH/tests/doc/2DWaveSystemVF_stationary/Convergence_WaveSystem_PStag_SQUARE.ipynb) +- [Finite elements for the Poisson problem on a cube in 3D (by S. Kameni Ngwamou, PhD student)](CDMATH/tests/doc/3DPoissonEF/FiniteElements3DPoisson_CUBE.ipynb) +- [Finite elements for the stationary diffusion of the temperature in a 3D room. Influence of the radiator position (by S. Kameni Ngwamou, PhD student)](CDMATH/tests/doc/3DRoomCoolingEF/3DRoomCoolingEF.ipynb) +- [Surface Finite elements for the Poisson-Beltrami problem on a sphere in 3D (by M. Nguemfouo, PhD student)](CDMATH/tests/doc/3DPoissonSphereEF/SynthesisConvergenceFESphere.pdf) +- [Surface Finite elements for the Poisson-Beltrami problem on a torus in 3D (by M. Nguemfouo, PhD student)](CDMATH/tests/doc/3DPoissonTorusEF/SynthesisConvergenceFETorus.pdf) + +Download SOLVERLAB sources to compile +---------------------------------- + +Create your source directory. For instance: +* `mkdir ~/workspace/SOLVERLAB` +* `cd ~/workspace/SOLVERLAB` + +Download from GitHub +* click on the following link : `https://github.com/ndjinga/SOLVERLAB/archive/master.zip`, then unzip the file in a directory SOLVERLAB-master +* or type the following in a terminal : `wget https://github.com/ndjinga/SOLVERLAB/archive/master.zip`, then unzip the file in a directory SOLVERLAB-master +* or clone the git repository to a folder SOLVERLAB-master: `git clone https://github.com/ndjinga/SOLVERLAB.git SOLVERLAB-master` + + +Set the environment for the compilation of SOLVERLAB +--------------------------------------------- +Dependencies. The following package list is sufficient on Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04 : + + - `cmake3` (mandatory) + - `g++` or another C++ compiler (mandatory) + - `python-dev`, `python-numpy` and `swig3`for python scripts (mandatory) + - `python-matplotlib` and `paraview` for postprocessing tools such as plotting curves (matplotlib) or generating 3D view images (paraview) (mandatory) + - `doxygen`, `graphviz` and `mscgen`, if you want to generate a nice source code documentation in `~/workspace/SOLVERLAB/SOLVERLAB_install/doc/`. Use the compilation option `-DSOLVERLAB_WITH_DOCUMENTATION=ON` (optional). + - `libcppunit-dev`, if you want to generate unit tests. Use the compilation option `-DSOLVERLAB_WITH_TESTS=ON` (optional). + - `rpm`, if you want to generate RPM installation packages. Use the compilation option `-DSOLVERLAB_WITH_PACKAGE=ON` (optional). + +Directories. Create the suggested build and installation folders: +* `cd ~/workspace/SOLVERLAB` +* `mkdir SOLVERLAB_build` +* `mkdir SOLVERLAB_install` +* `cd SOLVERLAB_build` + + +Compile and install SOLVERLAB +-------------------------- +Simpler build for a minimum version: +* `cmake ../SOLVERLAB-master/ -DCMAKE_INSTALL_PREFIX=../SOLVERLAB_install -DCMAKE_BUILD_TYPE=Release ` +> This will download and build the following dependencies +> - PETSc from http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.13.tar.gz +> - SLEPc from https://slepc.upv.es/download/distrib/slepc-3.13.4.tar.gz +> - HDF5 http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz +> - MEDFILE from http://files.salome-platform.org/Salome/other/med-4.1.0.tar.gz +> - MEDCOUPLING from http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz + +If you already have an installation of PETSC, MED and MEDCoupling, you may save computational time and memory by using the advanced build version: +* `cmake ../SOLVERLAB-master -DCMAKE_INSTALL_PREFIX=../SOLVERLAB_install -DCMAKE_BUILD_TYPE=Release -G"Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION=4.3 -DSOLVERLAB_WITH_DOCUMENTATION=ON -DPETSC_DIR=${PETSC_DIR} -DPETSC_ARCH=${PETSC_ARCH} -DMEDFILE_ROOT_DIR=${MEDFILE_ROOT_DIR} -DMEDCOUPLING_ROOT_DIR=${MEDCOUPLING_ROOT_DIR}` +> This assumes that you have an existing +> - install of PETSc (with submodules SLEPC and HDF5) at the location given by the environment variable PETSC_DIR and the architecture variable PETSC_ARCH +> See the instructions given in [the official documentation](http://www.mcs.anl.gov/petsc/documentation/installation.html) +> - install of MED at the location given by the environment variable MEDFILE_ROOT_DIR +> - install of MEDCOUPLING at the location given by the environment variable MEDCOUPLING_ROOT_DIR + +The 3 dependencies PETSC, MED and MEDCOUPLING should have been compiled with the same version of HDF5 +Warning : the linux package libhdf5-dev is generally not compatible with the libraries MED and MEDCoupling +Compile and install: +* `make` +* `make doc install` + +Run unit and example tests: +* make example + +Run validation tests: +* make validation + +Use of SOLVERLAB +------------- + +To use SOLVERLAB with your Python code, you can load the SOLVERLAB environment in your terminal using the command + * source `~/workspace/SOLVERLAB/SOLVERLAB_install/env_SOLVERLAB.sh` +Then in your terminal simply type +- `python main.py ` + +If performance or parallelism is an issue for your simulations, you can use SOLVERLAB librairies with your C++ code : + * C++ libraries: `export LD_LIBRARY_PATH=~/workspace/SOLVERLAB/SOLVERLAB_install/lib` + * To know how to include the right libraries for compilation, see the makefiles of the examples. They include the list ` -lmedC -lmedloader -lmedcoupling -lbase -lmesh -llinearsolver`. + +The SOLVERLAB environment variables consist in : + * SOLVERLAB C++ library path: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib` + * SOLVERLAB Python library paths: `~/workspace/SOLVERLAB/SOLVERLAB_install/lib/SOLVERLAB:~/workspace/SOLVERLAB/SOLVERLAB_install/bin/SOLVERLAB` + * PETSc, SLEPc and HDF5 library path: `${PETSC_DIR}/${PETSC_ARCH}/lib` + * MED library path: `${MEDFILE_ROOT_DIR}/lib` + * MEDCOUPLING library path: `${MEDCOUPLING_ROOT_DIR}/lib` + diff --git a/cmake_files/CodeCoverage.cmake b/cmake_files/CodeCoverage.cmake new file mode 100755 index 0000000..30327e8 --- /dev/null +++ b/cmake_files/CodeCoverage.cmake @@ -0,0 +1,192 @@ +# Copyright (c) 2012 - 2015, Lars Bilke +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# +# +# 2012-01-31, Lars Bilke +# - Enable Code Coverage +# +# 2013-09-17, Joakim Söderberg +# - Added support for Clang. +# - Some additional usage instructions. +# +# USAGE: + +# 0. (Mac only) If you use Xcode 5.1 make sure to patch geninfo as described here: +# http://stackoverflow.com/a/22404544/80480 +# +# 1. Copy this file into your cmake modules path. +# +# 2. Add the following line to your CMakeLists.txt: +# INCLUDE(CodeCoverage) +# +# 3. Set compiler flags to turn off optimization and enable coverage: +# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") +# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage") +# +# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target +# which runs your test executable and produces a lcov code coverage report: +# Example: +# SETUP_TARGET_FOR_COVERAGE( +# my_coverage_target # Name for custom target. +# test_driver # Name of the test driver executable that runs the tests. +# # NOTE! This should always have a ZERO as exit code +# # otherwise the coverage generation will not complete. +# coverage # Name of output directory. +# ) +# +# 4. Build a Debug build: +# cmake -DCMAKE_BUILD_TYPE=Debug .. +# make +# make my_coverage_target +# +# + +# Check prereqs +FIND_PROGRAM( GCOV_PATH gcov ) +FIND_PROGRAM( LCOV_PATH lcov ) +FIND_PROGRAM( GENHTML_PATH genhtml ) +FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests) + +IF(NOT GCOV_PATH) + MESSAGE(FATAL_ERROR "gcov not found! Aborting...") +ENDIF() # NOT GCOV_PATH + +IF(NOT CMAKE_COMPILER_IS_GNUCXX) + # Clang version 3.0.0 and greater now supports gcov as well. + MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.") + + IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...") + ENDIF() +ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX + +SET(CMAKE_CXX_FLAGS_COVERAGE + "-g -O0 --coverage -fprofile-arcs -ftest-coverage" + CACHE STRING "Flags used by the C++ compiler during coverage builds." + FORCE ) +SET(CMAKE_C_FLAGS_COVERAGE + "-g -O0 --coverage -fprofile-arcs -ftest-coverage" + CACHE STRING "Flags used by the C compiler during coverage builds." + FORCE ) +SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE + "" + CACHE STRING "Flags used for linking binaries during coverage builds." + FORCE ) +SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE + "" + CACHE STRING "Flags used by the shared libraries linker during coverage builds." + FORCE ) +MARK_AS_ADVANCED( + CMAKE_CXX_FLAGS_COVERAGE + CMAKE_C_FLAGS_COVERAGE + CMAKE_EXE_LINKER_FLAGS_COVERAGE + CMAKE_SHARED_LINKER_FLAGS_COVERAGE ) + +IF ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage")) + MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" ) +ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug" + + +# Param _targetname The name of new the custom make target +# Param _testrunner The name of the target which runs the tests. +# MUST return ZERO always, even on errors. +# If not, no coverage report will be created! +# Param _outputname lcov output is generated as _outputname.info +# HTML report is generated in _outputname/index.html +# Optional fourth parameter is passed as arguments to _testrunner +# Pass them in list form, e.g.: "-j;2" for -j 2 +FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname) + + IF(NOT LCOV_PATH) + MESSAGE(FATAL_ERROR "lcov not found! Aborting...") + ENDIF() # NOT LCOV_PATH + + IF(NOT GENHTML_PATH) + MESSAGE(FATAL_ERROR "genhtml not found! Aborting...") + ENDIF() # NOT GENHTML_PATH + + # Setup target + ADD_CUSTOM_TARGET(${_targetname} + + # Cleanup lcov + ${LCOV_PATH} --directory . --zerocounters + + # Run tests + COMMAND ${_testrunner} ${ARGV3} + + # Capturing lcov counters and generating report + COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info + COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'tests/*' '/usr/*' --output-file ${_outputname}.info.cleaned + COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned + COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned + + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report." + ) + + # Show info where to find the report + ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD + COMMAND ; + COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report." + ) + +ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE + +# Param _targetname The name of new the custom make target +# Param _testrunner The name of the target which runs the tests +# Param _outputname cobertura output is generated as _outputname.xml +# Optional fourth parameter is passed as arguments to _testrunner +# Pass them in list form, e.g.: "-j;2" for -j 2 +FUNCTION(SETUP_TARGET_FOR_COVERAGE_COBERTURA _targetname _testrunner _outputname) + + IF(NOT PYTHON_EXECUTABLE) + MESSAGE(FATAL_ERROR "Python not found! Aborting...") + ENDIF() # NOT PYTHON_EXECUTABLE + + IF(NOT GCOVR_PATH) + MESSAGE(FATAL_ERROR "gcovr not found! Aborting...") + ENDIF() # NOT GCOVR_PATH + + ADD_CUSTOM_TARGET(${_targetname} + + # Run tests + ${_testrunner} ${ARGV3} + + # Running gcovr + COMMAND ${GCOVR_PATH} -x -r ${CMAKE_SOURCE_DIR} -e '${CMAKE_SOURCE_DIR}/tests/' -o ${_outputname}.xml + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMENT "Running gcovr to produce Cobertura code coverage report." + ) + + # Show info where to find the report + ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD + COMMAND ; + COMMENT "Cobertura code coverage report saved in ${_outputname}.xml." + ) +ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE_COBERTURA diff --git a/cmake_files/CorrectWindowsPaths.cmake b/cmake_files/CorrectWindowsPaths.cmake new file mode 100755 index 0000000..e1d5e13 --- /dev/null +++ b/cmake_files/CorrectWindowsPaths.cmake @@ -0,0 +1,38 @@ +##Copyright (C) johnfettig. +##All rights reserved. +## +##Redistribution and use in source and binary forms, with or without modification, +##are permitted provided that the following conditions are met: +## +##* Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +##* Redistributions in binary form must reproduce the above copyright notice, this +## list of conditions and the following disclaimer in the documentation and/or +## other materials provided with the distribution. +## +##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# CorrectWindowsPaths - this module defines one macro +# +# CONVERT_CYGWIN_PATH( PATH ) +# This uses the command cygpath (provided by cygwin) to convert +# unix-style paths into paths useable by cmake on windows + +macro (CONVERT_CYGWIN_PATH _path) + if (WIN32) + EXECUTE_PROCESS(COMMAND cygpath.exe -m ${${_path}} + OUTPUT_VARIABLE ${_path}) + string (STRIP ${${_path}} ${_path}) + endif (WIN32) +endmacro (CONVERT_CYGWIN_PATH) + diff --git a/cmake_files/FindCDMATH.cmake b/cmake_files/FindCDMATH.cmake new file mode 100755 index 0000000..ec75b3b --- /dev/null +++ b/cmake_files/FindCDMATH.cmake @@ -0,0 +1,85 @@ +##Copyright (C) arthurtalpaert. +##All rights reserved. +## +##Redistribution and use in source and binary forms, with or without modification, +##are permitted provided that the following conditions are met: +## +##* Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +##* Redistributions in binary form must reproduce the above copyright notice, this +## list of conditions and the following disclaimer in the documentation and/or +## other materials provided with the distribution. +## +##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# - Try to find CDMATH +# Once done this will define +# +# CDMATH_FOUND - system has CDMATH +# CDMATH_INCLUDES - the CDMATH include directories +# CDMATH_LIBRARIES - Link these to use CDMATH +# +# Usage: +# find_package(CDMATH) +# +# Setting these changes the behavior of the search: +# CDMATH_DIR - directory in which CDMATH resides +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +find_path (CDMATH_DIR include/CdmathException.hxx + HINTS ENV CDMATH_DIR + PATHS + /usr + $ENV{HOME}/cdmath + $ENV{HOME}/workspace/cdmath_install + DOC "CDMATH Directory") +message (STATUS "Found CDMATH: ${CDMATH_DIR}") + +# Include directories +set(MED_INCLUDES $ENV{MEDFILE_INCLUDE_DIRS}) +if (NOT (IS_DIRECTORY ${MED_INCLUDES}) ) + message (SEND_ERROR "MED_INCLUDES can not be used, ${MED_INCLUDES} does not exist.") +endif () +set(MEDCOUPLING_INCLUDES $ENV{MEDCOUPLING_INCLUDE_DIR}) +if (NOT (IS_DIRECTORY ${MEDCOUPLING_INCLUDES}) ) + message (SEND_ERROR "MEDCOUPLING_INCLUDES can not be used, ${MEDCOUPLING_INCLUDES} does not exist.") +endif () +# This sets the variable ${CDMATH_INCLUDES}. +set(CDMATH_INCLUDES ${CDMATH_DIR}/include ${MED_INCLUDES} ${MEDCOUPLING_INCLUDES} ) +if (NOT (IS_DIRECTORY ${CDMATH_DIR}/include) ) + message (SEND_ERROR "CDMATH_INCLUDES can not be used, ${CDMATH_DIR}/include does not exist.") +endif () + +# CDMATH libraries against which to link +# This sets the variable ${CDMATH_LIBRARIES}. +set(CDMATH_LIBDIR ${CDMATH_DIR}/lib) +if ( NOT (IS_DIRECTORY ${CDMATH_LIBDIR}) ) + message (SEND_ERROR "CDMATH_LIBDIR can not be used, ${CDMATH_LIBDIR} does not exist.") +endif () +find_library (CDMATHBASE_LIB NAMES base PATHS ${CDMATH_LIBDIR}) +find_library (CDMATHMESH_LIB NAMES mesh PATHS ${CDMATH_LIBDIR}) +find_library (CDMATHLINEARSOLVER_LIB NAMES linearsolver PATHS ${CDMATH_LIBDIR}) +find_library (MEDC_LIB NAMES medC PATHS $ENV{MEDFILE_ROOT_DIR}/lib) +find_library (MEDLOADER_LIB NAMES medloader PATHS $ENV{MEDCOUPLING_LIBRARIES}) +find_library (MEDCOUPLING_LIB NAMES medcoupling PATHS $ENV{MEDCOUPLING_LIBRARIES}) +set (CDMATH_LIBRARIES + ${MEDC_LIB} + ${MEDLOADER_LIB} + ${MEDCOUPLING_LIB} + ${CDMATHBASE_LIB} + ${CDMATHMESH_LIB} + ${CDMATHLINEARSOLVER_LIB} + ) diff --git a/cmake_files/FindCPPUNIT.cmake b/cmake_files/FindCPPUNIT.cmake new file mode 100755 index 0000000..4193644 --- /dev/null +++ b/cmake_files/FindCPPUNIT.cmake @@ -0,0 +1,151 @@ +# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +# +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ------ + +MESSAGE(STATUS "Check for cppunit ...") + +# ------ + +IF(CPPUNIT_IS_MANDATORY STREQUAL 0) + SET(CPPUNIT_IS_MANDATORY 0) + SET(CPPUNIT_IS_OPTIONAL 1) +ENDIF(CPPUNIT_IS_MANDATORY STREQUAL 0) +IF(CPPUNIT_IS_OPTIONAL STREQUAL 0) + SET(CPPUNIT_IS_MANDATORY 1) + SET(CPPUNIT_IS_OPTIONAL 0) +ENDIF(CPPUNIT_IS_OPTIONAL STREQUAL 0) +IF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL) + SET(CPPUNIT_IS_MANDATORY 0) + SET(CPPUNIT_IS_OPTIONAL 1) +ENDIF(NOT CPPUNIT_IS_MANDATORY AND NOT CPPUNIT_IS_OPTIONAL) + +# ------ + +SET(CPPUNIT_STATUS 1) +IF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) + SET(CPPUNIT_STATUS 0) + MESSAGE(STATUS "cppunit disabled from command line.") +ENDIF(WITHOUT_CPPUNIT OR WITH_CPPUNIT STREQUAL 0) + +# ------ + +IF(CPPUNIT_STATUS) + IF(WITH_CPPUNIT) + SET(CPPUNIT_ROOT_USER ${WITH_CPPUNIT}) + ELSE(WITH_CPPUNIT) + SET(CPPUNIT_ROOT_USER $ENV{CPPUNIT_ROOT}) + ENDIF(WITH_CPPUNIT) +ENDIF(CPPUNIT_STATUS) + +# ----- + +IF(CPPUNIT_STATUS) + IF(CPPUNIT_ROOT_USER) + SET(CPPUNIT_FIND_PATHS_OPTION NO_DEFAULT_PATH) + ELSE(CPPUNIT_ROOT_USER) + SET(CPPUNIT_FIND_PATHS_OPTION) + ENDIF(CPPUNIT_ROOT_USER) +ENDIF(CPPUNIT_STATUS) + +# ----- + +IF(CPPUNIT_STATUS) + IF(CPPUNIT_ROOT_USER) + SET(CPPUNIT_INCLUDE_PATHS ${CPPUNIT_ROOT_USER} ${CPPUNIT_ROOT_USER}/include) + ELSE(CPPUNIT_ROOT_USER) + SET(CPPUNIT_INCLUDE_PATHS) + ENDIF(CPPUNIT_ROOT_USER) + SET(CPPUNIT_INCLUDE_TO_FIND cppunit/extensions/HelperMacros.h) + FIND_PATH(CPPUNIT_INCLUDE_DIR ${CPPUNIT_INCLUDE_TO_FIND} PATHS ${CPPUNIT_INCLUDE_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) + IF(CPPUNIT_INCLUDE_DIR) + IF(CPPUNIT_ROOT_USER) + SET(CPPUNIT_INCLUDES -I${CPPUNIT_INCLUDE_DIR})# to be removed + IF(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) + SET(CPPUNIT_INCLUDE_DIRS) + ELSE(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) + SET(CPPUNIT_INCLUDE_DIRS ${CPPUNIT_INCLUDE_DIR}) + ENDIF(${CPPUNIT_INCLUDE_DIR} STREQUAL /usr/include) + ENDIF(CPPUNIT_ROOT_USER) + MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} found in ${CPPUNIT_INCLUDE_DIR}") + ELSE(CPPUNIT_INCLUDE_DIR) + SET(CPPUNIT_STATUS 0) + IF(CPPUNIT_ROOT_USER) + MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found in ${CPPUNIT_INCLUDE_PATHS}, check your CPPUNIT installation.") + ELSE(CPPUNIT_ROOT_USER) + MESSAGE(STATUS "${CPPUNIT_INCLUDE_TO_FIND} not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") + ENDIF(CPPUNIT_ROOT_USER) + ENDIF(CPPUNIT_INCLUDE_DIR) +ENDIF(CPPUNIT_STATUS) + +# ---- + +IF(CPPUNIT_STATUS) + IF(CPPUNIT_ROOT_USER) + SET(CPPUNIT_LIB_PATHS ${CPPUNIT_ROOT_USER}/lib) + ELSE(CPPUNIT_ROOT_USER) + SET(CPPUNIT_LIB_PATHS) + ENDIF(CPPUNIT_ROOT_USER) +ENDIF(CPPUNIT_STATUS) + +IF(CPPUNIT_STATUS) + IF(WINDOWS) + IF(CMAKE_BUILD_TYPE STREQUAL Debug) + FIND_LIBRARY(CPPUNIT_LIB cppunitd_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) + ELSE(CMAKE_BUILD_TYPE STREQUAL Debug) + FIND_LIBRARY(CPPUNIT_LIB cppunit_dll PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) + ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug) + ELSE(WINDOWS) + FIND_LIBRARY(CPPUNIT_LIB cppunit PATHS ${CPPUNIT_LIB_PATHS} ${CPPUNIT_FIND_PATHS_OPTION}) + ENDIF(WINDOWS) + SET(CPPUNIT_LIBS) + IF(CPPUNIT_LIB) + SET(CPPUNIT_LIBS ${CPPUNIT_LIBS} ${CPPUNIT_LIB}) + MESSAGE(STATUS "cppunit lib found: ${CPPUNIT_LIB}") + ELSE(CPPUNIT_LIB) + SET(CPPUNIT_STATUS 0) + IF(CPPUNIT_ROOT_USER) + MESSAGE(STATUS "cppunit lib not found in ${CPPUNIT_LIB_PATHS}, check your CPPUNIT installation.") + ELSE(CPPUNIT_ROOT_USER) + MESSAGE(STATUS "cppunit lib not found on system, try to use WITH_CPPUNIT option or CPPUNIT_ROOT environment variable.") + ENDIF(CPPUNIT_ROOT_USER) + ENDIF(CPPUNIT_LIB) +ENDIF(CPPUNIT_STATUS) + +# ---- + +IF(CPPUNIT_STATUS) + SET(CPPUNIT_IS_OK 1) + SET(CPPUNIT_DEFINITIONS) + IF(WINDOWS) + SET(CPPUNIT_INCLUDES ${CPPUNIT_INCLUDES} -DCPPUNIT_DLL) + SET(CPPUNIT_DEFINITIONS "-DCPPUNIT_DLL") + ENDIF(WINDOWS) +ELSE(CPPUNIT_STATUS) + IF(CPPUNIT_IS_MANDATORY) + MESSAGE(FATAL_ERROR "cppunit not found ... mandatory ... abort") + ELSE(CPPUNIT_IS_MANDATORY) + MESSAGE(STATUS "cppunit not found ... optional ... disabled") + ENDIF(CPPUNIT_IS_MANDATORY) +ENDIF(CPPUNIT_STATUS) + +# ------ diff --git a/cmake_files/FindMEDFile.cmake b/cmake_files/FindMEDFile.cmake new file mode 100755 index 0000000..48b99ac --- /dev/null +++ b/cmake_files/FindMEDFile.cmake @@ -0,0 +1,54 @@ +# - Find MED file installation +# +# The following variable are set: +# MEDFILE_INCLUDE_DIRS +# MEDFILE_LIBRARIES +# MEDFILE_C_LIBRARIES +# MEDFILE_F_LIBRARIES +# +# The CMake (or environment) variable MEDFILE_ROOT_DIR can be set to +# guide the detection and indicate a root directory to look into. +# +############################################################################ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# ------ + +MESSAGE(STATUS "Check for medfile ...") + +# ------ + +SET(MEDFILE_ROOT_DIR $ENV{MEDFILE_ROOT_DIR} CACHE PATH "Path to the MEDFile.") +IF(MEDFILE_ROOT_DIR) + LIST(APPEND CMAKE_PREFIX_PATH "${MEDFILE_ROOT_DIR}") +ENDIF(MEDFILE_ROOT_DIR) + +FIND_PATH(MEDFILE_INCLUDE_DIRS med.h) +#FIND_PROGRAM(MDUMP mdump) +FIND_LIBRARY(MEDFILE_C_LIBRARIES NAMES medC) +FIND_LIBRARY(MEDFILE_F_LIBRARIES NAMES med) +IF(MEDFILE_F_LIBRARIES) + SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES} ${MEDFILE_F_LIBRARIES}) +ELSE(MEDFILE_F_LIBRARIES) + SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES}) +ENDIF(MEDFILE_F_LIBRARIES) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MEDFile REQUIRED_VARS MEDFILE_INCLUDE_DIRS MEDFILE_LIBRARIES) diff --git a/cmake_files/FindMatplotlib.cmake b/cmake_files/FindMatplotlib.cmake new file mode 100755 index 0000000..974887e --- /dev/null +++ b/cmake_files/FindMatplotlib.cmake @@ -0,0 +1,46 @@ +# - Find the matplotlib libraries +# This module finds IF matplotlib is installed, and sets the following variables +# indicating where it is. +# +# MATPLOTLIB_FOUND - was matplotlib found +# MATPLOTLIB_VERSION - the version of matplotlib found as a string +# MATPLOTLIB_VERSION_MAJOR - the major version number of matplotlib +# MATPLOTLIB_VERSION_MINOR - the minor version number of matplotlib +# MATPLOTLIB_VERSION_PATCH - the patch version number of matplotlib +# MATPLOTLIB_PATH_DIRS - path to the matplotlib include files + +IF(PYTHONINTERP_FOUND) + # Try to import matplotlib into Python interpreter. Python + # interpreter was found previously as required package, so + # don't take care about this. + execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "import matplotlib as m; print(m.__version__); print(m.__path__[0]);" + RESULT_VARIABLE _MATPLOTLIB_SEARCH_SUCCESS + OUTPUT_VARIABLE _MATPLOTLIB_VALUES + ERROR_VARIABLE _MATPLOTLIB_ERROR_VALUE + OUTPUT_STRIP_TRAILING_WHITESPACE) + + IF(_MATPLOTLIB_SEARCH_SUCCESS MATCHES 0) + set(MATPLOTLIB_FOUND TRUE) + + # Convert the process output into a list + string(REGEX REPLACE ";" "\\\\;" _MATPLOTLIB_VALUES ${_MATPLOTLIB_VALUES}) + string(REGEX REPLACE "\n" ";" _MATPLOTLIB_VALUES ${_MATPLOTLIB_VALUES}) + list(GET _MATPLOTLIB_VALUES 0 MATPLOTLIB_VERSION) + list(GET _MATPLOTLIB_VALUES 1 MATPLOTLIB_PATH_DIRS) + + # Make sure all directory separators are '/' + string(REGEX REPLACE "\\\\" "/" MATPLOTLIB_PATH_DIRS ${MATPLOTLIB_PATH_DIRS}) + + # Get the major and minor version numbers + string(REGEX REPLACE "\\." ";" _MATPLOTLIB_VERSION_LIST ${MATPLOTLIB_VERSION}) + list(GET _MATPLOTLIB_VERSION_LIST 0 MATPLOTLIB_VERSION_MAJOR) + list(GET _MATPLOTLIB_VERSION_LIST 1 MATPLOTLIB_VERSION_MINOR) + list(GET _MATPLOTLIB_VERSION_LIST 2 MATPLOTLIB_VERSION_PATCH) + ELSE() + set(MATPLOTLIB_FOUND FALSE) + ENDIF() +ELSE() + set(MATPLOTLIB_FOUND FALSE) +ENDIF() + diff --git a/cmake_files/FindPETSc.cmake b/cmake_files/FindPETSc.cmake new file mode 100644 index 0000000..a81c9f9 --- /dev/null +++ b/cmake_files/FindPETSc.cmake @@ -0,0 +1,351 @@ +# - Try to find PETSc +# Once done this will define +# +# PETSC_FOUND - system has PETSc +# PETSC_INCLUDES - the PETSc include directories +# PETSC_LIBRARIES - Link these to use PETSc +# PETSC_COMPILER - Compiler used by PETSc, helpful to find a compatible MPI +# PETSC_DEFINITIONS - Compiler switches for using PETSc +# PETSC_MPIEXEC - Executable for running MPI programs +# PETSC_VERSION - Version string (MAJOR.MINOR.SUBMINOR) +# +# Usage: +# find_package(PETSc COMPONENTS CXX) - required if build --with-clanguage=C++ --with-c-support=0 +# find_package(PETSc COMPONENTS C) - standard behavior of checking build using a C compiler +# find_package(PETSc) - same as above +# +# Setting these changes the behavior of the search +# PETSC_DIR - directory in which PETSc resides +# PETSC_ARCH - build architecture +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +set(PETSC_VALID_COMPONENTS + C + CXX) + +if(NOT PETSc_FIND_COMPONENTS) + set(PETSC_LANGUAGE_BINDINGS "C") +else() + # Right now, this is designed for compatability with the --with-clanguage option, so + # only allow one item in the components list. + list(LENGTH ${PETSc_FIND_COMPONENTS} components_length) + if(${components_length} GREATER 1) + message(FATAL_ERROR "Only one component for PETSc is allowed to be specified") + endif() + # This is a stub for allowing multiple components should that time ever come. Perhaps + # to also test Fortran bindings? + foreach(component ${PETSc_FIND_COMPONENTS}) + list(FIND PETSC_VALID_COMPONENTS ${component} component_location) + if(${component_location} EQUAL -1) + message(FATAL_ERROR "\"${component}\" is not a valid PETSc component.") + else() + list(APPEND PETSC_LANGUAGE_BINDINGS ${component}) + endif() + endforeach() +endif() + +function (petsc_get_version) + if (EXISTS "${PETSC_DIR}/petscversion.h" OR EXISTS "${PETSC_DIR}/include/petscversion.h" OR EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h") + if (EXISTS "${PETSC_DIR}/include/petscversion.h") + file (STRINGS "${PETSC_DIR}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") + elseif( EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" ) + file (STRINGS "${PETSC_DIR}/${PETSC_ARCH}/include/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") + else() + file (STRINGS "${PETSC_DIR}/petscversion.h" vstrings REGEX "#define PETSC_VERSION_(RELEASE|MAJOR|MINOR|SUBMINOR|PATCH) ") + endif() + foreach (line ${vstrings}) + string (REGEX REPLACE " +" ";" fields ${line}) # break line into three fields (the first is always "#define") + list (GET fields 1 var) + list (GET fields 2 val) + set (${var} ${val} PARENT_SCOPE) + set (${var} ${val}) # Also in local scope so we have access below + endforeach () + + if (PETSC_VERSION_RELEASE) + set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}p${PETSC_VERSION_PATCH}" PARENT_SCOPE) + else () + # make dev version compare higher than any patch level of a released version + set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.99" PARENT_SCOPE) + endif () + else () + message (SEND_ERROR "PETSC_DIR can not be used, file ${PETSC_DIR}/include/petscversion.h does not exist") + endif () +endfunction () + +find_path (PETSC_DIR include/petsc.h + HINTS ENV PETSC_DIR + PATHS + #RedHat paths + /usr/include/petsc + # Debian paths + /usr/lib/petscdir/3.12.4 /usr/lib/petscdir/3.12 #Ubuntu 20.04 + /usr/lib/petscdir/3.7.6 /usr/lib/petscdir/3.7 #Ubuntu 18.04 + /usr/lib/petscdir/3.6.2 /usr/lib/petscdir/3.6 #Ubuntu 16.04 + /usr/lib/petscdir/3.5.1 /usr/lib/petscdir/3.5 + /usr/lib/petscdir/3.4.2 /usr/lib/petscdir/3.4 + /usr/lib/petscdir/3.3 /usr/lib/petscdir/3.2 /usr/lib/petscdir/3.1 + /usr/lib/petscdir/3.0.0 /usr/lib/petscdir/2.3.3 /usr/lib/petscdir/2.3.2 + # MacPorts path + /opt/local/lib/petsc + $ENV{HOME}/petsc + DOC "PETSc Directory") + +find_program (MAKE_EXECUTABLE NAMES make gmake) + +if (PETSC_DIR AND NOT PETSC_ARCH) + set (_petsc_arches + $ENV{PETSC_ARCH} # If set, use environment variable first + linux-gnu-c-debug linux-gnu-c-opt # old Debian defaults (petsc compilation) + arch-linux-c-opt or arch-linux-c-debug # new Debian defaults (petsc compilation) + x86_64-linux-gnu-real i686-linux-gnu-real # Debian defaults (petsc system installation) + arch-linux2-c-opt or arch-linux2-c-debug # old RedHat defaults (petsc compilation) + x86_64-redhat-linux-gnu i686-redhat-linux-gnu # RedHat defaults (petsc apt installation) + x86_64-unknown-linux-gnu i386-unknown-linux-gnu) + set (petscconf "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) + foreach (arch ${_petsc_arches}) + if (NOT PETSC_ARCH) + find_path (petscconf petscconf.h + HINTS ${PETSC_DIR} + PATH_SUFFIXES ${arch}/include bmake/${arch} + NO_DEFAULT_PATH) + if (petscconf) + set (PETSC_ARCH "${arch}" CACHE STRING "PETSc build architecture") + endif (petscconf) + endif (NOT PETSC_ARCH) + endforeach (arch) + set (petscconf "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) +endif (PETSC_DIR AND NOT PETSC_ARCH) + +set (petsc_slaves LIBRARIES_SYS LIBRARIES_VEC LIBRARIES_MAT LIBRARIES_DM LIBRARIES_KSP LIBRARIES_SNES LIBRARIES_TS + INCLUDE_DIR INCLUDE_CONF) +include (FindPackageMultipass) +find_package_multipass (PETSc petsc_config_current + STATES DIR ARCH + DEPENDENTS INCLUDES LIBRARIES COMPILER MPIEXEC ${petsc_slaves}) + +# Determine whether the PETSc layout is old-style (through 2.3.3) or +# new-style (>= 3.0.0) +if (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/lib/petsc/conf/petscvariables") # > 3.5 + set (petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules") + set (petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables") +elseif (EXISTS "${PETSC_DIR}/${PETSC_ARCH}/include/petscconf.h") # > 2.3.3 + set (petsc_conf_rules "${PETSC_DIR}/conf/rules") + set (petsc_conf_variables "${PETSC_DIR}/conf/variables") +elseif (EXISTS "${PETSC_DIR}/bmake/${PETSC_ARCH}/petscconf.h") # <= 2.3.3 + set (petsc_conf_rules "${PETSC_DIR}/bmake/common/rules") + set (petsc_conf_variables "${PETSC_DIR}/bmake/common/variables") +elseif (PETSC_DIR) + message (SEND_ERROR "The pair PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} do not specify a valid PETSc installation") +endif () + +if (petsc_conf_rules AND petsc_conf_variables AND NOT petsc_config_current) + petsc_get_version() + + # Put variables into environment since they are needed to get + # configuration (petscvariables) in the PETSc makefile + set (ENV{PETSC_DIR} "${PETSC_DIR}") + set (ENV{PETSC_ARCH} "${PETSC_ARCH}") + + # A temporary makefile to probe the PETSc configuration + set (petsc_config_makefile "${PROJECT_BINARY_DIR}/Makefile.petsc") + file (WRITE "${petsc_config_makefile}" +"## This file was autogenerated by FindPETSc.cmake +# PETSC_DIR = ${PETSC_DIR} +# PETSC_ARCH = ${PETSC_ARCH} +include ${petsc_conf_rules} +include ${petsc_conf_variables} +show : +\t-@echo -n \${\${VARIABLE}} +") + + macro (PETSC_GET_VARIABLE name var) + set (${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) + execute_process (COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} show VARIABLE=${name} + OUTPUT_VARIABLE ${var} + RESULT_VARIABLE petsc_return) + endmacro (PETSC_GET_VARIABLE) + petsc_get_variable (PETSC_LIB_DIR petsc_lib_dir) + petsc_get_variable (PETSC_EXTERNAL_LIB_BASIC petsc_libs_external) + petsc_get_variable (PETSC_CCPPFLAGS petsc_cpp_line) + petsc_get_variable (PETSC_INCLUDE petsc_include) + petsc_get_variable (PCC petsc_cc) + petsc_get_variable (PCC_FLAGS petsc_cc_flags) + petsc_get_variable (MPIEXEC petsc_mpiexec) + # We are done with the temporary Makefile, calling PETSC_GET_VARIABLE after this point is invalid! + file (REMOVE ${petsc_config_makefile}) + + include (ResolveCompilerPaths) + # Extract include paths and libraries from compile command line + resolve_includes (petsc_includes_all "${petsc_cpp_line}") + + #on windows we need to make sure we're linking against the right + #runtime library + if (WIN32) + if (petsc_cc_flags MATCHES "-MT") + set(using_md False) + foreach(flag_var + CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + set(using_md True) + endif(${flag_var} MATCHES "/MD") + endforeach(flag_var) + if(${using_md} MATCHES "True") + message(WARNING "PETSc was built with /MT, but /MD is currently set. + See http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F") + endif(${using_md} MATCHES "True") + endif (petsc_cc_flags MATCHES "-MT") + endif (WIN32) + + include (CorrectWindowsPaths) + convert_cygwin_path(petsc_lib_dir) + message (STATUS "petsc_lib_dir ${petsc_lib_dir}") + + macro (PETSC_FIND_LIBRARY suffix name) + set (PETSC_LIBRARY_${suffix} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # Clear any stale value, if we got here, we need to find it again + if (WIN32) + set (libname lib${name}) #windows expects "libfoo", linux expects "foo" + else (WIN32) + set (libname ${name}) + endif (WIN32) + find_library (PETSC_LIBRARY_${suffix} NAMES ${libname} HINTS ${petsc_lib_dir} NO_DEFAULT_PATH) + set (PETSC_LIBRARIES_${suffix} "${PETSC_LIBRARY_${suffix}}") + mark_as_advanced (PETSC_LIBRARY_${suffix}) + endmacro (PETSC_FIND_LIBRARY suffix name) + + # Look for petscvec first, if it doesn't exist, we must be using single-library + petsc_find_library (VEC petscvec) + if (PETSC_LIBRARY_VEC) + petsc_find_library (SYS "petscsys;petsc") # libpetscsys is called libpetsc prior to 3.1 (when single-library was introduced) + petsc_find_library (MAT petscmat) + petsc_find_library (DM petscdm) + petsc_find_library (KSP petscksp) + petsc_find_library (SNES petscsnes) + petsc_find_library (TS petscts) + macro (PETSC_JOIN libs deps) + list (APPEND PETSC_LIBRARIES_${libs} ${PETSC_LIBRARIES_${deps}}) + endmacro (PETSC_JOIN libs deps) + petsc_join (VEC SYS) + petsc_join (MAT VEC) + petsc_join (DM MAT) + petsc_join (KSP DM) + petsc_join (SNES KSP) + petsc_join (TS SNES) + petsc_join (ALL TS) + else () + set (PETSC_LIBRARY_VEC "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) # There is no libpetscvec + petsc_find_library (SINGLE petsc) #check existence of libpetsc.so + if (NOT PETSC_LIBRARY_SINGLE) + petsc_find_library (SINGLE petsc_real) #check existence of libpetsc_real.so + endif() + if (NOT PETSC_LIBRARY_SINGLE) + petsc_find_library (SINGLE petsc_complex) #check existence of libpetsc_complex.so + endif() + foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) + set (PETSC_LIBRARIES_${pkg} "${PETSC_LIBRARY_SINGLE}") + endforeach () + endif () + if (PETSC_LIBRARY_TS) + message (STATUS "Recognized PETSc install with separate libraries for each package") + else () + message (STATUS "Recognized PETSc install with single library for all packages") + endif () + + include(Check${PETSC_LANGUAGE_BINDINGS}SourceRuns) + macro (PETSC_TEST_RUNS includes libraries runs) + if(${PETSC_LANGUAGE_BINDINGS} STREQUAL "C") + set(_PETSC_ERR_FUNC "CHKERRQ(ierr)") + elseif(${PETSC_LANGUAGE_BINDINGS} STREQUAL "CXX") + set(_PETSC_ERR_FUNC "CHKERRXX(ierr)") + endif() + if (PETSC_VERSION VERSION_GREATER 3.1) + set (_PETSC_TSDestroy "TSDestroy(&ts)") + else () + set (_PETSC_TSDestroy "TSDestroy(ts)") + endif () + + set(_PETSC_TEST_SOURCE " +static const char help[] = \"PETSc test program.\"; +#include +int main(int argc,char *argv[]) { + PetscErrorCode ierr; + TS ts; + + ierr = PetscInitialize(&argc,&argv,0,help);${_PETSC_ERR_FUNC}; + ierr = TSCreate(PETSC_COMM_WORLD,&ts);${_PETSC_ERR_FUNC}; + ierr = TSSetFromOptions(ts);${_PETSC_ERR_FUNC}; + ierr = ${_PETSC_TSDestroy};${_PETSC_ERR_FUNC}; + ierr = PetscFinalize();${_PETSC_ERR_FUNC}; + return 0; +} +") + multipass_source_runs ("${includes}" "${libraries}" "${_PETSC_TEST_SOURCE}" ${runs} "${PETSC_LANGUAGE_BINDINGS}") + if (${${runs}}) + set (PETSC_EXECUTABLE_RUNS "YES" CACHE BOOL + "Can the system successfully run a PETSc executable? This variable can be manually set to \"YES\" to force CMake to accept a given PETSc configuration, but this will almost always result in a broken build. If you change PETSC_DIR, PETSC_ARCH, or PETSC_CURRENT you would have to reset this variable." FORCE) + endif (${${runs}}) + endmacro (PETSC_TEST_RUNS) + + + find_path (PETSC_INCLUDE_DIR petscts.h HINTS "${PETSC_DIR}" PATH_SUFFIXES include NO_DEFAULT_PATH) + find_path (PETSC_INCLUDE_CONF petscconf.h HINTS "${PETSC_DIR}" PATH_SUFFIXES "${PETSC_ARCH}/include" "bmake/${PETSC_ARCH}" NO_DEFAULT_PATH) + mark_as_advanced (PETSC_INCLUDE_DIR PETSC_INCLUDE_CONF) + set (petsc_includes_minimal ${PETSC_INCLUDE_CONF} ${PETSC_INCLUDE_DIR}) + + petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_minimal) + if (petsc_works_minimal) + message (STATUS "Minimal PETSc includes and libraries work. This probably means we are building with shared libs.") + set (petsc_includes_needed "${petsc_includes_minimal}") + else (petsc_works_minimal) # Minimal includes fail, see if just adding full includes fixes it + petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_allincludes) + if (petsc_works_allincludes) # It does, we just need all the includes ( + message (STATUS "PETSc requires extra include paths, but links correctly with only interface libraries. This is an unexpected configuration (but it seems to work fine).") + set (petsc_includes_needed ${petsc_includes_all}) + else (petsc_works_allincludes) # We are going to need to link the external libs explicitly + resolve_libraries (petsc_libraries_external "${petsc_libs_external}") + foreach (pkg SYS VEC MAT DM KSP SNES TS ALL) + list (APPEND PETSC_LIBRARIES_${pkg} ${petsc_libraries_external}) + endforeach (pkg) + petsc_test_runs ("${petsc_includes_minimal}" "${PETSC_LIBRARIES_TS}" petsc_works_alllibraries) + if (petsc_works_alllibraries) + message (STATUS "PETSc only need minimal includes, but requires explicit linking to all dependencies. This is expected when PETSc is built with static libraries.") + set (petsc_includes_needed ${petsc_includes_minimal}) + else (petsc_works_alllibraries) + # It looks like we really need everything, should have listened to Matt + set (petsc_includes_needed ${petsc_includes_all}) + petsc_test_runs ("${petsc_includes_all}" "${PETSC_LIBRARIES_TS}" petsc_works_all) + if (petsc_works_all) # We fail anyways + message (STATUS "PETSc requires extra include paths and explicit linking to all dependencies. This probably means you have static libraries and something unexpected in PETSc headers.") + else (petsc_works_all) # We fail anyways + message (STATUS "PETSc could not be used, maybe the install is broken.") + endif (petsc_works_all) + endif (petsc_works_alllibraries) + endif (petsc_works_allincludes) + endif (petsc_works_minimal) + + # We do an out-of-source build so __FILE__ will be an absolute path, hence __INSDIR__ is superfluous + if (${PETSC_VERSION} VERSION_LESS 3.1) + set (PETSC_DEFINITIONS "-D__SDIR__=\"\"" CACHE STRING "PETSc definitions" FORCE) + else () + set (PETSC_DEFINITIONS "-D__INSDIR__=" CACHE STRING "PETSc definitions" FORCE) + endif () + # Sometimes this can be used to assist FindMPI.cmake + set (PETSC_MPIEXEC ${petsc_mpiexec} CACHE FILEPATH "Executable for running PETSc MPI programs" FORCE) + set (PETSC_INCLUDES ${petsc_includes_needed} CACHE STRING "PETSc include path" FORCE) + set (PETSC_LIBRARIES ${PETSC_LIBRARIES_ALL} CACHE STRING "PETSc libraries" FORCE) + set (PETSC_COMPILER ${petsc_cc} CACHE FILEPATH "PETSc compiler" FORCE) + # Note that we have forced values for all these choices. If you + # change these, you are telling the system to trust you that they + # work. It is likely that you will end up with a broken build. + mark_as_advanced (PETSC_INCLUDES PETSC_LIBRARIES PETSC_COMPILER PETSC_DEFINITIONS PETSC_MPIEXEC PETSC_EXECUTABLE_RUNS) +endif () + +include (FindPackageHandleStandardArgs) +find_package_handle_standard_args (PETSc + "PETSc could not be found. Be sure to set PETSC_DIR and PETSC_ARCH." + PETSC_INCLUDES PETSC_LIBRARIES PETSC_EXECUTABLE_RUNS) diff --git a/cmake_files/FindPYTHON.cmake b/cmake_files/FindPYTHON.cmake new file mode 100755 index 0000000..8139e53 --- /dev/null +++ b/cmake_files/FindPYTHON.cmake @@ -0,0 +1,181 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#[=======================================================================[.rst: +FindPython +---------- + +Find Python interpreter, compiler and development environment (include +directories and libraries). + +Three components are supported: + +* ``Interpreter``: search for Python interpreter. +* ``Compiler``: search for Python compiler. Only offered by IronPython. +* ``Development``: search for development artifacts (include directories and + libraries). + +If no ``COMPONENTS`` is specified, ``Interpreter`` is assumed. + +To ensure consistent versions between components ``Interpreter``, ``Compiler`` +and ``Development``, specify all components at the same time:: + + find_package (Python COMPONENTS Interpreter Development) + +This module looks preferably for version 3 of Python. If not found, version 2 +is searched. +To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and +:module:`FindPython2` modules rather than this one. + +Imported Targets +^^^^^^^^^^^^^^^^ + +This module defines the following :ref:`Imported Targets `: + +``Python::Interpreter`` + Python interpreter. Target defined if component ``Interpreter`` is found. +``Python::Compiler`` + Python compiler. Target defined if component ``Compiler`` is found. +``Python::Python`` + Python library. Target defined if component ``Development`` is found. + +Result Variables +^^^^^^^^^^^^^^^^ + +This module will set the following variables in your project +(see :ref:`Standard Variable Names `): + +``Python_FOUND`` + System has the Python requested components. +``Python_Interpreter_FOUND`` + System has the Python interpreter. +``Python_EXECUTABLE`` + Path to the Python interpreter. +``Python_INTERPRETER_ID`` + A short string unique to the interpreter. Possible values include: + * Python + * ActivePython + * Anaconda + * Canopy + * IronPython +``Python_STDLIB`` + Standard platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``. +``Python_STDARCH`` + Standard platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``. +``Python_SITELIB`` + Third-party platform independent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``. +``Python_SITEARCH`` + Third-party platform dependent installation directory. + + Information returned by + ``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``. +``Python_Compiler_FOUND`` + System has the Python compiler. +``Python_COMPILER`` + Path to the Python compiler. Only offered by IronPython. +``Python_COMPILER_ID`` + A short string unique to the compiler. Possible values include: + * IronPython +``Python_Development_FOUND`` + System has the Python development artifacts. +``Python_INCLUDE_DIRS`` + The Python include directories. +``Python_LIBRARIES`` + The Python libraries. +``Python_LIBRARY_DIRS`` + The Python library directories. +``Python_RUNTIME_LIBRARY_DIRS`` + The Python runtime library directories. +``Python_VERSION`` + Python version. +``Python_VERSION_MAJOR`` + Python major version. +``Python_VERSION_MINOR`` + Python minor version. +``Python_VERSION_PATCH`` + Python patch version. + +Hints +^^^^^ + +``Python_ROOT_DIR`` + Define the root directory of a Python installation. + +``Python_USE_STATIC_LIBS`` + * If not defined, search for shared libraries and static libraries in that + order. + * If set to TRUE, search **only** for static libraries. + * If set to FALSE, search **only** for shared libraries. + +Commands +^^^^^^^^ + +This module defines the command ``Python_add_library`` which have the same +semantic as :command:`add_library` but take care of Python module naming rules +(only applied if library is of type ``MODULE``) and add dependency to target +``Python::Python``:: + + Python_add_library (my_module MODULE src1.cpp) + +If library type is not specified, ``MODULE`` is assumed. +#]=======================================================================] + + +set (_PYTHON_PREFIX Python) + +if (DEFINED Python_FIND_VERSION) + set (_Python_REQUIRED_VERSION_MAJOR ${Python_FIND_VERSION_MAJOR}) + + include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) +else() + # iterate over versions in quiet and NOT required modes to avoid multiple + # "Found" messages and prematurally failure. + set (_Python_QUIETLY ${Python_FIND_QUIETLY}) + set (_Python_REQUIRED ${Python_FIND_REQUIRED}) + set (Python_FIND_QUIETLY TRUE) + set (Python_FIND_REQUIRED FALSE) + + set (_Python_REQUIRED_VERSIONS 3 2) + set (_Python_REQUIRED_VERSION_LAST 2) + + foreach (_Python_REQUIRED_VERSION_MAJOR IN LISTS _Python_REQUIRED_VERSIONS) + set (Python_FIND_VERSION ${_Python_REQUIRED_VERSION_MAJOR}) + include (${CMAKE_CURRENT_LIST_DIR}/FindPython/Support.cmake) + if (Python_FOUND OR + _Python_REQUIRED_VERSION_MAJOR EQUAL _Python_REQUIRED_VERSION_LAST) + break() + endif() + # clean-up some CACHE variables to ensure look-up restart from scratch + foreach (_Python_ITEM IN LISTS _Python_CACHED_VARS) + unset (${_Python_ITEM} CACHE) + endforeach() + endforeach() + + unset (Python_FIND_VERSION) + + set (Python_FIND_QUIETLY ${_Python_QUIETLY}) + set (Python_FIND_REQUIRED ${_Python_REQUIRED}) + if (Python_FIND_REQUIRED OR NOT Python_FIND_QUIETLY) + # call again validation command to get "Found" or error message + find_package_handle_standard_args (Python HANDLE_COMPONENTS + REQUIRED_VARS ${_Python_REQUIRED_VARS} + VERSION_VAR Python_VERSION) + endif() +endif() + +if (COMMAND __Python_add_library) + macro (Python_add_library) + __Python_add_library (Python ${ARGV}) + endmacro() +endif() + +unset (_PYTHON_PREFIX) diff --git a/cmake_files/FindPackageMultipass.cmake b/cmake_files/FindPackageMultipass.cmake new file mode 100755 index 0000000..fa350a9 --- /dev/null +++ b/cmake_files/FindPackageMultipass.cmake @@ -0,0 +1,106 @@ +# PackageMultipass - this module defines two macros +# +# FIND_PACKAGE_MULTIPASS (Name CURRENT +# STATES VAR0 VAR1 ... +# DEPENDENTS DEP0 DEP1 ...) +# +# This function creates a cache entry _CURRENT which +# the user can set to "NO" to trigger a reconfiguration of the package. +# The first time this function is called, the values of +# _VAR0, ... are saved. If _CURRENT +# is false or if any STATE has changed since the last time +# FIND_PACKAGE_MULTIPASS() was called, then CURRENT will be set to "NO", +# otherwise CURRENT will be "YES". IF not CURRENT, then +# _DEP0, ... will be FORCED to NOTFOUND. +# Example: +# find_path (FOO_DIR include/foo.h) +# FIND_PACKAGE_MULTIPASS (Foo foo_current +# STATES DIR +# DEPENDENTS INCLUDES LIBRARIES) +# if (NOT foo_current) +# # Make temporary files, run programs, etc, to determine FOO_INCLUDES and FOO_LIBRARIES +# endif (NOT foo_current) +# +# MULTIPASS_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS LANGUAGE) +# Always runs the given test, use this when you need to re-run tests +# because parent variables have made old cache entries stale. The LANGUAGE +# variable is either C or CXX indicating which compiler the test should +# use. +# MULTIPASS_C_SOURCE_RUNS (Name INCLUDES LIBRARIES SOURCE RUNS) +# DEPRECATED! This is only included for backwards compatability. Use +# the more general MULTIPASS_SOURCE_RUNS instead. +# Always runs the given test, use this when you need to re-run tests +# because parent variables have made old cache entries stale. + +macro (FIND_PACKAGE_MULTIPASS _name _current) + string (TOUPPER ${_name} _NAME) + set (_args ${ARGV}) + list (REMOVE_AT _args 0 1) + + set (_states_current "YES") + list (GET _args 0 _cmd) + if (_cmd STREQUAL "STATES") + list (REMOVE_AT _args 0) + list (GET _args 0 _state) + while (_state AND NOT _state STREQUAL "DEPENDENTS") + # The name of the stored value for the given state + set (_stored_var PACKAGE_MULTIPASS_${_NAME}_${_state}) + if (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") + set (_states_current "NO") + endif (NOT "${${_stored_var}}" STREQUAL "${${_NAME}_${_state}}") + set (${_stored_var} "${${_NAME}_${_state}}" CACHE INTERNAL "Stored state for ${_name}." FORCE) + list (REMOVE_AT _args 0) + list (GET _args 0 _state) + endwhile (_state AND NOT _state STREQUAL "DEPENDENTS") + endif (_cmd STREQUAL "STATES") + + set (_stored ${_NAME}_CURRENT) + if (NOT ${_stored}) + set (${_stored} "YES" CACHE BOOL "Is the configuration for ${_name} current? Set to \"NO\" to reconfigure." FORCE) + set (_states_current "NO") + endif (NOT ${_stored}) + + set (${_current} ${_states_current}) + if (NOT ${_current} AND PACKAGE_MULTIPASS_${_name}_CALLED) + message (STATUS "Clearing ${_name} dependent variables") + # Clear all the dependent variables so that the module can reset them + list (GET _args 0 _cmd) + if (_cmd STREQUAL "DEPENDENTS") + list (REMOVE_AT _args 0) + foreach (dep ${_args}) + set (${_NAME}_${dep} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) + endforeach (dep) + endif (_cmd STREQUAL "DEPENDENTS") + set (${_NAME}_FOUND "NOTFOUND" CACHE INTERNAL "Cleared" FORCE) + endif () + set (PACKAGE_MULTIPASS_${name}_CALLED YES CACHE INTERNAL "Private" FORCE) +endmacro (FIND_PACKAGE_MULTIPASS) + + +macro (MULTIPASS_SOURCE_RUNS includes libraries source runs language) + include (Check${language}SourceRuns) + # This is a ridiculous hack. CHECK_${language}_SOURCE_* thinks that if the + # *name* of the return variable doesn't change, then the test does + # not need to be re-run. We keep an internal count which we + # increment to guarantee that every test name is unique. If we've + # gotten here, then the configuration has changed enough that the + # test *needs* to be rerun. + if (NOT MULTIPASS_TEST_COUNT) + set (MULTIPASS_TEST_COUNT 00) + endif (NOT MULTIPASS_TEST_COUNT) + math (EXPR _tmp "${MULTIPASS_TEST_COUNT} + 1") # Why can't I add to a cache variable? + set (MULTIPASS_TEST_COUNT ${_tmp} CACHE INTERNAL "Unique test ID") + set (testname MULTIPASS_TEST_${MULTIPASS_TEST_COUNT}_${runs}) + set (CMAKE_REQUIRED_INCLUDES ${includes}) + set (CMAKE_REQUIRED_LIBRARIES ${libraries}) + if(${language} STREQUAL "C") + check_c_source_runs ("${source}" ${testname}) + elseif(${language} STREQUAL "CXX") + check_cxx_source_runs ("${source}" ${testname}) + endif() + set (${runs} "${${testname}}") +endmacro (MULTIPASS_SOURCE_RUNS) + +macro (MULTIPASS_C_SOURCE_RUNS includes libraries source runs) + multipass_source_runs("${includes}" "${libraries}" "${source}" ${runs} "C") +endmacro (MULTIPASS_C_SOURCE_RUNS) diff --git a/cmake_files/FindParaView.cmake b/cmake_files/FindParaView.cmake new file mode 100755 index 0000000..c6b786d --- /dev/null +++ b/cmake_files/FindParaView.cmake @@ -0,0 +1,224 @@ +#[==[.md +# paraview-config.cmake + +This file is used by CMake when finding ParaView. + +The following variables are provided by this module: + + * `ParaView_VERSION`: The version of ParaView found. + * `ParaView_PREFIX_PATH`: Install prefix for ParaView. + * `PARAVIEW_USE_QT`: If ParaView's Qt GUI is available. + * `PARAVIEW_USE_MPI`: If ParaView is built with MPI support. + * `PARAVIEW_USE_PYTHON`: If ParaView is built with Python support. + * `PARAVIEW_PYTHONPATH`: Where ParaView's Python modules live under the + install prefix. Unset if Python is not available. + * `PARAVIEW_PLUGIN_SUBDIR`: The subdirectory under the library directory for + plugins. + * `ParaView_CLIENT_XML_FILES`: XML files for client applications to use to + reproduce ParaView's menu items. Only provided if `PARAVIEW_USE_QT` + is set. + * `ParaView_LIBRARIES`: The list of modules specified by `COMPONENTS` and + `OPTIONAL_COMPONENTS`. This may be used in `MODULES` arguments in the API + (e.g., `vtk_module_autoinit`). All modules are also targets and may be + linked to using `target_link_libraries`. +#]==] + +set(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save "${CMAKE_MODULE_PATH}") +list(INSERT CMAKE_MODULE_PATH 0 + "${CMAKE_CURRENT_LIST_DIR}") + +set("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save" "${CMAKE_PREFIX_PATH}") +include("${CMAKE_CURRENT_LIST_DIR}/paraview-prefix.cmake") +set("${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH" + "${_vtk_module_import_prefix}") +unset(_vtk_module_import_prefix) +list(INSERT CMAKE_PREFIX_PATH 0 + "${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}") + +set("${CMAKE_FIND_PACKAGE_NAME}_VERSION" "@PARAVIEW_VERSION_FULL@") + +unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND") + +set(_paraview_use_external_vtk "@PARAVIEW_USE_EXTERNAL_VTK@") +set(_paraview_find_package_args) +if (NOT _paraview_use_external_vtk) + list(APPEND _paraview_find_package_args + PATHS "${CMAKE_CURRENT_LIST_DIR}/vtk" + NO_DEFAULT_PATH) +endif () +if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + list(APPEND _paraview_find_package_args + QUIET) +endif () +find_package(VTK REQUIRED + ${_paraview_find_package_args}) +if (NOT VTK_FOUND) + set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) +endif () +unset(_paraview_find_package_args) +unset(_paraview_use_external_vtk) + +set(PARAVIEW_USE_QT "@PARAVIEW_USE_QT@") +set(PARAVIEW_USE_MPI "@PARAVIEW_USE_MPI@") +set(PARAVIEW_USE_PYTHON "@PARAVIEW_USE_PYTHON@") +set(PARAVIEW_PLUGIN_SUBDIR "paraview@paraview_version_suffix@/plugins") + +if (PARAVIEW_USE_PYTHON) + set(PARAVIEW_PYTHONPATH "@PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX@") + include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPython-targets.cmake") + # Unset this for now; these targets will be defined later. + unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND") + unset("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE") +endif () + +include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-properties.cmake") + +include("${CMAKE_CURRENT_LIST_DIR}/paraview-find-package-helpers.cmake" OPTIONAL) +include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake") + +include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview_plugins-targets-depends.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview-plugin-properties.cmake") + +include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTools-targets.cmake" OPTIONAL) + +include("${CMAKE_CURRENT_LIST_DIR}/ParaViewClient.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPlugin.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/ParaViewServerManager.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTesting.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapClientServer.cmake") + +if (@PARAVIEW_USE_PYTHON@) # PARAVIEW_USE_PYTHON + include("${CMAKE_CURRENT_LIST_DIR}/paraview.modules-vtk-python-module-properties.cmake") +endif () + +if (@PARAVIEW_USE_QT@) # PARAVIEW_USE_QT + include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Client-targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/ParaView-client-xml.cmake") +endif () + +set(_paraview_components_to_check) +foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") + if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND") + # It was already not-found (likely due to `find-package` failures). + elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}") + list(APPEND _paraview_components_to_check + "${_paraview_component}") + else () + set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0) + list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE" + "The ${_paraview_component} component is not available.") + endif () +endforeach () +unset(_paraview_component) + +set(_paraview_vtk_components) + +while (_paraview_components_to_check) + list(GET _paraview_components_to_check 0 _paraview_component) + list(REMOVE_AT _paraview_components_to_check 0) + if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND") + # We've already made a determiniation. + continue () + endif () + + get_property(_paraview_dependencies + TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}" + PROPERTY "INTERFACE_paraview_module_depends") + string(REPLACE "${CMAKE_FIND_PACKAGE_NAME}::" "" _paraview_dependencies "${_paraview_dependencies}") + set(_paraview_all_dependencies_checked TRUE) + foreach (_paraview_dependency IN LISTS _paraview_dependencies) + # Handle VTK module dependencies. + string(FIND "${_paraview_component}" "VTK::" _paraview_vtk_idx) + if (NOT _paraview_vtk_idx EQUAL -1) + unset(_paraview_vtk_idx) + if (NOT TARGET "${_paraview_dependency}") + set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0) + list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE" + "Failed to find the ${_paraview_dependency} module.") + endif () + continue () + endif () + unset(_paraview_vtk_idx) + + if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND") + if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND) + set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0) + list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE" + "Failed to find the ${_paraview_dependency} component.") + endif () + else () + # Check its dependencies. + list(APPEND _paraview_components_to_check + "${_paraview_dependency}") + set(_paraview_all_found FALSE) + endif () + endforeach () + if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND") + if (_paraview_all_dependencies_checked) + set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 1) + else () + list(APPEND _paraview_components_to_check + "${_paraview_component}") + endif () + endif () + unset(_paraview_all_dependencies_checked) + unset(_paraview_dependency) + unset(_paraview_dependencies) +endwhile () +unset(_paraview_component) +unset(_paraview_components_to_check) + +set(_paraview_missing_components) +foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") + if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND AND ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_paraview_component}) + list(APPEND _paraview_missing_components + "${_paraview_component}") + endif () +endforeach () + +if (_paraview_missing_components) + list(REMOVE_DUPLICATES _paraview_missing_components) + list(SORT _paraview_missing_components) + string(REPLACE ";" ", " _paraview_missing_components "${_paraview_missing_components}") + set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) + set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" + "Could not find the ${CMAKE_FIND_PACKAGE_NAME} package with the following required components: ${_paraview_missing_components}.") +endif () +unset(_paraview_missing_components) + +set("${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES") +if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND") + # If nothing went wrong, we've successfully found the package. + set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1) + # Build the `_LIBRARIES` variable. + foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") + list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES" + "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}") + endforeach () + unset(_paraview_component) +endif () + +set(CMAKE_PREFIX_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save}") +unset("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save") + +set(CMAKE_MODULE_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save}") +unset(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save) + +# Compatibility with old code. +if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) + set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-deprecated.cmake") +elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 5.7) + set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-compat.cmake") +else () + set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-error.cmake") +endif () + +# 5.8 renamed these variables, so provide them if 5.8 is not the minimum +# requested. +if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION OR + ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS "5.8") + set(PARAVIEW_BUILD_QT_GUI "${PARAVIEW_USE_QT}") + set(PARAVIEW_ENABLE_PYTHON "${PARAVIEW_USE_PYTHON}") +endif () diff --git a/cmake_files/FindVTK.cmake b/cmake_files/FindVTK.cmake new file mode 100755 index 0000000..ad4990d --- /dev/null +++ b/cmake_files/FindVTK.cmake @@ -0,0 +1,142 @@ +# - Find a VTK installation or build tree. +# The following variables are set if VTK is found. If VTK is not +# found, VTK_FOUND is set to false. +# VTK_FOUND - Set to true when VTK is found. +# VTK_USE_FILE - CMake file to use VTK. +# VTK_MAJOR_VERSION - The VTK major version number. +# VTK_MINOR_VERSION - The VTK minor version number +# (odd non-release). +# VTK_BUILD_VERSION - The VTK patch level +# (meaningless for odd minor). +# VTK_INCLUDE_DIRS - Include directories for VTK +# VTK_LIBRARY_DIRS - Link directories for VTK libraries +# VTK_KITS - List of VTK kits, in CAPS +# (COMMON,IO,) etc. +# VTK_LANGUAGES - List of wrapped languages, in CAPS +# (TCL, PYHTON,) etc. +# The following cache entries must be set by the user to locate VTK: +# VTK_DIR - The directory containing VTKConfig.cmake. +# This is either the root of the build tree, +# or the lib/vtk directory. This is the +# only cache entry. +# The following variables are set for backward compatibility and +# should not be used in new code: +# USE_VTK_FILE - The full path to the UseVTK.cmake file. +# This is provided for backward +# compatibility. Use VTK_USE_FILE +# instead. +# + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distributed this file outside of CMake, substitute the full +# License text for the above reference.) + +# Assume not found. +SET(VTK_FOUND 0) + +# VTK 4.0 did not provide VTKConfig.cmake. +IF("${VTK_FIND_VERSION}" VERSION_LESS 4.1) + SET(_VTK_40_ALLOW 1) + IF(VTK_FIND_VERSION) + SET(_VTK_40_ONLY 1) + ENDIF() +ENDIF() + +# Construct consitent error messages for use below. +SET(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/vtk for an installation.") +IF(_VTK_40_ALLOW) + SET(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION} For VTK 4.0, this is the location of UseVTK.cmake. This is either the root of the build tree or PREFIX/include/vtk for an installation.") +ENDIF() +SET(VTK_DIR_MESSAGE "VTK not found. Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}") + +# Check whether VTK 4.0 has already been found. +IF(_VTK_40_ALLOW AND VTK_DIR) + IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) + SET(VTK_FOUND 1) + INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. + ENDIF() +ENDIF() + +# Use the Config mode of the find_package() command to find VTKConfig. +# If this succeeds (possibly because VTK_DIR is already set), the +# command will have already loaded VTKConfig.cmake and set VTK_FOUND. +IF(NOT _VTK_40_ONLY AND NOT VTK_FOUND) + FIND_PACKAGE(VTK QUIET NO_MODULE) +ENDIF() + +# Special search for VTK 4.0. +IF(_VTK_40_ALLOW AND NOT VTK_DIR) + # Old scripts may set these directories in the CMakeCache.txt file. + # They can tell us where to find VTKConfig.cmake. + SET(VTK_DIR_SEARCH_LEGACY "") + IF(VTK_BINARY_PATH AND USE_BUILT_VTK) + SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH}) + ENDIF(VTK_BINARY_PATH AND USE_BUILT_VTK) + IF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) + SET(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} + ${VTK_INSTALL_PATH}/lib/vtk) + ENDIF(VTK_INSTALL_PATH AND USE_INSTALLED_VTK) + + # Look for UseVTK.cmake in build trees or under /include/vtk. + FIND_PATH(VTK_DIR + NAMES UseVTK.cmake + PATH_SUFFIXES vtk-4.0 vtk + HINTS $ENV{VTK_DIR} + + PATHS + + # Support legacy cache files. + ${VTK_DIR_SEARCH_LEGACY} + + # Read from the CMakeSetup registry entries. It is likely that + # VTK will have been recently built. + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] + [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] + + # Help the user find it if we cannot. + DOC "The ${VTK_DIR_DESCRIPTION}" + ) + + IF(VTK_DIR) + IF(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake) + SET(VTK_FOUND 1) + INCLUDE(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings. + ELSE() + # We found the wrong version. Pretend we did not find it. + SET(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE) + ENDIF() + ENDIF() +ENDIF() + +#----------------------------------------------------------------------------- +IF(VTK_FOUND) + # Set USE_VTK_FILE for backward-compatability. + SET(USE_VTK_FILE ${VTK_USE_FILE}) +ELSE(VTK_FOUND) + # VTK not found, explain to the user how to specify its location. + IF(VTK_FIND_REQUIRED) + MESSAGE(FATAL_ERROR ${VTK_DIR_MESSAGE}) + ELSE(VTK_FIND_REQUIRED) + IF(NOT VTK_FIND_QUIETLY) + MESSAGE(STATUS ${VTK_DIR_MESSAGE}) + ENDIF(NOT VTK_FIND_QUIETLY) + ENDIF(VTK_FIND_REQUIRED) +ENDIF(VTK_FOUND) + diff --git a/cmake_files/FindXDR.cmake b/cmake_files/FindXDR.cmake new file mode 100755 index 0000000..be0d6ac --- /dev/null +++ b/cmake_files/FindXDR.cmake @@ -0,0 +1,49 @@ +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +MESSAGE(STATUS "Check for XDR ...") + +INCLUDE(FindPackageHandleStandardArgs) + +FIND_PATH(XDR_INCLUDE_DIRS rpc/xdr.h PATH_SUFFIXES tirpc) +IF(XDR_INCLUDE_DIRS) + SET(XDR_DEFINITIONS "-DHAS_XDR") +ENDIF(XDR_INCLUDE_DIRS) + +IF(WIN32) + FIND_LIBRARY(XDR_LIBRARIES xdr) # To get the .lib file from XDR + FIND_PATH(XDR_INCLUDE_DIRS2 stdint.h PATH_SUFFIXES src/msvc) # To get the stdint.h from XDR (needed by types.h) + IF(XDR_INCLUDE_DIRS) + IF(XDR_INCLUDE_DIRS2) + LIST(APPEND XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}") + ELSE() + SET(XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}") # Make the detection fail + ENDIF() + ENDIF() + FIND_PACKAGE_HANDLE_STANDARD_ARGS(XDR REQUIRED_VARS XDR_INCLUDE_DIRS XDR_LIBRARIES) +ELSE(WIN32) + FIND_LIBRARY(XDR_LIBRARY NAMES tirpc xdr) + IF(NOT XDR_LIBRARY) + MESSAGE(STATUS "Could not find XDR libraries ...") + ELSE() + MESSAGE(STATUS "Found XDR libraries ${XDR_LIBRARY} ...") + SET(XDR_LIBRARIES ${XDR_LIBRARY}) + ENDIF() + FIND_PACKAGE_HANDLE_STANDARD_ARGS(XDR REQUIRED_VARS XDR_INCLUDE_DIRS) +ENDIF(WIN32) diff --git a/cmake_files/ResolveCompilerPaths.cmake b/cmake_files/ResolveCompilerPaths.cmake new file mode 100755 index 0000000..c4c2717 --- /dev/null +++ b/cmake_files/ResolveCompilerPaths.cmake @@ -0,0 +1,129 @@ +##Copyright (C) jedbrown, johnfettig. +##All rights reserved. +## +##Redistribution and use in source and binary forms, with or without modification, +##are permitted provided that the following conditions are met: +## +##* Redistributions of source code must retain the above copyright notice, this +## list of conditions and the following disclaimer. +## +##* Redistributions in binary form must reproduce the above copyright notice, this +## list of conditions and the following disclaimer in the documentation and/or +## other materials provided with the distribution. +## +##THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +##ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +##WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +##DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +##ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +##(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +##LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +##ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +##(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +##SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# ResolveCompilerPaths - this module defines two macros +# +# RESOLVE_LIBRARIES (XXX_LIBRARIES LINK_LINE) +# This macro is intended to be used by FindXXX.cmake modules. +# It parses a compiler link line and resolves all libraries +# (-lfoo) using the library path contexts (-L/path) in scope. +# The result in XXX_LIBRARIES is the list of fully resolved libs. +# Example: +# +# RESOLVE_LIBRARIES (FOO_LIBRARIES "-L/A -la -L/B -lb -lc -ld") +# +# will be resolved to +# +# FOO_LIBRARIES:STRING="/A/liba.so;/B/libb.so;/A/libc.so;/usr/lib/libd.so" +# +# if the filesystem looks like +# +# /A: liba.so libc.so +# /B: liba.so libb.so +# /usr/lib: liba.so libb.so libc.so libd.so +# +# and /usr/lib is a system directory. +# +# Note: If RESOLVE_LIBRARIES() resolves a link line differently from +# the native linker, there is a bug in this macro (please report it). +# +# RESOLVE_INCLUDES (XXX_INCLUDES INCLUDE_LINE) +# This macro is intended to be used by FindXXX.cmake modules. +# It parses a compile line and resolves all includes +# (-I/path/to/include) to a list of directories. Other flags are ignored. +# Example: +# +# RESOLVE_INCLUDES (FOO_INCLUDES "-I/A -DBAR='\"irrelevant -I/string here\"' -I/B") +# +# will be resolved to +# +# FOO_INCLUDES:STRING="/A;/B" +# +# assuming both directories exist. +# Note: as currently implemented, the -I/string will be picked up mistakenly (cry, cry) +include (CorrectWindowsPaths) + +macro (RESOLVE_LIBRARIES LIBS LINK_LINE) + string (REGEX MATCHALL "((-L|-l|-Wl)([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))" _all_tokens "${LINK_LINE}") + set (_libs_found) + set (_directory_list) + foreach (token ${_all_tokens}) + if (token MATCHES "-L([^\" ]+|\"[^\"]+\")") + # If it's a library path, add it to the list + string (REGEX REPLACE "^-L" "" token ${token}) + string (REGEX REPLACE "//" "/" token ${token}) + convert_cygwin_path(token) + list (APPEND _directory_list ${token}) + elseif (token MATCHES "^(-l([^\" ]+|\"[^\"]+\")|[^\" ]+\\.(a|so|dll|lib))") + # It's a library, resolve the path by looking in the list and then (by default) in system directories + if (WIN32) #windows expects "libfoo", linux expects "foo" + string (REGEX REPLACE "^-l" "lib" token ${token}) + else (WIN32) + string (REGEX REPLACE "^-l" "" token ${token}) + endif (WIN32) + set (_root) + if (token MATCHES "^/") # We have an absolute path + #separate into a path and a library name: + string (REGEX MATCH "[^/]*\\.(a|so|dll|lib)$" libname ${token}) + string (REGEX MATCH ".*[^${libname}$]" libpath ${token}) + convert_cygwin_path(libpath) + set (_directory_list ${_directory_list} ${libpath}) + set (token ${libname}) + endif (token MATCHES "^/") + set (_lib "NOTFOUND" CACHE FILEPATH "Cleared" FORCE) + find_library (_lib ${token} HINTS ${_directory_list} ${_root}) + if (_lib) + string (REPLACE "//" "/" _lib ${_lib}) + list (APPEND _libs_found ${_lib}) + else (_lib) + message (STATUS "Unable to find library ${token}") + endif (_lib) + endif (token MATCHES "-L([^\" ]+|\"[^\"]+\")") + endforeach (token) + set (_lib "NOTFOUND" CACHE INTERNAL "Scratch variable" FORCE) + # only the LAST occurence of each library is required since there should be no circular dependencies + if (_libs_found) + list (REVERSE _libs_found) + list (REMOVE_DUPLICATES _libs_found) + list (REVERSE _libs_found) + endif (_libs_found) + set (${LIBS} "${_libs_found}") +endmacro (RESOLVE_LIBRARIES) + +macro (RESOLVE_INCLUDES INCS COMPILE_LINE) + string (REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" _all_tokens "${COMPILE_LINE}") + set (_incs_found) + foreach (token ${_all_tokens}) + string (REGEX REPLACE "^-I" "" token ${token}) + string (REGEX REPLACE "//" "/" token ${token}) + convert_cygwin_path(token) + if (EXISTS ${token}) + list (APPEND _incs_found ${token}) + else (EXISTS ${token}) + message (STATUS "Include directory ${token} does not exist") + endif (EXISTS ${token}) + endforeach (token) + list (REMOVE_DUPLICATES _incs_found) + set (${INCS} "${_incs_found}") +endmacro (RESOLVE_INCLUDES) diff --git a/env_SOLVERLAB.sh b/env_SOLVERLAB.sh new file mode 100644 index 0000000..79526fe --- /dev/null +++ b/env_SOLVERLAB.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +export CDMATH_INSTALL=@CMAKE_INSTALL_PREFIX@/cdmath +export COREFLOWS_INSTALL=@CMAKE_INSTALL_PREFIX@/coreflows +export PETSC_DIR=@PETSC_INSTALL@ +export PETSC_ARCH=@PETSC_ARCH@ +export PETSC_INCLUDES=@PETSC_INCLUDES_INSTALL@ +export PETSC_LIBRARIES=@PETSC_DIR@/@PETSC_ARCH@/lib +export MEDFILE_ROOT_DIR=@MEDFILE_ROOT_DIR@ +export MEDFILE_INCLUDE_DIRS=@MEDFILE_INCLUDE_DIRS@ +export MEDFILE_LIBRARIES=@MEDFILE_LIBRARIES_INSTALL@ +export MEDCOUPLING_ROOT_DIR=@MEDCOUPLING_ROOT_DIR@ +export MEDCOUPLING_INCLUDE_DIR=@MEDCOUPLING_INCLUDE_DIR@ +export MEDCOUPLING_LIBRARIES=@MEDCOUPLING_LIBRARIES@ +export PV_LIB_DIR=@PV_LIB_DIR@ +export PV_PYTHON_DIR=@PV_PYTHON_DIR@ + +#CDMATH paths +export LD_LIBRARY_PATH=$CDMATH_INSTALL/lib:$MEDCOUPLING_LIBRARIES:$MEDFILE_LIBRARIES:$PETSC_LIBRARIES:${PETSC_DIR}/${PETSC_ARCH}/lib:$PV_LIB_DIR:${LD_LIBRARY_PATH} +export PYTHONPATH=$CDMATH_INSTALL/lib/cdmath:$CDMATH_INSTALL/bin/cdmath:$CDMATH_INSTALL/bin/cdmath/postprocessing:$CDMATH_INSTALL/$PV_PYTHON_DIR:$MEDCOUPLING_LIBRARIES:$MEDFILE_LIBRARIES:$PETSC_LIBRARIES:${PETSC_DIR}/${PETSC_ARCH}/lib:${PYTHONPATH} + +#CoreFlows paths +export CoreFlows=$CoreFlows_INSTALL/bin/Executable/CoreFlowsMainExe +export LD_LIBRARY_PATH=$CoreFlows_INSTALL/lib:$CDMATH_DIR/lib:${PETSC_DIR}/${PETSC_ARCH}/lib:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${LD_LIBRARY_PATH} +export PYTHONPATH=$CoreFlows_INSTALL/lib:$CoreFlows_INSTALL/lib/CoreFlows_Python:$CoreFlows_INSTALL/bin/CoreFlows_Python:$CoreFlows_INSTALL/lib/python2.7/site-packages/salome:$CDMATH_DIR/lib/cdmath:$CDMATH_DIR/bin/cdmath:$CDMATH_DIR/bin/cdmath/postprocessing:${PETSC_DIR}/${PETSC_ARCH}/lib:${MEDCOUPLING_LIBRARIES}:${MEDFILE_C_LIBRARIES}:${PYTHONPATH} +export CoreFlowsGUI=$CoreFlows_INSTALL/bin/salome/CoreFlows_Standalone.py