Only include the tests if BUILD_TESTS is turned on. #240

Open
eezstreet wants to merge 1 commits from eezstreet/separate-tests into master
+8
View File
@@ -24,6 +24,8 @@ else()
add_definitions(-DTKDNN_PATH="${CMAKE_CURRENT_SOURCE_DIR}") add_definitions(-DTKDNN_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
endif() endif()
option(BUILD_TESTS "Whether to build the tests or not." ON)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# CUDA # CUDA
@@ -72,6 +74,7 @@ target_link_libraries(tkDNN ${tkdnn_LIBS})
#add_library(tkDNN_static STATIC ${tkdnn_SRC}) #add_library(tkDNN_static STATIC ${tkdnn_SRC})
#target_link_libraries(tkDNN_static ${tkdnn_LIBS}) #target_link_libraries(tkDNN_static ${tkdnn_LIBS})
if(BUILD_TESTS)
# SMALL NETS # SMALL NETS
add_executable(test_simple tests/simple/test_simple.cpp) add_executable(test_simple tests/simple/test_simple.cpp)
target_link_libraries(test_simple tkDNN) target_link_libraries(test_simple tkDNN)
@@ -128,6 +131,7 @@ target_link_libraries(map_demo tkDNN)
add_executable(demo demo/demo/demo.cpp) add_executable(demo demo/demo/demo.cpp)
target_link_libraries(demo tkDNN) target_link_libraries(demo tkDNN)
endif()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Install # Install
@@ -139,10 +143,14 @@ target_link_libraries(demo tkDNN)
message("install dir:" ${CMAKE_INSTALL_PREFIX}) message("install dir:" ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY include/ DESTINATION include/) install(DIRECTORY include/ DESTINATION include/)
install(TARGETS tkDNN kernels DESTINATION lib) install(TARGETS tkDNN kernels DESTINATION lib)
if(BUILD_TESTS)
install(TARGETS test_simple test_mnist test_mnistRT test_rtinference demo map_demo DESTINATION bin) install(TARGETS test_simple test_mnist test_mnistRT test_rtinference demo map_demo DESTINATION bin)
endif()
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" # source directory install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/" # source directory
DESTINATION "share/tkDNN/cmake/" # target directory DESTINATION "share/tkDNN/cmake/" # target directory
) )
if(BUILD_TESTS)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests/" # source directory install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tests/" # source directory
DESTINATION "share/tkDNN/tests" # target directory DESTINATION "share/tkDNN/tests" # target directory
) )
endif()