Commit 803bd22d authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Merge branch 'feature/cmake-package-properties' into 'master'

Move cmake package description into AddPackageFlags.cmake files

See merge request !947
parents 2091f993 0793933c
Pipeline #34839 failed with stage
in 4 minutes and 25 seconds
# Defines the functions to use BLAS/Lapack
#
# .. cmake_function:: add_dune_blas_lapack_flags
#
# .. cmake_param:: targets
# :positional:
# :single:
# :required:
#
# A list of targets to use BLAS/Lapack with.
#
include_guard(GLOBAL)
set_package_properties("BLAS" PROPERTIES
DESCRIPTION "fast linear algebra routines")
set_package_properties("LAPACK" PROPERTIES
DESCRIPTION "fast linear algebra routines")
# register HAVE_BLAS and HAVE_LAPACK for config.h
set(HAVE_BLAS ${BLAS_FOUND})
set(HAVE_LAPACK ${LAPACK_FOUND})
# register Lapack library as dune package
if(HAVE_LAPACK)
dune_register_package_flags(LIBRARIES "${LAPACK_LIBRARIES}")
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
check_function_exists("dsyev_" LAPACK_NEEDS_UNDERLINE)
cmake_pop_check_state()
elseif(HAVE_BLAS)
dune_register_package_flags(LIBRARIES "${BLAS_LIBRARIES}")
endif()
# add function to link against the BLAS/Lapack library
function(add_dune_blas_lapack_flags _targets)
foreach(_target ${_targets})
if(LAPACK_FOUND)
target_link_libraries(${_target} PUBLIC ${LAPACK_LIBRARIES})
elseif(BLAS_FOUND)
target_link_libraries(${_target} PUBLIC ${BLAS_LIBRARIES})
endif()
endforeach(_target)
endfunction(add_dune_blas_lapack_flags)
# Always link threading libraries to targets
# text for feature summary
set_package_properties("Threads" PROPERTIES
DESCRIPTION "Multi-threading library")
# set HAVE_THREADS for config.h
set(HAVE_THREADS ${Threads_FOUND})
......
......@@ -13,6 +13,12 @@
# A list of targets to use VC with.
#
# text for feature summary
set_package_properties("Vc" PROPERTIES
DESCRIPTION "C++ Vectorization library"
URL "https://github.com/VcDevel/Vc"
PURPOSE "For use of SIMD instructions")
function(add_dune_vc_flags _targets)
if(Vc_FOUND)
foreach(_target ${_targets})
......
......@@ -2,6 +2,7 @@ add_subdirectory(FindPkgConfig)
add_subdirectory(FindPython3)
install(FILES
AddBLASLapackFlags.cmake
AddGMPFlags.cmake
AddMETISFlags.cmake
AddParMETISFlags.cmake
......
......@@ -6,20 +6,7 @@ dune_set_minimal_debug_level()
# search for lapack
find_package(LAPACK)
set(HAVE_LAPACK ${LAPACK_FOUND})
if(${HAVE_LAPACK})
dune_register_package_flags(LIBRARIES "${LAPACK_LIBRARIES}")
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
check_function_exists("dsyev_" LAPACK_NEEDS_UNDERLINE)
cmake_pop_check_state()
endif(${HAVE_LAPACK})
set(HAVE_BLAS ${BLAS_FOUND})
set_package_properties("BLAS" PROPERTIES
DESCRIPTION "fast linear algebra routines")
set_package_properties("LAPACK" PROPERTIES
DESCRIPTION "fast linear algebra routines")
include(AddBLASLapackFlags)
find_package(GMP)
include(AddGMPFlags)
......@@ -34,9 +21,6 @@ include(FindMProtect)
# find the threading library
find_package(Threads)
include(AddThreadsFlags)
# text for feature summary
set_package_properties("Threads" PROPERTIES
DESCRIPTION "Multi-threading library")
# find library for Threading Building Blocks
find_package(TBB)
......@@ -57,11 +41,6 @@ if((CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND
endif()
find_package(Vc ${MINIMUM_VC_VERSION} NO_MODULE)
include(AddVcFlags)
# text for feature summary
set_package_properties("Vc" PROPERTIES
DESCRIPTION "C++ Vectorization library"
URL "https://github.com/VcDevel/Vc"
PURPOSE "For use of SIMD instructions")
# Run the python extension of the Dune cmake build system
include(DunePythonCommonMacros)
......@@ -4,11 +4,6 @@ add_subdirectory("std")
add_subdirectory("test")
#build the library dunecommon
if(LAPACK_FOUND)
set(_additional_libs ${LAPACK_LIBRARIES})
elseif(BLAS_FOUND)
set(_additional_libs ${BLAS_LIBRARIES})
endif(LAPACK_FOUND)
if(HAVE_MPROTECT)
set(debugallocator_src "debugallocator.cc")
......@@ -25,10 +20,11 @@ dune_add_library("dunecommon"
path.cc
simd/test.cc
stdstreams.cc
stdthread.cc
ADD_LIBS "${_additional_libs}")
stdthread.cc)
add_dune_blas_lapack_flags(dunecommon)
add_dune_tbb_flags(dunecommon)
#install headers
install(FILES
alignedallocator.hh
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment