Do not use ONNX reader if ONNX importer was disabled (#683)
authorIlya Churaev <ilya.churaev@intel.com>
Fri, 29 May 2020 14:46:40 +0000 (17:46 +0300)
committerGitHub <noreply@github.com>
Fri, 29 May 2020 14:46:40 +0000 (17:46 +0300)
inference-engine/src/inference_engine/CMakeLists.txt
inference-engine/src/inference_engine/ie_network_reader.cpp

index ce94bb3..4ae0d56 100644 (file)
@@ -119,6 +119,11 @@ add_library(${TARGET_NAME}_obj OBJECT
 
 target_compile_definitions(${TARGET_NAME}_obj PRIVATE IMPLEMENT_INFERENCE_ENGINE_API)
 
+# TODO: Remove this definitios when readers will be loaded from xml
+if(NGRAPH_ONNX_IMPORT_ENABLE)
+    target_compile_definitions(${TARGET_NAME}_obj PRIVATE ONNX_IMPORT_ENABLE)
+endif()
+
 target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE $<TARGET_PROPERTY:ngraph::ngraph,INTERFACE_INCLUDE_DIRECTORIES>
                                                              $<TARGET_PROPERTY:pugixml,INTERFACE_INCLUDE_DIRECTORIES>)
 
index 9d739b6..eabfb3d 100644 (file)
@@ -103,9 +103,11 @@ void registerReaders() {
     std::lock_guard<std::mutex> lock(readerMutex);
     if (initialized) return;
     // TODO: Read readers info from XML
+#ifdef ONNX_IMPORT_ENABLE
     auto onnxReader = std::make_shared<Reader>("ONNX", std::string("inference_engine_onnx_reader") + std::string(IE_BUILD_POSTFIX));
     readers.emplace("onnx", onnxReader);
     readers.emplace("prototxt", onnxReader);
+#endif
     auto irReader = std::make_shared<Reader>("IR", std::string("inference_engine_ir_reader") + std::string(IE_BUILD_POSTFIX));
     readers.emplace("xml", irReader);
     initialized = true;