From dbf8fbf9c69b680c623c225dc444967f39b2f1d4 Mon Sep 17 00:00:00 2001 From: Mikhail Ryzhov Date: Thu, 17 Sep 2020 13:51:23 +0300 Subject: [PATCH] Fixed c samples build (#2278) * Fixed c samples build fixed CVS-38816 - Failure to build samples in C * Fixed issue with gflags --- .../c/samples/common/{ => opencv_c_wraper}/CMakeLists.txt | 0 .../samples/common/{ => opencv_c_wraper}/opencv_c_wraper.cpp | 0 .../c/samples/common/{ => opencv_c_wraper}/opencv_c_wraper.h | 0 inference-engine/samples/CMakeLists.txt | 11 +++++++++-- 4 files changed, 9 insertions(+), 2 deletions(-) rename inference-engine/ie_bridges/c/samples/common/{ => opencv_c_wraper}/CMakeLists.txt (100%) rename inference-engine/ie_bridges/c/samples/common/{ => opencv_c_wraper}/opencv_c_wraper.cpp (100%) rename inference-engine/ie_bridges/c/samples/common/{ => opencv_c_wraper}/opencv_c_wraper.h (100%) diff --git a/inference-engine/ie_bridges/c/samples/common/CMakeLists.txt b/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt similarity index 100% rename from inference-engine/ie_bridges/c/samples/common/CMakeLists.txt rename to inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/CMakeLists.txt diff --git a/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper.cpp b/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/opencv_c_wraper.cpp similarity index 100% rename from inference-engine/ie_bridges/c/samples/common/opencv_c_wraper.cpp rename to inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/opencv_c_wraper.cpp diff --git a/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper.h b/inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/opencv_c_wraper.h similarity index 100% rename from inference-engine/ie_bridges/c/samples/common/opencv_c_wraper.h rename to inference-engine/ie_bridges/c/samples/common/opencv_c_wraper/opencv_c_wraper.h diff --git a/inference-engine/samples/CMakeLists.txt b/inference-engine/samples/CMakeLists.txt index fbfdf3c..398ce69 100644 --- a/inference-engine/samples/CMakeLists.txt +++ b/inference-engine/samples/CMakeLists.txt @@ -145,6 +145,8 @@ endif() # exactly the same OpenCV_DIR path which was used for the InferenceEngine build if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/format_reader") add_subdirectory(common/format_reader) +elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/opencv_c_wraper") + add_subdirectory(common/opencv_c_wraper) endif() # samples build can be switched off during whole IE build @@ -216,6 +218,7 @@ macro(ie_add_sample) set(folder_name cpp_samples) if(IE_SAMPLE_NAME MATCHES ".*_c$") + set(c_sample ON) set(folder_name c_samples) endif() @@ -228,7 +231,11 @@ macro(ie_add_sample) target_include_directories(${IE_SAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../common") target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${OpenCV_LIBRARIES} ${InferenceEngine_LIBRARIES} - ${IE_SAMPLE_DEPENDENCIES} gflags) + ${IE_SAMPLE_DEPENDENCIES}) + + if(NOT c_sample) + target_link_libraries(${IE_SAMPLE_NAME} PRIVATE gflags) + endif() # create global target with all samples / demo apps if(NOT TARGET ie_samples) @@ -237,7 +244,7 @@ macro(ie_add_sample) add_dependencies(ie_samples ${IE_SAMPLE_NAME}) if(COMMAND add_cpplint_target AND NOT IE_SAMPLE_EXCLUDE_CPPLINT) - if(folder_name STREQUAL "c_samples") + if(c_sample) set(custom_filters "-readability/casting") endif() add_cpplint_target(${IE_SAMPLE_NAME}_cpplint FOR_TARGETS ${IE_SAMPLE_NAME} -- 2.7.4