diff --git a/cmake/AkantuSimulationMacros.cmake b/cmake/AkantuSimulationMacros.cmake index a7384f3cf..2461dfdf5 100644 --- a/cmake/AkantuSimulationMacros.cmake +++ b/cmake/AkantuSimulationMacros.cmake @@ -1,171 +1,170 @@ #=============================================================================== # @file AkantuSimulationMacros.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Jan 18 2016 # @date last modification: Wed Jan 20 2016 # # @brief macros for examples # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu 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 3 of the License, or (at your option) any # later version. # # Akantu 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 Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== if(__AKANTU_SIMULATION_MACROS) return() endif() set(__AKANTU_SIMULATION_MACROS TRUE) #=============================================================================== function(add_akantu_simulation simulation_name) _add_akantu_simulation(${simulation_name} ${ARGN}) endfunction() #=============================================================================== function(_add_akantu_simulation simulation_name) set(multi_variables SCRIPT SOURCES FILES_TO_COPY DEPENDS DIRECTORIES_TO_CREATE COMPILE_OPTIONS USE_PACKAGES ) cmake_parse_arguments(_simulation "" "LIST_FILES" "${multi_variables}" ${ARGN} ) set(_deps_OK TRUE) if(_simulation_USE_PACKAGES) foreach(_pkg ${_simulation_USE_PACKAGES}) package_is_activated(${_pkg} _activated) if(_activated) package_get_include_dir(${_pkg} _inc_dir) list(APPEND _simulation_INCLUDE_DIRS ${_inc_dir}) package_get_libraries(${_pkg} _libraries) list(APPEND _simulation_LIBRARIES ${_libraries}) package_get_compile_flags(${_pkg} CXX _flags) list(APPEND _simulation_COMPILE_FLAGS "${_flags}") else() message("${simulation_name} use ${_pkg} but Akantu " " has been compiled without this package") set(_deps_OK FALSE) endif() endforeach() endif() package_is_activated(CORE_CXX11 _activated) if(_activated) package_get_compile_flags(CORE_CXX11 CXX _flags) list(APPEND _simulation_COMPILE_FLAGS "${_flags}") endif() package_get_compile_flags(BOOST CXX _flags) list(APPEND _simulation_COMPILE_FLAGS "${_flags}") - package_get_include_dir(BOOST _inc_dir) - list(APPEND _simulation_INCLUDE_DIRS ${_inc_dir}) + package_get_include_dir(BOOST _boost_include_dir) string(REPLACE ";" " " _tmp_flags "${_simulation_COMPILE_FLAGS}") string(REGEX REPLACE " +" " " _simulation_COMPILE_FLAGS "${_tmp_flags}") if(_deps_OK) if(_simulation_UNPARSED_ARGUMENTS OR _simulation_SOURCES) add_executable(${simulation_name} ${_simulation_UNPARSED_ARGUMENTS} ${_simulation_SOURCES}) target_link_libraries(${simulation_name} akantu ${_simulation_LIBRARIES}) - target_include_directories(${simulation_name} PRIVATE ${AKANTU_INCLUDE_DIRS} ${_simulation_INCLUDE_DIRS}) + target_include_directories(${simulation_name} PRIVATE ${AKANTU_INCLUDE_DIRS} ${_boost_include_dir} ${_simulation_INCLUDE_DIRS}) if(_simulation_DEPENDS) foreach(_deps ${_simulation_DEPENDS}) get_target_property(_type ${_deps} TYPE) if(_type STREQUAL "SHARED_LIBRARY" OR _type STREQUAL "STATIC_LIBRARY") target_link_libraries(${simulation_name} ${_deps}) else() add_dependencies(${simulation_name} ${_deps}) endif() endforeach() endif() if(_simulation_COMPILE_OPTIONS) set_target_properties(${simulation_name} PROPERTIES COMPILE_DEFINITIONS "${_simulation_COMPILE_OPTIONS}") endif() if(_simulation_COMPILE_FLAGS) set_target_properties(${simulation_name} PROPERTIES COMPILE_FLAGS "${_simulation_COMPILE_FLAGS}") endif() endif() if(_simulation_SCRIPT) file(COPY ${_simulation_SCRIPT} DESTINATION .) endif() # copy the needed files to the build folder if(_simulation_FILES_TO_COPY) file(COPY ${_simulation_FILES_TO_COPY} DESTINATION .) endif() # create the needed folders in the build folder if(_simulation_DIRECTORIES_TO_CREATE) foreach(_dir ${_simulation_DIRECTORIES_TO_CREATE}) if(IS_ABSOLUTE ${dir}) file(MAKE_DIRECTORY ${_dir}) else() file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_dir}) endif() endforeach() endif() endif() if(_simulation_LIST_FILES) set(_simulation_files) foreach(_file ${_simulation_SCRIPT} ${_simulation_SOURCES} ${_simulation_UNPARSED_ARGUMENTS} ${_simulation_FILES_TO_COPY}) list(APPEND _simulation_files ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) endforeach() foreach(_dep ${_simulation_DEPENDS}) get_target_list_of_associated_files(${_dep} _dep_ressources) if(_dep_ressources) list(APPEND _simulation_files "${_dep_ressources}") endif() endforeach() set(${_simulation_LIST_FILES} ${_simulation_files} PARENT_SCOPE) endif() endfunction() diff --git a/cmake/Modules/FindMumps.cmake b/cmake/Modules/FindMumps.cmake index 89b35a6ae..d39ff7f87 100644 --- a/cmake/Modules/FindMumps.cmake +++ b/cmake/Modules/FindMumps.cmake @@ -1,241 +1,246 @@ #=============================================================================== # @file FindMumps.cmake # # @author Nicolas Richart # # @date creation: Fri Oct 24 2014 # @date last modification: Wed Jan 13 2016 # # @brief The find_package file for the Mumps solver # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu 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 3 of the License, or (at your option) any # later version. # # Akantu 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 Akantu. If not, see . # #=============================================================================== set(_MUMPS_COMPONENTS "sequential" "parallel" "double" "float" "complex_double" "complex_float") if(NOT Mumps_FIND_COMPONENTS) set(Mumps_FIND_COMPONENTS "parallel" "double" "float" "complex_double" "complex_float") endif() #=============================================================================== enable_language(Fortran) set(MUMPS_PRECISIONS) foreach(_comp ${Mumps_FIND_COMPONENTS}) if("${_comp}" STREQUAL "sequential") set(MUMPS_PLAT _seq) #default plat on debian based distribution endif() if("${_comp}" STREQUAL "float") list(APPEND MUMPS_PRECISIONS s) endif() if("${_comp}" STREQUAL "double") list(APPEND MUMPS_PRECISIONS d) endif() if("${_comp}" STREQUAL "complex_float") list(APPEND MUMPS_PRECISIONS c) endif() if("${_comp}" STREQUAL "complex_double") list(APPEND MUMPS_PRECISIONS z) endif() endforeach() if(NOT MUMPS_PRECISIONS) set(MUMPS_PRECISIONS s d c z) endif() list(GET MUMPS_PRECISIONS 0 _first_precision) string(TOUPPER "${_first_precision}" _u_first_precision) set(_mumps_test_dir "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}") file(WRITE "${_mumps_test_dir}/mumps_test_code.c" "#include <${_first_precision}mumps_c.h> int main() { ${_u_first_precision}MUMPS_STRUC_C mumps_data; ${_first_precision}mumps_c(&mumps_data); return 0; } ") - find_path(MUMPS_INCLUDE_DIR ${_first_precision}mumps_c.h PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES include ) set(_mumps_required_vars) foreach(_precision ${MUMPS_PRECISIONS}) string(TOUPPER "${_precision}" _u_precision) find_library(MUMPS_LIBRARY_${_u_precision}MUMPS NAMES ${_precision}mumps${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) mark_as_advanced(MUMPS_LIBRARY_${_u_precision}MUMPS) list(APPEND _mumps_required_vars MUMPS_LIBRARY_${_u_precision}MUMPS) list(APPEND MUMPS_LIBRARIES_ALL ${MUMPS_LIBRARY_${_u_precision}MUMPS}) endforeach() #=============================================================================== include(FindPackageHandleStandardArgs) if(CMAKE_VERSION VERSION_GREATER 2.8.12) if(MUMPS_INCLUDE_DIR) file(STRINGS ${MUMPS_INCLUDE_DIR}/dmumps_c.h _versions REGEX "^#define MUMPS_VERSION .*") foreach(_ver ${_versions}) string(REGEX MATCH "MUMPS_VERSION *\"([0-9.]+)\"" _tmp "${_ver}") set(_mumps_VERSION ${CMAKE_MATCH_1}) endforeach() set(MUMPS_VERSION "${_mumps_VERSION}" CACHE INTERNAL "") endif() find_package_handle_standard_args(Mumps REQUIRED_VARS ${_mumps_required_vars} MUMPS_INCLUDE_DIR VERSION_VAR MUMPS_VERSION) else() find_package_handle_standard_args(Mumps DEFAULT_MSG ${_mumps_required_vars} MUMPS_INCLUDE_DIR) endif() #=============================================================================== set(_mumps_dep_symbol_BLAS ${_first_precision}gemm) set(_mumps_dep_symbol_ScaLAPACK numroc) set(_mumps_dep_symbol_MPI mpi_send) set(_mumps_dep_symbol_Scotch scotchfstratinit) set(_mumps_dep_symbol_Scotch_ptscotch scotchfdgraphexit) set(_mumps_dep_symbol_Scotch_esmumps esmumps) set(_mumps_dep_symbol_mumps_common mumps_abort) set(_mumps_dep_symbol_pord SPACE_ordering) set(_mumps_dep_symbol_METIS metis_nodend) set(_mumps_dep_symbol_ParMETIS ParMETIS_V3_NodeND) + # added for fucking macosx that cannot fail at link +set(_mumps_run_dep_symbol_mumps_common mumps_fac_descband) +set(_mumps_run_dep_symbol_MPI mpi_abort) + set(_mumps_dep_link_BLAS BLAS_LIBRARIES) set(_mumps_dep_link_ScaLAPACK SCALAPACK_LIBRARIES) set(_mumps_dep_link_MPI MPI_Fortran_LIBRARIES) set(_mumps_dep_link_Scotch SCOTCH_LIBRARIES) set(_mumps_dep_link_Scotch_ptscotch SCOTCH_LIBRARY_PTSCOTCH) set(_mumps_dep_link_Scotch_esmumps SCOTCH_LIBRARY_ESMUMPS) set(_mumps_dep_link_mumps_common MUMPS_LIBRARY_COMMON) set(_mumps_dep_link_pord MUMPS_LIBRARY_PORD) set(_mumps_dep_link_METIS METIS_LIBRARY) set(_mumps_dep_link_ParMETIS PARMETIS_LIBRARY) set(_mumps_dep_comp_Scotch_ptscotch COMPONENTS ptscotch) set(_mumps_dep_comp_Scotch_ptscotch COMPONENTS esmumps) set(_mumps_potential_dependencies mumps_common pord BLAS ScaLAPACK MPI Scotch Scotch_ptscotch Scotch_esmumps METIS ParMETIS) #=============================================================================== if(MUMPS_LIBRARY_${_u_first_precision}MUMPS MATCHES ".*${_first_precision}mumps.*${CMAKE_STATIC_LIBRARY_SUFFIX}") # Assuming mumps was compiled as a static library set(MUMPS_LIBRARY_TYPE STATIC CACHE INTERNAL "" FORCE) if (CMAKE_Fortran_COMPILER MATCHES ".*gfortran") set(_compiler_specific gfortran) elseif (CMAKE_Fortran_COMPILER MATCHES ".*ifort") set(_compiler_specific ifcore) else() message("Compiler ${CMAKE_Fortran_COMPILER} is not known, you will probably " "have to add semething instead of this message to be able to test mumps " "install") endif() else() set(MUMPS_LIBRARY_TYPE SHARED CACHE INTERNAL "" FORCE) endif() -try_compile(_mumps_compiles "${_mumps_test_dir}" SOURCES "${_mumps_test_dir}/mumps_test_code.c" +try_run(_mumps_run _mumps_compiles "${_mumps_test_dir}" "${_mumps_test_dir}/mumps_test_code.c" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${MUMPS_INCLUDE_DIR}" LINK_LIBRARIES ${MUMPS_LIBRARIES_ALL} ${_compiler_specific} - OUTPUT_VARIABLE _out) + RUN_OUTPUT_VARIABLE _run + COMPILE_OUTPUT_VARIABLE _out) foreach(_pdep ${_mumps_potential_dependencies}) - if(_mumps_compiles) + if(_mumps_compiles AND NOT _mumps_run STREQUAL "FAILED_TO_RUN") break() endif() - - if(_out MATCHES "${_mumps_dep_symbol_${_pdep}}") + + if(_out MATCHES "${_mumps_dep_symbol_${_pdep}}" OR (DEFINED _mumps_run_dep_symbol_${_pdep} AND _run MATCHES "${_mumps_run_dep_symbol_${_pdep}}")) if(_pdep STREQUAL "mumps_common") find_library(MUMPS_LIBRARY_COMMON mumps_common${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) if(NOT TARGET MUMPS::common) add_library(MUMPS::common ${MUMPS_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(MUMPS::common PROPERTIES IMPORTED_LOCATION "${MUMPS_LIBRARY_COMMON}" INTERFACE_INCLUDE_DIRECTORIES "${MUMPS_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C;Fortran") list(APPEND _mumps_interface_link MUMPS::common) elseif(_pdep STREQUAL "pord") find_library(MUMPS_LIBRARY_PORD pord${MUMPS_PREFIX} PATHS "${MUMPS_DIR}" ENV MUMPS_DIR PATH_SUFFIXES lib ) if(NOT TARGET MUMPS::pord) add_library(MUMPS::pord ${MUMPS_LIBRARY_TYPE} IMPORTED GLOBAL) endif() #TODO adapt it for windows and dlls (check FindGSL as an example) set_target_properties(MUMPS::pord PROPERTIES IMPORTED_LOCATION "${MUMPS_LIBRARY_PORD}" INTERFACE_INCLUDE_DIRECTORIES "${MUMPS_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C") list(APPEND _mumps_interface_link MUMPS::pord) elseif(_pdep MATCHES "Scotch") find_package(Scotch REQUIRED ${_mumps_dep_comp_${_pdep}}) list(APPEND _mumps_interface_link ${${_mumps_dep_link_${_pdep}}}) else() find_package(${_pdep} REQUIRED) list(APPEND _mumps_interface_link ${${_mumps_dep_link_${_pdep}}}) endif() list(APPEND MUMPS_LIBRARIES_ALL ${${_mumps_dep_link_${_pdep}}}) - try_compile(_mumps_compiles "${_mumps_test_dir}" SOURCES "${_mumps_test_dir}/mumps_test_code.c" + try_run(_mumps_run _mumps_compiles "${_mumps_test_dir}" "${_mumps_test_dir}/mumps_test_code.c" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${MUMPS_INCLUDE_DIR}" LINK_LIBRARIES ${MUMPS_LIBRARIES_ALL} ${_compiler_specific} - OUTPUT_VARIABLE _out) + RUN_OUTPUT_VARIABLE _run + COMPILE_OUTPUT_VARIABLE _out) endif() endforeach() foreach(_precision ${MUMPS_PRECISIONS}) string(TOUPPER "${_precision}" _u_precision) set(_target MUMPS::${_precision}mumps) if(NOT TARGET ${_target}) add_library(${_target} ${MUMPS_LIBRARY_TYPE} IMPORTED GLOBAL) endif() set_target_properties(${_target} PROPERTIES IMPORTED_LOCATION "${MUMPS_LIBRARY_${_u_precision}MUMPS}" INTERFACE_INCLUDE_DIRECTORIES "${MUMPS_INCLUDE_DIR}" IMPORTED_LINK_INTERFACE_LANGUAGES "C;Fortran" INTERFACE_LINK_LIBRARIES "${_mumps_interface_link}") endforeach() set(MUMPS_LIBRARIES ${MUMPS_LIBRARIES_ALL} CACHE INTERNAL "" FORCE) diff --git a/examples/io/dumper/CMakeLists.txt b/examples/io/dumper/CMakeLists.txt index 03d05c85b..16f1bdeaa 100644 --- a/examples/io/dumper/CMakeLists.txt +++ b/examples/io/dumper/CMakeLists.txt @@ -1,59 +1,61 @@ #=============================================================================== # @file CMakeLists.txt # # @author Fabian Barras # # @date creation: Fri Sep 03 2010 # @date last modification: Wed Jan 20 2016 # # @brief CMakeLists for DumperIOHelper examples # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu 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 3 of the License, or (at your option) any # later version. # # Akantu 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 Akantu. If not, see . # # @section DESCRIPTION # #=============================================================================== add_mesh(swiss_train_mesh swiss_train.geo 2 1) add_library(locomotive_tools locomotive_tools.cc locomotive_tools.hh ) -package_get_include_dir(BOOST _inc_dir) -target_include_directories(locomotive_tools PRIVATE ${AKANTU_INCLUDE_DIRS} ${_inc_dir}) +package_get_include_dir(BOOST _boost_include_dir) + +target_link_libraries(locomotive_tools PRIVATE akantu) +target_include_directories(locomotive_tools PRIVATE ${AKANTU_INCLUDE_DIRS} ${_boost_include_dir}) if(AKANTU_EXTRA_CXX_FLAGS) set_target_properties(locomotive_tools PROPERTIES COMPILE_FLAGS ${AKANTU_EXTRA_CXX_FLAGS}) endif() register_example(dumper_low_level SOURCES dumper_low_level.cc USE_PACKAGES IOHelper DEPENDS swiss_train_mesh locomotive_tools ) register_example(dumpable_interface SOURCES dumpable_interface.cc USE_PACKAGES IOHelper DEPENDS swiss_train_mesh locomotive_tools ) diff --git a/packages/mpi.cmake b/packages/mpi.cmake index cf12e775e..bf575ca91 100644 --- a/packages/mpi.cmake +++ b/packages/mpi.cmake @@ -1,169 +1,169 @@ #=============================================================================== # @file mpi.cmake # # @author Guillaume Anciaux # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Wed Jan 20 2016 # # @brief package description for mpi # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu 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 3 of the License, or (at your option) any # later version. # # Akantu 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 Akantu. If not, see . # #=============================================================================== package_declare(MPI EXTERNAL DESCRIPTION "Add MPI support in akantu" EXTRA_PACKAGE_OPTIONS PREFIX MPI_C MPI DEPENDS scotch) package_declare_sources(MPI synchronizer/mpi_type_wrapper.hh synchronizer/static_communicator_mpi.cc synchronizer/static_communicator_mpi_inline_impl.hh synchronizer/static_communicator_mpi.hh ) function(add_extra_mpi_options) unset(MPI_ID CACHE) package_get_include_dir(MPI _include_dir) foreach(_inc_dir ${_include_dir}) if(EXISTS "${_inc_dir}/mpi.h") if(NOT MPI_ID) file(STRINGS "${_inc_dir}/mpi.h" _mpi_version REGEX "#define MPI_(SUB)?VERSION .*") foreach(_ver ${_mpi_version}) string(REGEX MATCH "MPI_(VERSION|SUBVERSION) *([0-9]+)" _tmp "${_ver}") set(_mpi_${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) endforeach() set(MPI_STD_VERSION "${_mpi_VERSION}.${_mpi_SUBVERSION}" CACHE INTERNAL "") endif() if(NOT MPI_ID) # check if openmpi file(STRINGS "${_inc_dir}/mpi.h" _ompi_version REGEX "#define OMPI_.*_VERSION .*") if(_ompi_version) set(MPI_ID "OpenMPI" CACHE INTERNAL "") foreach(_version ${_ompi_version}) string(REGEX MATCH "OMPI_(.*)_VERSION (.*)" _tmp "${_version}") if(_tmp) set(MPI_VERSION_${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) endif() endforeach() set(MPI_ID_VERSION "${MPI_VERSION_MAJOR}.${MPI_VERSION_MINOR}.${MPI_VERSION_RELEASE}" CACHE INTERNAL "") endif() endif() if(NOT MPI_ID) # check if intelmpi file(STRINGS "${_inc_dir}/mpi.h" _impi_version REGEX "#define I_MPI_VERSION .*") if(_impi_version) set(MPI_ID "IntelMPI" CACHE INTERNAL "") string(REGEX MATCH "I_MPI_VERSION \"(.*)\"" _tmp "${_impi_version}") if(_tmp) set(MPI_ID_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "") endif() endif() endif() if(NOT MPI_ID) # check if mvapich2 file(STRINGS "${_inc_dir}/mpi.h" _mvapich2_version REGEX "#define MVAPICH2_VERSION .*") if(_mvapich2_version) set(MPI_ID "MPVAPICH2" CACHE INTERNAL "") string(REGEX MATCH "MVAPICH2_VERSION \"(.*)\"" _tmp "${_mvapich2_version}") if(_tmp) set(MPI_ID_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "") endif() endif() endif() if(NOT MPI_ID) # check if mpich (mpich as to be checked after all the mpi that derives from it) file(STRINGS "${_inc_dir}/mpi.h" _mpich_version REGEX "#define MPICH_VERSION .*") if(_mpich_version) set(MPI_ID "MPICH" CACHE INTERNAL "") string(REGEX MATCH "I_MPI_VERSION \"(.*)\"" _tmp "${_mpich_version}") if(_tmp) set(MPI_ID_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "") endif() endif() endif() endif() endforeach() if(MPI_ID STREQUAL "IntelMPI" OR MPI_ID STREQUAL "MPICH" OR MPI_ID STREQUAL "MVAPICH2") set(_flags "-DMPICH_IGNORE_CXX_SEEK") elseif(MPI_ID STREQUAL "OpenMPI") set(_flags "-DOMPI_SKIP_MPICXX") package_is_activated(core_cxx11 _act) - if(_act) + if(_act AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set( _flags "${_flags} -Wno-literal-suffix") endif() endif() include(FindPackageMessage) if(MPI_FOUND) find_package_message(MPI "MPI ID: ${MPI_ID} ${MPI_ID_VERSION} (MPI standard ${MPI_STD_VERSION})" "${MPI_STD_VERSION}") endif() set(MPI_EXTRA_COMPILE_FLAGS "${_flags}" CACHE STRING "Extra flags for MPI" FORCE) mark_as_advanced(MPI_EXTRA_COMPILE_FLAGS) #package_get_source_files(MPI _srcs _pub _priv) #list(APPEND _srcs "common/aka_error.cc") #set_property(SOURCE ${_srcs} PROPERTY COMPILE_FLAGS "${_flags}") package_set_compile_flags(MPI CXX ${_flags}) endfunction() package_on_enabled_script(MPI " add_extra_mpi_options() get_cmake_property(_all_vars VARIABLES) foreach(_var \${_all_vars}) if(_var MATCHES \"^MPI_.*\") mark_as_advanced(\${_var}) endif() endforeach() " ) package_declare_documentation(MPI "This is a meta package providing access to MPI." "" "Under Ubuntu (14.04 LTS) the installation can be performed using the commands:" "\\begin{command}" " > sudo apt-get install libopenmpi-dev" "\\end{command}" "" "Under Mac OS X the installation requires the following steps:" "\\begin{command}" " > sudo port install mpich-devel" "\\end{command}" ) package_set_package_system_dependency(MPI deb mpi-default-bin) package_set_package_system_dependency(MPI deb-src mpi-default-dev) diff --git a/packages/mumps.cmake b/packages/mumps.cmake index 229d5ff40..5470c450c 100644 --- a/packages/mumps.cmake +++ b/packages/mumps.cmake @@ -1,112 +1,111 @@ #=============================================================================== # @file mumps.cmake # # @author Nicolas Richart # # @date creation: Mon Nov 21 2011 # @date last modification: Mon Jan 18 2016 # # @brief package description for mumps support # # @section LICENSE # # Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de # Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des # Solides) # # Akantu 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 3 of the License, or (at your option) any # later version. # # Akantu 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 Akantu. If not, see . # #=============================================================================== package_declare(Mumps EXTERNAL DESCRIPTION "Add Mumps support in akantu" SYSTEM ON third-party/cmake/mumps.cmake ) package_declare_sources(Mumps solver/solver_mumps.cc solver/solver_mumps.hh ) - set(_mumps_float_type ${AKANTU_FLOAT_TYPE}) if(AKANTU_FLOAT_TYPE STREQUAL "float" OR AKANTU_FLOAT_TYPE STREQUAL "double") set(_mumps_components ${AKANTU_FLOAT_TYPE}) else() if(DEFINED AKANTU_FLOAT_TYPE) message(FATAL_ERROR "MUMPS doea not support floating point type \"${AKANTU_FLOAT_TYPE}\"") endif() endif() package_get_option_name(parallel _par_option) if(${_par_option}) package_set_find_package_extra_options(Mumps ARGS COMPONENTS "parallel" ${_mumps_components}) package_add_third_party_script_variable(Mumps MUMPS_TYPE "par") package_set_package_system_dependency(Mumps deb libmumps) package_set_package_system_dependency(Mumps deb-src libmumps-dev) else() package_set_find_package_extra_options(Mumps ARGS COMPONENTS "sequential" ${_mumps_components}) package_add_third_party_script_variable(Mumps MUMPS_TYPE "seq") package_set_package_system_dependency(Mumps deb libmumps-seq) package_set_package_system_dependency(Mumps deb-src libmumps-seq-dev) endif() package_use_system(Mumps _use_system) if(NOT _use_system) enable_language(Fortran) set(AKANTU_USE_MUMPS_VERSION "4.10.0" CACHE STRING "Default Mumps version to compile") mark_as_advanced(AKANTU_USE_MUMPS_VERSION) set_property(CACHE AKANTU_USE_MUMPS_VERSION PROPERTY STRINGS "4.9.2" "4.10.0" "5.0.0") package_get_option_name(MPI _mpi_option) if(${_mpi_option}) package_add_dependencies(Mumps ScaLAPACK MPI) endif() package_add_dependencies(Mumps Scotch BLAS) endif() package_declare_documentation(Mumps "This package enables the \\href{http://mumps.enseeiht.fr/}{MUMPS} parallel direct solver for sparce matrices." "This is necessary to solve static or implicit problems." "" "Under Ubuntu (14.04 LTS) the installation can be performed using the commands:" "" "\\begin{command}" " > sudo apt-get install libmumps-seq-dev # for sequential" " > sudo apt-get install libmumps-dev # for parallel" "\\end{command}" "" "Under Mac OS X the installation requires the following steps:" "\\begin{command}" " > sudo port install mumps" "\\end{command}" "" "If you activate the advanced option AKANTU\\_USE\\_THIRD\\_PARTY\\_MUMPS the make system of akantu can automatically compile MUMPS. For this you will have to download MUMPS from \\url{http://mumps.enseeiht.fr/} or \\url{http://graal.ens-lyon.fr/MUMPS} and place it in \\shellcode{/third-party}" ) package_declare_extra_files_to_package(MUMPS PROJECT third-party/MUMPS_4.10.0_make.inc.cmake third-party/MUMPS_5.0.0.patch third-party/MUMPS_4.10.0.patch third-party/MUMPS_4.9.2_make.inc.cmake third-party/cmake/mumps.cmake cmake/Modules/FindMumps.cmake )