Skip to content

Commit

Permalink
Remove linking libonnx from unit-test
Browse files Browse the repository at this point in the history
  • Loading branch information
t-jankowski committed Feb 11, 2021
1 parent 08ac8d9 commit 4c1afcc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 30 deletions.
3 changes: 0 additions & 3 deletions ngraph/cmake/external_onnx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,3 @@ if(NOT ext_onnx_POPULATED)
else()
onnx_set_target_properties()
endif()

set(ONNX_INCLUDE_DIR ${ext_onnx_SOURCE_DIR})
set(ONNX_PROTO_INCLUDE_DIR ${ext_onnx_BINARY_DIR})
4 changes: 1 addition & 3 deletions ngraph/frontend/onnx_import/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ if(COMMAND ie_faster_build)
)
endif()

target_link_libraries(onnx_importer PRIVATE onnx onnx_proto ${Protobuf_LIBRARIES} ngraph::builder
target_link_libraries(onnx_importer PRIVATE onnx ngraph::builder
PUBLIC ngraph)

set(ONNX_INSTALL_INCLUDE "${NGRAPH_INSTALL_INCLUDE}/ngraph/frontend")
target_include_directories(onnx_importer SYSTEM PUBLIC $<BUILD_INTERFACE:${ONNX_IMPORT_INCLUDE_DIR}>
$<INSTALL_INTERFACE:${ONNX_INSTALL_INCLUDE}>)
target_include_directories(onnx_importer SYSTEM PRIVATE ${NGRAPH_INCLUDE_PATH}
${ONNX_INCLUDE_DIR} ${ONNX_PROTO_INCLUDE_DIR} ${Protobuf_INCLUDE_DIRS})

target_include_directories(onnx_importer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

Expand Down
19 changes: 8 additions & 11 deletions ngraph/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
add_definitions("-DSERIALIZED_ZOO=\"${CMAKE_CURRENT_SOURCE_DIR}/models\"")
set(NGRAPH_ONNX_NAMESPACE ngraph_onnx)

set(ONNX_LIBRARIES onnx onnx_proto)

add_subdirectory(runtime)

if(NOT NGRAPH_UNIT_TEST_ENABLE)
Expand Down Expand Up @@ -375,12 +373,6 @@ if (NGRAPH_ONNX_IMPORT_ENABLE AND NOT NGRAPH_USE_PROTOBUF_LITE)
endif()

foreach(BACKEND_NAME ${ACTIVE_BACKEND_LIST})
if(${BACKEND_NAME} MATCHES ^INTERPRETER$)
set(TEST_LOOPS 100)
else()
set(TEST_LOOPS 2)
endif()

string(TOLOWER ${BACKEND_NAME} BACKEND_DIR)
string(REGEX REPLACE "([a-z0-9]+):(.*)" "\\1" BACKEND_DIR ${BACKEND_DIR})
set(MANIFEST ${CMAKE_CURRENT_SOURCE_DIR}/runtime/${BACKEND_DIR}/unit_test.manifest)
Expand Down Expand Up @@ -422,9 +414,14 @@ target_link_libraries(unit-test PRIVATE ngraph_test_util
# Protobuf-lite does not support parsing files from prototxt format
# Since most of the onnx models are stored in this format it have to be disabled
if (NGRAPH_ONNX_IMPORT_ENABLE AND NOT NGRAPH_USE_PROTOBUF_LITE)
target_include_directories(unit-test
SYSTEM PRIVATE ${ONNX_INCLUDE_DIR} ${ONNX_PROTO_INCLUDE_DIR} ${Protobuf_INCLUDE_DIRS})
target_link_libraries(unit-test PRIVATE ${Protobuf_LIBRARIES} ${ONNX_LIBRARIES})
# It's needed by onnx/onnx_import_library.cpp test and allows to NOT link statically
# to onnx lib, what conflicts with onnx_importer lib false falling onnx_editor tests.
foreach(_lib onnx onnx_proto libprotobuf)
get_target_property(_incl_dirs ${_lib} INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(unit-test PRIVATE ${_incl_dirs})
endforeach()
get_target_property(_cmpl_defs_from_onnx onnx INTERFACE_COMPILE_DEFINITIONS)
target_compile_definitions(unit-test PRIVATE ${_cmpl_defs_from_onnx})

get_target_property(ONNX_IMPORTER_SRC_DIR onnx_importer SOURCE_DIR)
target_include_directories(unit-test PRIVATE ${ONNX_IMPORTER_SRC_DIR}/src)
Expand Down
1 change: 0 additions & 1 deletion ngraph/test/onnx/onnx_import.in.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "onnx_import/onnx.hpp"
#include "onnx_import/onnx_utils.hpp"
#include "default_opset.hpp"
#include "exceptions.hpp"
#include "ngraph/ngraph.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/constant_folding.hpp"
Expand Down
12 changes: 0 additions & 12 deletions ngraph/test/onnx/onnx_import_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
//*****************************************************************************

#include <onnx/onnx_pb.h>
#include "onnx/defs/function.h"
#include "onnx/defs/schema.h"

#include "gtest/gtest.h"
#include "util/test_control.hpp"
Expand All @@ -25,16 +23,6 @@ using namespace ngraph;

static std::string s_manifest = "${MANIFEST}";

NGRAPH_TEST(onnx, get_function_op_with_version)
{
const auto* schema =
ONNX_NAMESPACE::OpSchemaRegistry::Schema("MeanVarianceNormalization", 9, "");
EXPECT_TRUE(schema);
EXPECT_TRUE(schema->HasFunction());
auto func = schema->GetFunction();
EXPECT_EQ(func->name(), "MeanVarianceNormalization");
}

NGRAPH_TEST(onnx, check_ir_version_support)
{
// It appears you've changed the ONNX library version used by nGraph. Please update the value
Expand Down

0 comments on commit 4c1afcc

Please sign in to comment.