diff --git a/tests/stress_tests/CMakeLists.txt b/tests/stress_tests/CMakeLists.txt index 5a37fd9a7115e9..386971ffbda0dd 100644 --- a/tests/stress_tests/CMakeLists.txt +++ b/tests/stress_tests/CMakeLists.txt @@ -9,11 +9,31 @@ if (CMAKE_BUILD_TYPE STREQUAL "") set(CMAKE_BUILD_TYPE "Release") endif() +set (GFLAGS_IS_SUBPROJECT TRUE) set (HAVE_SYS_STAT_H 1) set (HAVE_INTTYPES_H 1) set (INTTYPES_FORMAT C99) +set (BUILD_TESTING OFF) + find_package(InferenceEngineDeveloperPackage REQUIRED) +set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") + +if(EXISTS "${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags") + function(add_gflags) + if(NOT WIN32) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all") + endif() + set(BUILD_SHARED_LIBS OFF) + add_subdirectory(${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags + ${CMAKE_CURRENT_BINARY_DIR}/gflags_build + EXCLUDE_FROM_ALL) + set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty) + endfunction() + add_gflags() +endif() + add_subdirectory(unittests) add_subdirectory(memleaks_tests) add_subdirectory(memcheck_tests) diff --git a/tests/stress_tests/memcheck_tests/CMakeLists.txt b/tests/stress_tests/memcheck_tests/CMakeLists.txt index 635797c58e752e..726fa50a037172 100644 --- a/tests/stress_tests/memcheck_tests/CMakeLists.txt +++ b/tests/stress_tests/memcheck_tests/CMakeLists.txt @@ -19,18 +19,6 @@ file (GLOB HDR # Create library file from sources. add_executable(${TARGET_NAME} ${HDR} ${SRC}) -include(FetchContent) -FetchContent_Declare( - gflags - GIT_REPOSITORY "https://github.com/gflags/gflags.git" - GIT_TAG "v2.2.2" -) -FetchContent_GetProperties(gflags) -if(NOT gflags_POPULATED) - FetchContent_Populate(gflags) - add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR}) -endif() - target_link_libraries(${TARGET_NAME} IE::gtest IE::gtest_main diff --git a/tests/stress_tests/memleaks_tests/CMakeLists.txt b/tests/stress_tests/memleaks_tests/CMakeLists.txt index c24e43433d2bff..b5eecf0547aeb7 100644 --- a/tests/stress_tests/memleaks_tests/CMakeLists.txt +++ b/tests/stress_tests/memleaks_tests/CMakeLists.txt @@ -20,18 +20,6 @@ file (GLOB HDR # Create library file from sources. add_executable(${TARGET_NAME} ${HDR} ${SRC}) -include(FetchContent) -FetchContent_Declare( - gflags - GIT_REPOSITORY "https://github.com/gflags/gflags.git" - GIT_TAG "v2.2.2" -) -FetchContent_GetProperties(gflags) -if(NOT gflags_POPULATED) - FetchContent_Populate(gflags) - add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR}) -endif() - target_link_libraries(${TARGET_NAME} IE::gtest IE::gtest_main diff --git a/tests/stress_tests/unittests/CMakeLists.txt b/tests/stress_tests/unittests/CMakeLists.txt index fea767898f7bf7..e67191a9ed61ec 100644 --- a/tests/stress_tests/unittests/CMakeLists.txt +++ b/tests/stress_tests/unittests/CMakeLists.txt @@ -20,18 +20,6 @@ file (GLOB HDR # Create library file from sources. add_executable(${TARGET_NAME} ${HDR} ${SRC}) -include(FetchContent) -FetchContent_Declare( - gflags - GIT_REPOSITORY "https://github.com/gflags/gflags.git" - GIT_TAG "v2.2.2" -) -FetchContent_GetProperties(gflags) -if(NOT gflags_POPULATED) - FetchContent_Populate(gflags) - add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR}) -endif() - target_link_libraries(${TARGET_NAME} IE::gtest IE::gtest_main diff --git a/tests/time_tests/CMakeLists.txt b/tests/time_tests/CMakeLists.txt index ea36239c8aed2d..e4d4beb94473bc 100644 --- a/tests/time_tests/CMakeLists.txt +++ b/tests/time_tests/CMakeLists.txt @@ -8,13 +8,24 @@ set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the build type") project(time_tests) +set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") +# Search OpenVINO Inference Engine installed find_package(InferenceEngine) if (NOT InferenceEngine_FOUND) - set (HAVE_SYS_STAT_H 1) - set (HAVE_INTTYPES_H 1) - set (INTTYPES_FORMAT C99) - find_package(InferenceEngineDeveloperPackage REQUIRED) + # Search OpenVINO Inference Engine via InferenceEngine_DIR + find_package(IEDevScripts + PATHS "${OpenVINO_MAIN_SOURCE_DIR}/cmake/developer_package" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + if (NOT InferenceEngine_FOUND) + # Search OpenVINO Inference Engine via InferenceEngineDeveloperPackage_DIR + # in order to provide backward compatibility with old OpenVINO packages + set (HAVE_SYS_STAT_H 1) + set (HAVE_INTTYPES_H 1) + set (INTTYPES_FORMAT C99) + find_package(InferenceEngineDeveloperPackage REQUIRED) + endif() endif() add_subdirectory(src) diff --git a/tests/time_tests/README.md b/tests/time_tests/README.md index ea59cd9fa7b761..b8c7d77509aaed 100644 --- a/tests/time_tests/README.md +++ b/tests/time_tests/README.md @@ -22,11 +22,14 @@ cmake .. && make time_tests If you don't have OpenVINO™ installed you need to have the `build` folder, which is created when you configure and build OpenVINO™ from sources: +``` bash +cmake .. -DInferenceEngine_DIR=$(realpath ../../../build) && make time_tests +``` +For old versions of OpenVINO™ from sources use `-DInferenceEngineDeveloperPackage_DIR`: ``` bash cmake .. -DInferenceEngineDeveloperPackage_DIR=$(realpath ../../../build) && make time_tests ``` - 2. Run test: ``` bash ./scripts/run_timetest.py ../../bin/intel64/Release/timetest_infer -m model.xml -d CPU diff --git a/tests/time_tests/src/timetests_helper/CMakeLists.txt b/tests/time_tests/src/timetests_helper/CMakeLists.txt index 0e474ce1a335a2..75808ac98e583e 100644 --- a/tests/time_tests/src/timetests_helper/CMakeLists.txt +++ b/tests/time_tests/src/timetests_helper/CMakeLists.txt @@ -8,16 +8,26 @@ file (GLOB SRC *.cpp) add_library(${TARGET_NAME} STATIC ${SRC}) target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/include") -include(FetchContent) -FetchContent_Declare( - gflags - GIT_REPOSITORY "https://github.com/gflags/gflags.git" - GIT_TAG "v2.2.2" -) -FetchContent_GetProperties(gflags) -if(NOT gflags_POPULATED) - FetchContent_Populate(gflags) - add_subdirectory(${gflags_SOURCE_DIR} ${gflags_BINARY_DIR}) +set (GFLAGS_IS_SUBPROJECT TRUE) +set (BUILD_TESTING OFF) + +set (HAVE_SYS_STAT_H 1) +set (HAVE_INTTYPES_H 1) +set (INTTYPES_FORMAT C99) + +if(EXISTS "${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags") + function(add_gflags) + if(NOT WIN32) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-all") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-all") + endif() + set(BUILD_SHARED_LIBS OFF) + add_subdirectory(${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags + ${CMAKE_CURRENT_BINARY_DIR}/gflags_build + EXCLUDE_FROM_ALL) + set_target_properties(gflags_nothreads_static PROPERTIES FOLDER thirdparty) + endfunction() + add_gflags() endif() target_link_libraries(${TARGET_NAME} gflags)