Fixed C samples build on Windows (#14386)

This commit is contained in:
Ilya Lavrenov 2022-12-05 01:33:42 +04:00 committed by GitHub
parent aa4f4429c0
commit 1af95fb3f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 8 deletions

View File

@ -97,9 +97,14 @@ if(NOT DEFINED CMAKE_CXX_STANDARD)
endif() endif()
#################################### ####################################
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils")
# gflags is used only in C++ samples
set(gflags_required ON)
endif()
if(TARGET gflags) if(TARGET gflags)
set(GFLAGS_TARGET gflags) set(GFLAGS_TARGET gflags)
else() elseif(gflags_required)
if(EXISTS /etc/debian_version) if(EXISTS /etc/debian_version)
set(gflags_component nothreads_static) set(gflags_component nothreads_static)
else() else()
@ -223,9 +228,6 @@ macro(ie_add_sample)
target_include_directories(${IE_SAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../common") target_include_directories(${IE_SAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../common")
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${ov_link_libraries} Threads::Threads ${IE_SAMPLE_DEPENDENCIES}) target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${ov_link_libraries} Threads::Threads ${IE_SAMPLE_DEPENDENCIES})
if(NOT c_sample)
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${GFLAGS_TARGET})
endif()
install(TARGETS ${IE_SAMPLE_NAME} install(TARGETS ${IE_SAMPLE_NAME}
RUNTIME DESTINATION samples_bin/ RUNTIME DESTINATION samples_bin/

View File

@ -10,7 +10,7 @@ file (GLOB HDR ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
ie_add_sample(NAME ${TARGET_NAME} ie_add_sample(NAME ${TARGET_NAME}
SOURCES ${SRC} SOURCES ${SRC}
HEADERS ${HDR} HEADERS ${HDR}
DEPENDENCIES format_reader ie_samples_utils) DEPENDENCIES ${GFLAGS_TARGET} format_reader ie_samples_utils)
# Required nlohmann_json dependency # Required nlohmann_json dependency

View File

@ -5,4 +5,4 @@
ie_add_sample(NAME classification_sample_async ie_add_sample(NAME classification_sample_async
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp" SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp"
HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/classification_sample_async.h" HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/classification_sample_async.h"
DEPENDENCIES format_reader ie_samples_utils) DEPENDENCIES ${GFLAGS_TARGET} format_reader ie_samples_utils)

View File

@ -40,4 +40,4 @@ endif()
ie_add_sample(NAME speech_sample ie_add_sample(NAME speech_sample
SOURCES ${SRC} SOURCES ${SRC}
HEADERS ${HDR} HEADERS ${HDR}
DEPENDENCIES cnpy ie_samples_utils) DEPENDENCIES ${GFLAGS_TARGET} cnpy ie_samples_utils)

View File

@ -373,7 +373,6 @@ elseif(APPLE OR WIN32)
PATTERN .lgtm.yml EXCLUDE PATTERN .lgtm.yml EXCLUDE
PATTERN Makefile EXCLUDE PATTERN Makefile EXCLUDE
PATTERN meson.build EXCLUDE PATTERN meson.build EXCLUDE
PATTERN nlohmann_json.natvis EXCLUDE
PATTERN README.md EXCLUDE PATTERN README.md EXCLUDE
PATTERN .reuse EXCLUDE PATTERN .reuse EXCLUDE
PATTERN tests EXCLUDE PATTERN tests EXCLUDE