Debian Codegraph @

CBLAS/testing/CMakeLists.txt

raw
1 #######################################################################
2 # This CMakeLists.txt creates the test programs for the CBLAS routines.
3 #
4 #######################################################################
5
6 macro(add_cblas_test output input target)
7 if(NOT "${input}" STREQUAL "")
8 set(TEST_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/${input}")
9 endif()
10 set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${output}")
11 set(testName "${target}")
12
13 if(DEFINED TEST_INPUT AND EXISTS "${TEST_INPUT}")
14 add_test(NAME CBLAS-${testName} COMMAND "${CMAKE_COMMAND}"
15 -DTEST=$<TARGET_FILE:${target}>
16 -DINPUT=${TEST_INPUT}
17 -DOUTPUT=${TEST_OUTPUT}
18 -DINTDIR=${CMAKE_CFG_INTDIR}
19 -P "${LAPACK_SOURCE_DIR}/TESTING/runtest.cmake")
20 else()
21 add_test(NAME CBLAS-${testName} COMMAND "${CMAKE_COMMAND}"
22 -DTEST=$<TARGET_FILE:${target}>
23 -DOUTPUT=${TEST_OUTPUT}
24 -DINTDIR=${CMAKE_CFG_INTDIR}
25 -P "${LAPACK_SOURCE_DIR}/TESTING/runtest.cmake")
26 endif()
27 endmacro()
28
29
30 # Object files for single precision real
31 set(STESTL1O c_sblas1.c)
32 set(STESTL2O c_sblas2.c c_s2chke.c auxiliary.c c_xerbla.c)
33 set(STESTL3O c_sblas3.c c_s3chke.c auxiliary.c c_xerbla.c)
34
35 # Object files for double precision real
36 set(DTESTL1O c_dblas1.c)
37 set(DTESTL2O c_dblas2.c c_d2chke.c auxiliary.c c_xerbla.c)
38 set(DTESTL3O c_dblas3.c c_d3chke.c auxiliary.c c_xerbla.c)
39
40 # Object files for single precision complex
41 set(CTESTL1O c_cblat1.f c_cblas1.c)
42 set(CTESTL2O c_cblas2.c c_c2chke.c auxiliary.c c_xerbla.c)
43 set(CTESTL3O c_cblas3.c c_c3chke.c auxiliary.c c_xerbla.c)
44
45 # Object files for double precision complex
46 set(ZTESTL1O c_zblas1.c)
47 set(ZTESTL2O c_zblas2.c c_z2chke.c auxiliary.c c_xerbla.c)
48 set(ZTESTL3O c_zblas3.c c_z3chke.c auxiliary.c c_xerbla.c)
49
50
51
52 if(BUILD_SINGLE)
53 add_executable(xscblat1 c_sblat1.f ${STESTL1O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
54 add_executable(xscblat2 c_sblat2.f ${STESTL2O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
55 add_executable(xscblat3 c_sblat3.f ${STESTL3O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
56
57 if(HAS_ATTRIBUTE_WEAK_SUPPORT)
58 target_compile_definitions(xscblat1 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
59 target_compile_definitions(xscblat2 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
60 target_compile_definitions(xscblat3 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
61 endif()
62
63 target_link_libraries(xscblat1 ${CBLASLIB})
64 target_link_libraries(xscblat2 ${CBLASLIB})
65 target_link_libraries(xscblat3 ${CBLASLIB})
66
67 add_cblas_test(stest1.out "" xscblat1)
68 add_cblas_test(stest2.out sin2 xscblat2)
69 add_cblas_test(stest3.out sin3 xscblat3)
70 endif()
71
72 if(BUILD_DOUBLE)
73 add_executable(xdcblat1 c_dblat1.f ${DTESTL1O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
74 add_executable(xdcblat2 c_dblat2.f ${DTESTL2O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
75 add_executable(xdcblat3 c_dblat3.f ${DTESTL3O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
76
77 if(HAS_ATTRIBUTE_WEAK_SUPPORT)
78 target_compile_definitions(xdcblat1 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
79 target_compile_definitions(xdcblat2 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
80 target_compile_definitions(xdcblat3 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
81 endif()
82
83 target_link_libraries(xdcblat1 ${CBLASLIB})
84 target_link_libraries(xdcblat2 ${CBLASLIB})
85 target_link_libraries(xdcblat3 ${CBLASLIB})
86
87 add_cblas_test(dtest1.out "" xdcblat1)
88 add_cblas_test(dtest2.out din2 xdcblat2)
89 add_cblas_test(dtest3.out din3 xdcblat3)
90 endif()
91
92 if(BUILD_COMPLEX)
93 add_executable(xccblat1 c_cblat1.f ${CTESTL1O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
94 add_executable(xccblat2 c_cblat2.f ${CTESTL2O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
95 add_executable(xccblat3 c_cblat3.f ${CTESTL3O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
96
97 if(HAS_ATTRIBUTE_WEAK_SUPPORT)
98 target_compile_definitions(xccblat1 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
99 target_compile_definitions(xccblat2 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
100 target_compile_definitions(xccblat3 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
101 endif()
102
103 target_link_libraries(xccblat1 ${CBLASLIB} ${BLAS_LIBRARIES})
104 target_link_libraries(xccblat2 ${CBLASLIB})
105 target_link_libraries(xccblat3 ${CBLASLIB})
106
107 add_cblas_test(ctest1.out "" xccblat1)
108 add_cblas_test(ctest2.out cin2 xccblat2)
109 add_cblas_test(ctest3.out cin3 xccblat3)
110 endif()
111
112 if(BUILD_COMPLEX16)
113 add_executable(xzcblat1 c_zblat1.f ${ZTESTL1O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
114 add_executable(xzcblat2 c_zblat2.f ${ZTESTL2O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
115 add_executable(xzcblat3 c_zblat3.f ${ZTESTL3O} ${LAPACK_BINARY_DIR}/test_include/cblas_test.h)
116
117 if(HAS_ATTRIBUTE_WEAK_SUPPORT)
118 target_compile_definitions(xzcblat1 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
119 target_compile_definitions(xzcblat2 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
120 target_compile_definitions(xzcblat3 PRIVATE HAS_ATTRIBUTE_WEAK_SUPPORT)
121 endif()
122
123 target_link_libraries(xzcblat1 ${CBLASLIB})
124 target_link_libraries(xzcblat2 ${CBLASLIB})
125 target_link_libraries(xzcblat3 ${CBLASLIB})
126
127 add_cblas_test(ztest1.out "" xzcblat1)
128 add_cblas_test(ztest2.out zin2 xzcblat2)
129 add_cblas_test(ztest3.out zin3 xzcblat3)
130 endif()