diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index f01739600..f162f330a 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -17,11 +17,28 @@ endif() if (QPL_BUILD_TESTS) add_subdirectory(ref) add_subdirectory(utils) + + # Build third-party google-test library required for tests + # Build it without clang-tidy checks set(TEMP_CMAKE_CXX_CLANG_TIDY ${CMAKE_CXX_CLANG_TIDY}) set(CMAKE_CXX_CLANG_TIDY "") + # Save the main project's current shared/static preference + set(TEMP_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + # Force google-test library to build as STATIC + set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE) + # Disable google-test's internal tests to speed up the build + set(gtest_build_tests OFF CACHE BOOL "Build gtest tests" FORCE) + # Add the subdirectory creating the 'gtest' and 'gtest_main' targets add_subdirectory(third-party/google-test EXCLUDE_FROM_ALL) + # Restore the original shared/static preference for the rest of the project + set(BUILD_SHARED_LIBS ${TEMP_BUILD_SHARED_LIBS} CACHE BOOL "Build shared libraries" FORCE) + # Restore the original clang-tidy preference set(CMAKE_CXX_CLANG_TIDY ${TEMP_CMAKE_CXX_CLANG_TIDY}) + add_subdirectory(tests) + install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/testdata + DESTINATION share/${CMAKE_PROJECT_NAME} + COMPONENT RUNTIME) if (UNIX) # Disable building google-benchmarks tests SET(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) diff --git a/tools/scripts/accel_conf.sh b/tools/scripts/accel_conf.sh index d5fe2fb52..4d4f899f9 100755 --- a/tools/scripts/accel_conf.sh +++ b/tools/scripts/accel_conf.sh @@ -1,3 +1,4 @@ +#!/bin/bash # ========================================================================== # Copyright (C) 2022 Intel Corporation # diff --git a/tools/tests/cross_tests/CMakeLists.txt b/tools/tests/cross_tests/CMakeLists.txt index 8b3b130b0..6d63c391c 100644 --- a/tools/tests/cross_tests/CMakeLists.txt +++ b/tools/tests/cross_tests/CMakeLists.txt @@ -14,6 +14,8 @@ file(GLOB SOURCES *.cpp) add_executable(cross_tests ${SOURCES}) qpl_set_common_target_settings(cross_tests) +set_target_properties(cross_tests PROPERTIES + OUTPUT_NAME qpl-cross-tests) get_target_property(QPL_SOURCE_DIR qpl SOURCE_DIR) @@ -31,3 +33,6 @@ target_link_libraries(cross_tests target_compile_definitions(cross_tests PRIVATE $) target_compile_options(cross_tests PRIVATE $) + +install(TARGETS cross_tests + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/tools/tests/functional/CMakeLists.txt b/tools/tests/functional/CMakeLists.txt index 806a94422..b82509081 100644 --- a/tools/tests/functional/CMakeLists.txt +++ b/tools/tests/functional/CMakeLists.txt @@ -22,6 +22,8 @@ add_executable(tests main.cpp $) qpl_set_common_target_settings(tests) +set_target_properties(tests PROPERTIES + OUTPUT_NAME qpl-func-tests) get_property(LIB_DEPS GLOBAL PROPERTY QPL_LIB_DEPS) @@ -41,6 +43,9 @@ target_compile_definitions(tests target_compile_options(tests PRIVATE $) +install(TARGETS tests + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + # Test groups that run under target: make test # Smoke tests are a group of small number of tests that can run in a few seconds on any HW.