Skip to content

Commit

Permalink
Make timetests dependent on IE gflags 3rdparty from samples/
Browse files Browse the repository at this point in the history
  • Loading branch information
vurusovs committed Jun 1, 2021
1 parent 4918533 commit 086f0d3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
10 changes: 2 additions & 8 deletions tests/time_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
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)


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)
endif()
set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../")

add_subdirectory(src)
15 changes: 15 additions & 0 deletions tests/time_tests/src/timetests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
# add dummy `time_tests` target combines all time tests
add_custom_target(time_tests)

if (NOT TARGET IE::inference_engine)
find_package(IEDevScripts REQUIRED
PATHS "${OpenVINO_MAIN_SOURCE_DIR}/cmake/developer_package"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
endif()
find_package(InferenceEngine)
if (NOT InferenceEngine_FOUND)
# 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()

# Build test from every source file.
# Test target name is source file name without extension.
FILE(GLOB tests "*.cpp")
Expand Down
29 changes: 19 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,25 @@ 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 (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)
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)

0 comments on commit 086f0d3

Please sign in to comment.