blob: e1e7293360d5ae181f393e78e66bc8d47e8c1c7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(TARGET_NAME "ie_samples_utils")
file(GLOB_RECURSE SOURCES "*.cpp" "*.hpp" "*.h")
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
set_target_properties(${TARGET_NAME} PROPERTIES FOLDER "src")
target_include_directories(${TARGET_NAME}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
if(TARGET gflags)
set(GFLAGS_TARGET gflags)
else()
if(EXISTS /etc/debian_version)
set(gflags_component nothreads_static)
else()
find_package(gflags QUIET OPTIONAL_COMPONENTS nothreads_static)
if(NOT gflags_FOUND)
set(gflags_component shared)
else()
set(gflags_component nothreads_static)
endif()
endif()
find_package(gflags QUIET OPTIONAL_COMPONENTS ${gflags_component})
if(gflags_FOUND)
if(TARGET ${GFLAGS_TARGET})
# nothing
elseif(TARGET gflags_nothreads-static)
# Debian 9: gflag_component is ignored
set(GFLAGS_TARGET gflags_nothreads-static)
elseif(TARGET gflags-shared)
# gflags shared case for CentOS / RHEL / Fedora
set(GFLAGS_TARGET gflags-shared)
else()
message(FATAL_ERROR "Internal error: failed to find imported target 'gflags' using '${gflags_component}' component")
endif()
message(STATUS "gflags (${gflags_VERSION}) is found at ${gflags_DIR} using '${gflags_component}' component")
endif()
if(NOT gflags_FOUND)
if(EXISTS "$ENV{INTEL_OPENVINO_DIR}/samples/cpp/thirdparty/gflags")
add_subdirectory("$ENV{INTEL_OPENVINO_DIR}/samples/cpp/thirdparty/gflags" "${CMAKE_CURRENT_BINARY_DIR}/gflag")
set(GFLAGS_TARGET gflags_nothreads_static)
else()
message(FATAL_ERROR "Failed to find 'gflags' library using '${gflags_component}' component")
endif()
endif()
endif()
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime ${GFLAGS_TARGET})
if(COMMAND add_clang_format_target)
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
endif()
|