From ee7c0112d67ee574e1e927a2e8f4ab2152805a56 Mon Sep 17 00:00:00 2001 From: vurusovs Date: Fri, 28 May 2021 13:44:05 +0300 Subject: [PATCH] Make stress tests dependent on IE gflags 3rdparty from samples/ --- tests/stress_tests/CMakeLists.txt | 20 +++++++++++++++++++ .../memcheck_tests/CMakeLists.txt | 12 ----------- .../memleaks_tests/CMakeLists.txt | 12 ----------- tests/stress_tests/unittests/CMakeLists.txt | 12 ----------- tests/time_tests/CMakeLists.txt | 19 +++++++++++++++++- tests/time_tests/src/timetests/CMakeLists.txt | 18 ----------------- .../src/timetests_helper/CMakeLists.txt | 3 ++- 7 files changed, 40 insertions(+), 56 deletions(-) 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 80945844b12446..e4d4beb94473bc 100644 --- a/tests/time_tests/CMakeLists.txt +++ b/tests/time_tests/CMakeLists.txt @@ -5,10 +5,27 @@ cmake_minimum_required(VERSION 3.13) set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the build type") -set (CMAKE_CXX_STANDARD 11) project(time_tests) set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../") +# Search OpenVINO Inference Engine installed +find_package(InferenceEngine) +if (NOT InferenceEngine_FOUND) + # 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/src/timetests/CMakeLists.txt b/tests/time_tests/src/timetests/CMakeLists.txt index 1db75be54df424..eecd9b48e07254 100644 --- a/tests/time_tests/src/timetests/CMakeLists.txt +++ b/tests/time_tests/src/timetests/CMakeLists.txt @@ -5,24 +5,6 @@ # add dummy `time_tests` target combines all time tests add_custom_target(time_tests) -# Search OpenVINO Inference Engine installed -find_package(InferenceEngine) -if (NOT InferenceEngine_FOUND) - # 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() - # Build test from every source file. # Test target name is source file name without extension. FILE(GLOB tests "*.cpp") diff --git a/tests/time_tests/src/timetests_helper/CMakeLists.txt b/tests/time_tests/src/timetests_helper/CMakeLists.txt index 8a9594680e2340..75808ac98e583e 100644 --- a/tests/time_tests/src/timetests_helper/CMakeLists.txt +++ b/tests/time_tests/src/timetests_helper/CMakeLists.txt @@ -9,10 +9,11 @@ add_library(${TARGET_NAME} STATIC ${SRC}) target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/include") set (GFLAGS_IS_SUBPROJECT TRUE) +set (BUILD_TESTING OFF) + set (HAVE_SYS_STAT_H 1) set (HAVE_INTTYPES_H 1) set (INTTYPES_FORMAT C99) -set (BUILD_TESTING OFF) if(EXISTS "${OpenVINO_MAIN_SOURCE_DIR}/inference-engine/samples/thirdparty/gflags") function(add_gflags)