Merge pull request #2792 from atgeirr/backport-of-pr-2774
Backport of pr 2774
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# - Find the GNU Multiprecision library.
|
||||
#
|
||||
# Will define the following imported target for usage:
|
||||
# - GMP::gmp Target for linking/compiling with C library
|
||||
# - GMP::gmpxx Target for linking/compiling with C++ library
|
||||
find_path(GMP_INCLUDE_DIR gmp.h)
|
||||
find_library(GMP_LIBRARY gmp)
|
||||
find_path(GMPXX_INCLUDE_DIR gmpxx.h)
|
||||
find_library(GMPXX_LIBRARY gmpxx)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GMP
|
||||
DEFAULT_MSG
|
||||
GMPXX_LIBRARY GMPXX_INCLUDE_DIR GMP_INCLUDE_DIR GMP_LIBRARY)
|
||||
|
||||
if(GMP_FOUND)
|
||||
if(NOT TARGET GMP::gmp)
|
||||
add_library(GMP::gmp UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(GMP::gmp PROPERTIES
|
||||
IMPORTED_LOCATION ${GMP_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET GMP::gmpxx)
|
||||
add_library(GMP::gmpxx UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(GMP::gmpxx PROPERTIES
|
||||
IMPORTED_LOCATION ${GMPXX_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${GMPXX_INCLUDE_DIR}
|
||||
TARGET_LINK_LIBRARIES GMP::gmp)
|
||||
endif()
|
||||
endif()
|
||||
@@ -70,6 +70,20 @@ if(PTSCOTCH_FOUND)
|
||||
set(PTSCOCH_LINK_FLAGS "${DUNE_MPI_LINK_FLAGS}"
|
||||
CACHE STRING "PT-Scotch link flags")
|
||||
set(HAVE_PTSCOTCH 1)
|
||||
if(NOT TARGET PTScotch::Scotch)
|
||||
add_library(PTScotch::Scotch UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(PTScotch::Scotch PROPERTIES
|
||||
IMPORTED_LOCATION "${SCOTCH_LIBRARY}"
|
||||
INCLUDE_DIRECTORIES "${PTSCOTCH_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${PTSCOTCHERR_LIBRARY}")
|
||||
endif()
|
||||
if(NOT TARGET PTScotch::PTScotch)
|
||||
add_library(PTScotch::PTScotch UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(PTScotch::PTScotch PROPERTIES
|
||||
IMPORTED_LOCATION "${PTSCOTCH_LIBRARY}"
|
||||
INCLUDE_DIRECTORIES "${PTSCOTCH_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "PTScotch::Scotch;${MPI_DUNE_LIBRARIES}")
|
||||
endif()
|
||||
# log result
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Determing location of PT-Scotch succeded:\n"
|
||||
|
||||
@@ -102,6 +102,13 @@ if(PARMETIS_FOUND)
|
||||
"Include directory: ${PARMETIS_INCLUDE_DIRS}\n"
|
||||
"Library directory: ${PARMETIS_LIBRARIES}\n\n")
|
||||
|
||||
if(NOT TARGET ParMETIS::ParMETIS)
|
||||
add_library(ParMETIS::ParMETIS UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(ParMETIS::ParMETIS PROPERTIES
|
||||
IMPORTED_LOCATION ${PARMETIS_LIBRARY}
|
||||
INCLUDE_DIRECTORIES "${PARMETIS_INCLUDE_DIRS}"
|
||||
INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES};${MPI_C_LIBRARIES}")
|
||||
endif()
|
||||
endif(PARMETIS_FOUND)
|
||||
|
||||
mark_as_advanced(PARMETIS_INCLUDE_DIRS PARMETIS_LIBRARIES HAVE_PARMETIS)
|
||||
|
||||
@@ -34,6 +34,11 @@ int main(void){
|
||||
if (QUADMATH_FOUND)
|
||||
set(QUADMATH_LIBRARIES "quadmath")
|
||||
set(HAVE_QUAD "${QUADMATH_FOUND}")
|
||||
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
|
||||
set_target_properties(QuadMath::QuadMath PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES quadmath
|
||||
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
|
||||
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -280,6 +280,32 @@ if (SuiteSparse_LIBRARIES)
|
||||
list (REVERSE SuiteSparse_LIBRARIES)
|
||||
endif (SuiteSparse_LIBRARIES)
|
||||
|
||||
if(SuiteSparse_FOUND)
|
||||
if(NOT TARGET SuiteSparse::SuiteSparse)
|
||||
add_library(SuiteSparse::SuiteSparse INTERFACE IMPORTED GLOBAL)
|
||||
set_property(TARGET SuiteSparse::SuiteSparse PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${SuiteSparse_INCLUDE_DIRS})
|
||||
if(config_LIBRARY)
|
||||
set_property(TARGET SuiteSparse::SuiteSparse PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${config_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
foreach(_module ${SuiteSparse_MODULES})
|
||||
string (TOUPPER ${_module} _MODULE)
|
||||
if(SuiteSparse_${_MODULE}_FOUND)
|
||||
if(NOT TARGET SuiteSparse::${_module})
|
||||
message(STATUS "Creating target SuitSparse::${_module}")
|
||||
add_library(SuiteSparse::${_module} UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(SuiteSparse::${_module} PROPERTIES
|
||||
IMPORTED_LOCATION ${${_MODULE}_LIBRARY}
|
||||
INCLUDE_DIRECTORIES ${${_MODULE}_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES "${config_LIBRARY}")
|
||||
target_link_libraries(SuiteSparse::SuiteSparse
|
||||
INTERFACE SuiteSparse::${_module})
|
||||
endif()
|
||||
endif()
|
||||
endforeach(_module)
|
||||
endif()
|
||||
# print a message to indicate status of this package
|
||||
include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (SuiteSparse
|
||||
|
||||
@@ -180,6 +180,16 @@ if(SUPERLU_FOUND)
|
||||
if (SUPERLU_BLAS_LIBRARY)
|
||||
list(APPEND SUPERLU_LIBRARIES ${SUPERLU_BLAS_LIBRARY})
|
||||
endif()
|
||||
if(NOT TARGET SuperLU::SuperLU)
|
||||
add_library(SuperLU::SuperLU UNKNOWN IMPORTED GLOBAL)
|
||||
set_target_properties(SuperLU::SuperLU PROPERTIES
|
||||
IMPORTED_LOCATION ${SUPERLU_LIBRARY}
|
||||
INCLUDE_DIRECTORIES ${SUPERLU_INCLUDE_DIRS})
|
||||
if(SUPERLU_BLAS_LIBRARY)
|
||||
set_property(TARGET SuperLU::SuperLU PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES ${SUPERLU_BLAS_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cmake_pop_check_state()
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# Poor man's FindTBB that will create the CMake targets
|
||||
# used by DUNE.
|
||||
# If the TBB version is new enough it will ship its own
|
||||
# TBBConfig.cmake and we are good
|
||||
find_package(TBB QUIET CONFIG)
|
||||
|
||||
if(NOT TBB_FOUND)
|
||||
# Fall back to using pkgconfig
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PkgConfigTBB IMPORTED_TARGET GLOBAL tbb QUIET)
|
||||
if(NOT TARGET PkgConfig::PkgConfigTBB)
|
||||
# workaround bug in old FindPkgConfig.cmake which adds
|
||||
# pkgcfg_lib_PkgConfigTBB_atomic-NOTFOUND because it cannot
|
||||
# find the atomic lib of the compiler (not in platforms default
|
||||
# library path. It will therefore not create the target and we
|
||||
# try that manually.
|
||||
string(REPLACE ";pkgcfg_lib_PkgConfigTBB_atomic-NOTFOUND" "" _find_tbb_libs "${PkgConfigTBB_LINK_LIBRARIES}")
|
||||
if(_find_tbb_libs)
|
||||
add_library(PkgConfig::PkgConfigTBB INTERFACE IMPORTED GLOBAL)
|
||||
set_property(TARGET PkgConfig::PkgConfigTBB PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "${_find_tbb_libs}")
|
||||
endif()
|
||||
endif()
|
||||
if(TARGET PkgConfig::PkgConfigTBB)
|
||||
if(NOT TARGET TBB::tbb)
|
||||
message(STATUS "Found TBB library using pkg config")
|
||||
add_library(TBB::tbb ALIAS PkgConfig::PkgConfigTBB)
|
||||
endif()
|
||||
endif()
|
||||
endif(PKG_CONFIG_FOUND)
|
||||
else()
|
||||
message(STATUS "Found TBB library using config mode")
|
||||
endif(NOT TBB_FOUND)
|
||||
@@ -19,7 +19,9 @@ find_opm_package (
|
||||
"BLAS REQUIRED;
|
||||
LAPACK REQUIRED;
|
||||
CxaDemangle;
|
||||
MPI
|
||||
MPI;
|
||||
TBB;
|
||||
GMP
|
||||
"
|
||||
# header to search for
|
||||
"dune/common/fvector.hh"
|
||||
|
||||
@@ -24,7 +24,8 @@ find_opm_package (
|
||||
dune-alugrid;
|
||||
ZLIB;
|
||||
ZOLTAN;
|
||||
METIS
|
||||
METIS;
|
||||
Quadmath
|
||||
"
|
||||
# header to search for
|
||||
"dune/fem/space/shapefunctionset/legendre.hh"
|
||||
|
||||
Reference in New Issue
Block a user