diff options
author | Igor S. Gerasimov <i.s.ger@ya.ru> | 2021-09-04 02:35:22 (GMT) |
---|---|---|
committer | Igor S. Gerasimov <i.s.ger@ya.ru> | 2021-10-05 14:41:36 (GMT) |
commit | 972489ae4e22179028b5e3ed8f908100665a368d (patch) | |
tree | f1f14f734c722b04be20c82c35e011e8c8d1df70 /Tests | |
parent | 95219365ff76d9f28eb0c09cf2ad73312a2da11f (diff) | |
download | CMake-972489ae4e22179028b5e3ed8f908100665a368d.zip CMake-972489ae4e22179028b5e3ed8f908100665a368d.tar.gz CMake-972489ae4e22179028b5e3ed8f908100665a368d.tar.bz2 |
Find{BLAS,LAPACK}: Provide testing of BLA_SIZEOF_INTEGER
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindBLAS/Test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/FindBLAS/Test/main.c | 9 | ||||
-rw-r--r-- | Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake | 12 | ||||
-rw-r--r-- | Tests/FindLAPACK/Test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/FindLAPACK/Test/main.c | 9 |
5 files changed, 39 insertions, 3 deletions
diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt index bbe2ddc..14bf19f 100644 --- a/Tests/FindBLAS/Test/CMakeLists.txt +++ b/Tests/FindBLAS/Test/CMakeLists.txt @@ -4,12 +4,18 @@ include(CTest) find_package(BLAS REQUIRED) +if(NOT BLA_SIZEOF_INTEGER) + set(BLA_SIZEOF_INTEGER 4) +endif() + add_executable(test_tgt main.c) target_link_libraries(test_tgt BLAS::BLAS) +target_compile_definitions(test_tgt PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_tgt COMMAND test_tgt) add_executable(test_var main.c) target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES}) +target_compile_definitions(test_var PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_var COMMAND test_var) if((BLA_VENDOR STREQUAL "Intel10_64lp") OR diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c index 8e58559..4fc9fe4 100644 --- a/Tests/FindBLAS/Test/main.c +++ b/Tests/FindBLAS/Test/main.c @@ -1,7 +1,14 @@ #include <assert.h> +#include <stdint.h> #include <string.h> -typedef int blas_int; +#if BLA_SIZEOF_INTEGER == 4 +typedef int32_t blas_int; +#elif BLA_SIZEOF_INTEGER == 8 +typedef int64_t blas_int; +#else +# error BLA_SIZEOF_INTEGER is not declared! +#endif // declare what parts of the blas C-API we need void dswap_(blas_int* N, double* X, blas_int* incX, double* Y, blas_int* incY); diff --git a/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake b/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake index db33404..42fe386 100644 --- a/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake +++ b/Tests/FindBLAS/add_BLAS_LAPACK_tests.cmake @@ -7,10 +7,14 @@ function(add_BLAS_LAPACK_tests var) set(all "") set(compiler "") + set(model "") set(static "") + set(sizeof_int_lp64 4) + set(sizeof_int_ilp64 8) + foreach(variant IN LISTS ${var}) - if(variant MATCHES "^(all|compiler|static)=(.*)$") + if(variant MATCHES "^(all|compiler|model|static)=(.*)$") set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}") continue() elseif(variant MATCHES "^([^=]+)=(.*)$") @@ -21,6 +25,12 @@ function(add_BLAS_LAPACK_tests var) if(variant STREQUAL "All" AND all) list(APPEND variant_options "-DEXPECT_All=${all}") endif() + if(model) + if(NOT variant_name MATCHES "Intel10_64") + string(APPEND variant_name "_${model}") + endif() + list(APPEND variant_options "-DBLA_SIZEOF_INTEGER=${sizeof_int_${model}}") + endif() if(compiler) string(APPEND variant_name "_${compiler}") list(APPEND variant_options "-DCMAKE_C_COMPILER=${compiler}") diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt index 21b1303..f5d5a73 100644 --- a/Tests/FindLAPACK/Test/CMakeLists.txt +++ b/Tests/FindLAPACK/Test/CMakeLists.txt @@ -4,12 +4,18 @@ include(CTest) find_package(LAPACK REQUIRED) +if(NOT BLA_SIZEOF_INTEGER) + set(BLA_SIZEOF_INTEGER 4) +endif() + add_executable(test_tgt main.c) target_link_libraries(test_tgt LAPACK::LAPACK) +target_compile_definitions(test_tgt PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_tgt COMMAND test_tgt) add_executable(test_var main.c) target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES}) +target_compile_definitions(test_var PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER}) add_test(NAME test_var COMMAND test_var) if((BLA_VENDOR STREQUAL "Intel10_64lp") OR diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c index 04eedea..dd33fb3 100644 --- a/Tests/FindLAPACK/Test/main.c +++ b/Tests/FindLAPACK/Test/main.c @@ -1,7 +1,14 @@ #include <assert.h> +#include <stdint.h> #include <string.h> -typedef int blas_int; +#if BLA_SIZEOF_INTEGER == 4 +typedef int32_t blas_int; +#elif BLA_SIZEOF_INTEGER == 8 +typedef int64_t blas_int; +#else +# error BLA_SIZEOF_INTEGER is not declared! +#endif // declare what parts of the lapack C-API we need void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*, |