diff options
-rw-r--r-- | .gitlab/ci/configure_debian10_aarch64_ninja.cmake | 2 | ||||
-rw-r--r-- | .gitlab/ci/configure_debian10_ninja.cmake | 2 | ||||
-rw-r--r-- | .gitlab/ci/configure_fedora33_makefiles.cmake | 2 | ||||
-rw-r--r-- | .gitlab/ci/configure_intelcompiler_common.cmake | 2 | ||||
-rw-r--r-- | Modules/FindBLAS.cmake | 37 | ||||
-rw-r--r-- | Modules/FindLAPACK.cmake | 54 | ||||
-rw-r--r-- | Tests/FindBLAS/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindBLAS/Test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/FindLAPACK/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindLAPACK/Test/CMakeLists.txt | 2 |
10 files changed, 73 insertions, 56 deletions
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake index f665f7d..8fc850c 100644 --- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake +++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake @@ -1,5 +1,6 @@ set(CMake_TEST_FindALSA "ON" CACHE BOOL "") set(CMake_TEST_FindBLAS "All" CACHE STRING "") +set(CMake_TEST_FindBLAS_STATIC "Generic" CACHE STRING "") set(CMake_TEST_FindBoost "ON" CACHE BOOL "") set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") @@ -24,6 +25,7 @@ set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") set(CMake_TEST_FindLAPACK "All" CACHE STRING "") +set(CMake_TEST_FindLAPACK_STATIC "Generic" CACHE STRING "") set(CMake_TEST_FindLibArchive "ON" CACHE BOOL "") set(CMake_TEST_FindLibinput "ON" CACHE BOOL "") set(CMake_TEST_FindLibLZMA "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake index 9de3013..94cf6c1 100644 --- a/.gitlab/ci/configure_debian10_ninja.cmake +++ b/.gitlab/ci/configure_debian10_ninja.cmake @@ -1,5 +1,6 @@ set(CMake_TEST_FindALSA "ON" CACHE BOOL "") set(CMake_TEST_FindBLAS "All" CACHE STRING "") +set(CMake_TEST_FindBLAS_STATIC "Generic" CACHE STRING "") set(CMake_TEST_FindBoost "ON" CACHE BOOL "") set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") @@ -24,6 +25,7 @@ set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") set(CMake_TEST_FindLAPACK "All" CACHE STRING "") +set(CMake_TEST_FindLAPACK_STATIC "Generic" CACHE STRING "") set(CMake_TEST_FindLibArchive "ON" CACHE BOOL "") set(CMake_TEST_FindLibinput "ON" CACHE BOOL "") set(CMake_TEST_FindLibLZMA "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_fedora33_makefiles.cmake b/.gitlab/ci/configure_fedora33_makefiles.cmake index 4143134..7519d95 100644 --- a/.gitlab/ci/configure_fedora33_makefiles.cmake +++ b/.gitlab/ci/configure_fedora33_makefiles.cmake @@ -1,5 +1,6 @@ set(CMake_TEST_FindALSA "ON" CACHE BOOL "") set(CMake_TEST_FindBLAS "All" CACHE STRING "") +set(CMake_TEST_FindBLAS_STATIC "Generic" CACHE STRING "") set(CMake_TEST_FindBoost "ON" CACHE BOOL "") set(CMake_TEST_FindBoost_Python "ON" CACHE BOOL "") set(CMake_TEST_FindBZip2 "ON" CACHE BOOL "") @@ -24,6 +25,7 @@ set(CMake_TEST_FindIntl "ON" CACHE BOOL "") set(CMake_TEST_FindJPEG "ON" CACHE BOOL "") set(CMake_TEST_FindJsonCpp "ON" CACHE BOOL "") set(CMake_TEST_FindLAPACK "All" CACHE STRING "") +set(CMake_TEST_FindLAPACK_STATIC "Generic" CACHE STRING "") set(CMake_TEST_FindLibArchive "ON" CACHE BOOL "") set(CMake_TEST_FindLibinput "ON" CACHE BOOL "") set(CMake_TEST_FindLibLZMA "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_intelcompiler_common.cmake b/.gitlab/ci/configure_intelcompiler_common.cmake index be3d15b..79f657b 100644 --- a/.gitlab/ci/configure_intelcompiler_common.cmake +++ b/.gitlab/ci/configure_intelcompiler_common.cmake @@ -1,4 +1,6 @@ set(CMake_TEST_FindBLAS "Intel10_64lp" CACHE STRING "") +set(CMake_TEST_FindBLAS_STATIC "Intel10_64lp" CACHE STRING "") set(CMake_TEST_FindLAPACK "Intel10_64lp" CACHE STRING "") +set(CMake_TEST_FindLAPACK_STATIC "Intel10_64lp" CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/configure_external_test.cmake") diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index c23e41b..f3a8b74 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -176,10 +176,7 @@ if(CMAKE_Fortran_COMPILER_LOADED) else() include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) endif() -include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -cmake_push_check_state() -set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) if(BLA_PREFER_PKGCONFIG) find_package(PkgConfig) @@ -192,20 +189,6 @@ if(BLA_PREFER_PKGCONFIG) endif() endif() -set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) -if(BLA_STATIC) - if(WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif() -else() - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif() -endif() - # TODO: move this stuff to a separate module function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs) @@ -220,6 +203,19 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib set(_libraries) set(_combined_name) + if(BLA_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + else() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif() + endif() + set(_extaddlibdir "${_addlibdir}") if(WIN32) list(APPEND _extaddlibdir ENV LIB) @@ -261,6 +257,7 @@ function(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlib if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_deps}) + set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY}) if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() @@ -628,8 +625,6 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") endif() set(_threadlibs "${CMAKE_THREAD_LIBS_INIT}") if(BLA_STATIC) - set(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") - set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}") if (CMAKE_C_COMPILER_LOADED) find_package(OpenMP COMPONENTS C) list(PREPEND _threadlibs "${OpenMP_C_LIBRARIES}") @@ -637,8 +632,6 @@ if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") find_package(OpenMP COMPONENTS CXX) list(PREPEND _threadlibs "${OpenMP_CXX_LIBRARIES}") endif() - set(CMAKE_FIND_LIBRARY_SUFFIXES "${_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES}") - unset(_blas_STATIC_CMAKE_FIND_LIBRARY_SUFFIXES) endif() check_blas_libraries( BLAS_LIBRARIES @@ -1086,5 +1079,3 @@ if(NOT BLA_F95) endif() _add_blas_target() -cmake_pop_check_state() -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index d89c40d..ab6214b 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -127,7 +127,6 @@ if(CMAKE_Fortran_COMPILER_LOADED) else() include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake) endif() -include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake) include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) function(_add_lapack_target) @@ -163,31 +162,6 @@ function(_add_lapack_target) endif() endfunction() -macro(_lapack_find_library_setup) - cmake_push_check_state() - set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) - - set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(BLA_STATIC) - if(WIN32) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) - endif() - else() - if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - # for ubuntu's libblas3gf and liblapack3gf packages - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) - endif() - endif() -endmacro() - -macro(_lapack_find_library_teardown) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - unset(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) - cmake_pop_check_state() -endmacro() - # TODO: move this stuff to a separate module function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs _blas) @@ -202,6 +176,19 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl set(_libraries) set(_combined_name) + if(BLA_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + else() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif() + endif() + set(_extaddlibdir "${_addlibdir}") if(WIN32) list(APPEND _extaddlibdir ENV LIB) @@ -243,6 +230,7 @@ function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addl if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_blas} ${_deps}) + set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() @@ -285,8 +273,6 @@ macro(_lapack_find_dependency dep) set(_lapack_quiet_arg) endmacro() -_lapack_find_library_setup() - set(LAPACK_LINKER_FLAGS) set(LAPACK_LIBRARIES) set(LAPACK95_LIBRARIES) @@ -634,17 +620,25 @@ if(NOT LAPACK_NOT_FOUND_MESSAGE) AND (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")) + if(BLA_STATIC) + # We do not know for sure how the LAPACK reference implementation + # is built on this host. Guess typical dependencies. + set(_lapack_generic_deps "-lgfortran;-lm") + else() + set(_lapack_generic_deps "") + endif() check_lapack_libraries( LAPACK_LIBRARIES LAPACK cheev "" "lapack" - "" + "${_lapack_generic_deps}" "" "" "${BLAS_LIBRARIES}" ) + unset(_lapack_generic_deps) endif() endif() @@ -671,5 +665,3 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") endif() _add_lapack_target() - -_lapack_find_library_teardown() diff --git a/Tests/FindBLAS/CMakeLists.txt b/Tests/FindBLAS/CMakeLists.txt index 47ec568..63ef1dd 100644 --- a/Tests/FindBLAS/CMakeLists.txt +++ b/Tests/FindBLAS/CMakeLists.txt @@ -10,3 +10,16 @@ foreach(vendor IN LISTS CMake_TEST_FindBLAS) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endforeach() + +foreach(vendor IN LISTS CMake_TEST_FindBLAS_STATIC) + add_test(NAME FindBLAS.Test_${vendor}_Static COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBLAS/Test" + "${CMake_BINARY_DIR}/Tests/FindBLAS/Test_${vendor}_Static" + ${build_generator_args} + --build-project TestFindBLAS + --build-options ${build_options} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endforeach() diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt index 1bebf8e..98e12d5 100644 --- a/Tests/FindBLAS/Test/CMakeLists.txt +++ b/Tests/FindBLAS/Test/CMakeLists.txt @@ -13,7 +13,7 @@ target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES}) add_test(NAME test_var COMMAND test_var) if(BLA_VENDOR STREQUAL "Intel10_64lp") - if(NOT BLAS_LIBRARIES MATCHES "^[^;]*mkl_intel_lp64") + if(NOT BLAS_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_lp64") message(FATAL_ERROR "BLAS_LIBRARIES does not start in mkl_intel_lp64:\n ${BLAS_LIBRARIES}") endif() endif() diff --git a/Tests/FindLAPACK/CMakeLists.txt b/Tests/FindLAPACK/CMakeLists.txt index 5e2ea7a..eab5bb4 100644 --- a/Tests/FindLAPACK/CMakeLists.txt +++ b/Tests/FindLAPACK/CMakeLists.txt @@ -10,3 +10,16 @@ foreach(vendor IN LISTS CMake_TEST_FindLAPACK) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) endforeach() + +foreach(vendor IN LISTS CMake_TEST_FindLAPACK_STATIC) + add_test(NAME FindLAPACK.Test_${vendor}_Static COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindLAPACK/Test" + "${CMake_BINARY_DIR}/Tests/FindLAPACK/Test_${vendor}_Static" + ${build_generator_args} + --build-project TestFindLAPACK + --build-options ${build_options} -DBLA_VENDOR=${vendor} -DBLA_STATIC=ON + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) +endforeach() diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt index 67fb9bd..bb33482 100644 --- a/Tests/FindLAPACK/Test/CMakeLists.txt +++ b/Tests/FindLAPACK/Test/CMakeLists.txt @@ -13,7 +13,7 @@ target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES}) add_test(NAME test_var COMMAND test_var) if(BLA_VENDOR STREQUAL "Intel10_64lp") - if(NOT LAPACK_LIBRARIES MATCHES "^[^;]*mkl_intel_lp64") + if(NOT LAPACK_LIBRARIES MATCHES "^(-Wl,--start-group;)?[^;]*mkl_intel_lp64") message(FATAL_ERROR "LAPACK_LIBRARIES does not start in mkl_intel_lp64:\n ${LAPACK_LIBRARIES}") endif() endif() |