Skip to content

Commit b809f99

Browse files
committed
Add CBLAS test for CMAKE.
1 parent 8fade09 commit b809f99

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${Open
1212
enable_language(ASM)
1313
enable_language(C)
1414

15+
if(MSVC)
16+
set(OpenBLAS_LIBNAME libopenblas)
17+
else()
1518
set(OpenBLAS_LIBNAME openblas)
19+
endif()
1620

1721
#######
1822
if(MSVC)

ctest/CMakeLists.txt

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,46 @@
11
include_directories(${CMAKE_SOURCE_DIR})
22

3+
enable_language(Fortran)
34

4-
#foreach(test_bin ${OpenBLAS_Tests})
5+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DADD${BU} -DCBLAS")
56

6-
#endforeach()
7+
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh
8+
"$1 < $2\n"
9+
)
10+
11+
foreach(float_type ${FLOAT_TYPES})
12+
string(SUBSTRING ${float_type} 0 1 float_char_upper)
13+
string(TOLOWER ${float_char_upper} float_char)
14+
#level1
15+
add_executable(x${float_char}cblat1
16+
c_${float_char}blat1.f
17+
c_${float_char}blas1.c)
18+
target_link_libraries(x${float_char}cblat1 ${OpenBLAS_LIBNAME}_static)
19+
add_test(NAME "x${float_char}cblat1"
20+
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/x${float_char}cblat1")
21+
22+
#level2
23+
add_executable(x${float_char}cblat2
24+
c_${float_char}blat2.f
25+
c_${float_char}blas2.c
26+
c_${float_char}2chke.c
27+
auxiliary.c
28+
c_xerbla.c
29+
constant.c)
30+
target_link_libraries(x${float_char}cblat2 ${OpenBLAS_LIBNAME}_static)
31+
add_test(NAME "x${float_char}cblat2"
32+
COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh" "${CMAKE_CURRENT_BINARY_DIR}/x${float_char}cblat2" "${PROJECT_SOURCE_DIR}/ctest/${float_char}in2")
33+
34+
#level3
35+
add_executable(x${float_char}cblat3
36+
c_${float_char}blat3.f
37+
c_${float_char}blas3.c
38+
c_${float_char}3chke.c
39+
auxiliary.c
40+
c_xerbla.c
41+
constant.c)
42+
target_link_libraries(x${float_char}cblat3 ${OpenBLAS_LIBNAME}_static)
43+
add_test(NAME "x${float_char}cblat3"
44+
COMMAND sh "${CMAKE_CURRENT_BINARY_DIR}/test_cblas_helper.sh" "${CMAKE_CURRENT_BINARY_DIR}/x${float_char}cblat3" "${PROJECT_SOURCE_DIR}/ctest/${float_char}in3")
45+
46+
endforeach()

0 commit comments

Comments
 (0)