Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make stress and time tests build dependent from gflags from samples #5883

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/stress_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
12 changes: 0 additions & 12 deletions tests/stress_tests/memcheck_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions tests/stress_tests/memleaks_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions tests/stress_tests/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 15 additions & 4 deletions tests/time_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 4 additions & 1 deletion tests/time_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 20 additions & 10 deletions tests/time_tests/src/timetests_helper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)