Add utest for CMake.

This commit is contained in:
Zhang Xianyi 2016-02-12 05:38:13 +08:00
parent 0e2b92e216
commit 19a6dedfd6
2 changed files with 19 additions and 5 deletions

View File

@ -54,10 +54,6 @@ if (NOT DYNAMIC_ARCH)
list(APPEND BLASDIRS kernel)
endif ()
if (DEFINED UTEST_CHECK)
set(SANITY_CHECK 1)
endif ()
if (DEFINED SANITY_CHECK)
list(APPEND BLASDIRS reference)
endif ()
@ -140,6 +136,9 @@ add_library(${OpenBLAS_LIBNAME} SHARED ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET
include("${CMAKE_SOURCE_DIR}/cmake/export.cmake")
enable_testing()
add_subdirectory(utest)
if(NOT MSVC)
#only build shared library for MSVC
add_library(${OpenBLAS_LIBNAME}_static STATIC ${LA_SOURCES} ${LAPACKE_SOURCES} ${TARGET_OBJS})
@ -152,7 +151,6 @@ target_link_libraries(${OpenBLAS_LIBNAME}_static pthread)
endif()
#build test and ctest
enable_testing()
add_subdirectory(test)
if(NOT NO_CBLAS)
add_subdirectory(ctest)

16
utest/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
include_directories(${CMAKE_SOURCE_DIR})
set(OpenBLAS_utest_src
utest_main.c
test_amax.c
)
set(OpenBLAS_utest_bin openblas_utest)
add_executable(${OpenBLAS_utest_bin} ${OpenBLAS_utest_src})
target_link_libraries(${OpenBLAS_utest_bin} ${OpenBLAS_LIBNAME})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(${OpenBLAS_utest_bin} m)
endif()
add_test(${OpenBLAS_utest_bin} ${CMAKE_CURRENT_BINARY_DIR}/${OpenBLAS_utest_bin})