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 May 28, 2021
1 parent 3e303f0 commit 0dce91c
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 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,36 @@ 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(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../")

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()


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_LIBRARY_OUTPUT_DIRECTORY}
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 0dce91c

Please sign in to comment.