From 91b01002875ea505a28dab221f5ad7c8932b08bb Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sun, 12 Apr 2020 23:36:21 +0300 Subject: [PATCH] Fixed compilation when NN builder is not built --- modules/dnn/CMakeLists.txt | 8 +++++++- modules/dnn/src/op_inf_engine.hpp | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/dnn/CMakeLists.txt b/modules/dnn/CMakeLists.txt index 8b7dd2faea..8b7ab91142 100644 --- a/modules/dnn/CMakeLists.txt +++ b/modules/dnn/CMakeLists.txt @@ -107,7 +107,13 @@ endif() set(dnn_runtime_libs "") if(INF_ENGINE_TARGET) - ocv_option(OPENCV_DNN_IE_NN_BUILDER_2019 "Build with Inference Engine NN Builder API support" ON) # future: NOT HAVE_NGRAPH + set(use_nn_builder OFF) + if(TARGET inference_engine_nn_builder OR # custom imported target + TARGET IE::inference_engine_nn_builder OR # default imported target via InferenceEngineConfig.cmake + INF_ENGINE_RELEASE VERSION_LESS "2020000000") # compatibility with older versions on IE + set(use_nn_builder ON) + endif() + ocv_option(OPENCV_DNN_IE_NN_BUILDER_2019 "Build with Inference Engine NN Builder API support" ${use_nn_builder}) # future: NOT HAVE_NGRAPH if(OPENCV_DNN_IE_NN_BUILDER_2019) message(STATUS "DNN: Enabling Inference Engine NN Builder API support") add_definitions(-DHAVE_DNN_IE_NN_BUILDER_2019=1) diff --git a/modules/dnn/src/op_inf_engine.hpp b/modules/dnn/src/op_inf_engine.hpp index 54bc76941b..59fa920738 100644 --- a/modules/dnn/src/op_inf_engine.hpp +++ b/modules/dnn/src/op_inf_engine.hpp @@ -58,7 +58,9 @@ #include +#ifdef HAVE_DNN_IE_NN_BUILDER_2019 #include +#endif #if defined(__GNUC__) && INF_ENGINE_VER_MAJOR_LT(INF_ENGINE_RELEASE_2020_1) #pragma GCC visibility pop