Static protobuf for FEs (#6588)
* protobuf static + mixed editor and importer * merged onnx common * remove ngraph_test_util to onnx_importer and onnx * styles applied * Revert "remove ngraph_test_util to onnx_importer and onnx". * test ngraph_test_util dependencies * Fixed static protobuf * Next * Fixes * Fixed cross-compilation * Don't export / install onnx_proto * Fixed Windows * Fixed opencl headers * Fix * Added exclude-all for exe as well * Fixed code style * Try without LTO * LTO off only for onnx importer Co-authored-by: mbencer <mateusz.bencer@intel.com>
This commit is contained in:
parent
2a15e3e79c
commit
1621c66ad8
|
|
@ -109,7 +109,6 @@ jobs:
|
|||
-DENABLE_WHEEL=ON
|
||||
-DENABLE_TESTS=ON
|
||||
-DNGRAPH_ONNX_IMPORT_ENABLE=ON
|
||||
-DNGRAPH_ONNX_EDITOR_ENABLE=ON
|
||||
-DENABLE_FASTER_BUILD=ON
|
||||
-DENABLE_STRICT_DEPENDENCIES=OFF
|
||||
-DIE_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ jobs:
|
|||
-DENABLE_SAMPLES=OFF
|
||||
-DENABLE_SPEECH_DEMO=OFF
|
||||
-DNGRAPH_ONNX_IMPORT_ENABLE=ON
|
||||
-DNGRAPH_ONNX_EDITOR_ENABLE=ON
|
||||
-DNGRAPH_DEBUG_ENABLE=OFF
|
||||
$(REPO_DIR)
|
||||
workingDirectory: $(BUILD_DIR)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ RUN cmake .. \
|
|||
-DENABLE_PYTHON=ON \
|
||||
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
|
||||
-DNGRAPH_ONNX_IMPORT_ENABLE=ON \
|
||||
-DNGRAPH_ONNX_EDITOR_ENABLE=ON \
|
||||
-DNGRAPH_DEBUG_ENABLE=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/openvino/dist \
|
||||
-DNGRAPH_USE_PROTOBUF_LITE=${PROTOBUF_LITE}
|
||||
|
|
|
|||
|
|
@ -93,15 +93,8 @@ ie_coverage_genhtml(INFO_FILE "ngraph"
|
|||
if(NGRAPH_ONNX_IMPORT_ENABLE)
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "onnx_importer"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx_common*"
|
||||
"${OV_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx_editor*"
|
||||
"${OV_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx_import*")
|
||||
ie_coverage_genhtml(INFO_FILE "onnx_importer"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
if(NGRAPH_ONNX_EDITOR_ENABLE)
|
||||
ie_coverage_extract(INPUT "openvino" OUTPUT "onnx_editor"
|
||||
PATTERNS "${OV_COVERAGE_BASE_DIRECTORY}/ngraph/frontend/onnx_editor*")
|
||||
ie_coverage_genhtml(INFO_FILE "onnx_editor"
|
||||
PREFIX "${OV_COVERAGE_BASE_DIRECTORY}")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -313,5 +313,6 @@ else()
|
|||
elseif(LINUX)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -Wl,--exclude-libs,ALL")
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <CL/cl2.hpp>
|
||||
#include <CL/opencl.hpp>
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
|
|
|
|||
|
|
@ -21,64 +21,20 @@ option(NGRAPH_UNIT_TEST_ENABLE "Control the building of unit tests" ON)
|
|||
option(NGRAPH_UNIT_TEST_BACKENDS_ENABLE "Control the building of unit tests using backends" ON)
|
||||
option(NGRAPH_DEBUG_ENABLE "Enable output for NGRAPH_DEBUG statements" OFF)
|
||||
option(NGRAPH_ONNX_IMPORT_ENABLE "Enable ONNX importer" OFF)
|
||||
option(NGRAPH_ONNX_EDITOR_ENABLE "Enable ONNX Editor" OFF)
|
||||
option(NGRAPH_PDPD_FRONTEND_ENABLE "Enable PaddlePaddle FrontEnd" OFF)
|
||||
option(NGRAPH_USE_PROTOBUF_LITE "Compiles and links with protobuf-lite" OFF)
|
||||
|
||||
if (NGRAPH_ONNX_IMPORT_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE)
|
||||
option(NGRAPH_USE_SYSTEM_PROTOBUF "Use system provided Protobuf shared object" OFF)
|
||||
endif()
|
||||
if(NGRAPH_ONNX_EDITOR_ENABLE AND NOT NGRAPH_ONNX_IMPORT_ENABLE)
|
||||
message(FATAL_ERROR "ONNX Editor component requires ONNX Importer. Set NGRAPH_ONNX_IMPORT_ENABLE=ON.")
|
||||
endif()
|
||||
|
||||
message(STATUS "NGRAPH_DEBUG_ENABLE: ${NGRAPH_DEBUG_ENABLE}")
|
||||
message(STATUS "NGRAPH_ONNX_IMPORT_ENABLE: ${NGRAPH_ONNX_IMPORT_ENABLE}")
|
||||
message(STATUS "NGRAPH_ONNX_EDITOR_ENABLE: ${NGRAPH_ONNX_EDITOR_ENABLE}")
|
||||
message(STATUS "NGRAPH_PDPD_FRONTEND_ENABLE: ${NGRAPH_PDPD_FRONTEND_ENABLE}")
|
||||
message(STATUS "NGRAPH_USE_PROTOBUF_LITE: ${NGRAPH_USE_PROTOBUF_LITE}")
|
||||
message(STATUS "NGRAPH_UNIT_TEST_ENABLE: ${NGRAPH_UNIT_TEST_ENABLE}")
|
||||
message(STATUS "NGRAPH_UNIT_TEST_BACKENDS_ENABLE: ${NGRAPH_UNIT_TEST_BACKENDS_ENABLE}")
|
||||
|
||||
# Setup CMAKE_ARGS to be forwarded to External Projects
|
||||
set(NGRAPH_FORWARD_CMAKE_ARGS
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
|
||||
-DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
|
||||
-DCMAKE_CXX_EXTENSIONS:BOOL=${CMAKE_CXX_EXTENSIONS}
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=${CMAKE_EXPORT_COMPILE_COMMANDS}
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=${CMAKE_POSITION_INDEPENDENT_CODE}
|
||||
-DCMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX}
|
||||
-DCMAKE_RELEASE_POSTFIX=${CMAKE_RELEASE_POSTFIX}
|
||||
)
|
||||
|
||||
if(CMAKE_TOOLCHAIN_FILE)
|
||||
set(NGRAPH_FORWARD_CMAKE_ARGS
|
||||
${NGRAPH_FORWARD_CMAKE_ARGS}
|
||||
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_OSX_SYSROOT)
|
||||
set(NGRAPH_FORWARD_CMAKE_ARGS
|
||||
${NGRAPH_FORWARD_CMAKE_ARGS}
|
||||
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT MSVC)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
|
||||
endif()
|
||||
|
||||
set(NGRAPH_FORWARD_CMAKE_ARGS
|
||||
${NGRAPH_FORWARD_CMAKE_ARGS}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
)
|
||||
endif()
|
||||
message(STATUS "NGRAPH_FORWARD_CMAKE_ARGS ${NGRAPH_FORWARD_CMAKE_ARGS}")
|
||||
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
# Installation logic...
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
|
|
@ -154,12 +110,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ngraphConfig.cmake
|
|||
DESTINATION "deployment_tools/ngraph/cmake"
|
||||
COMPONENT ngraph_dev)
|
||||
|
||||
set(USE_STATIC_PROTOBUF OFF)
|
||||
if (NGRAPH_PDPD_FRONTEND_ENABLE) # add more frontends here which depend on static protobuf
|
||||
set(USE_STATIC_PROTOBUF ON)
|
||||
endif()
|
||||
|
||||
if (NGRAPH_ONNX_IMPORT_ENABLE OR USE_STATIC_PROTOBUF)
|
||||
if (NGRAPH_ONNX_IMPORT_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE)
|
||||
if (MSVC)
|
||||
# When we build dll libraries. These flags make sure onnx and protobuf build with /MD, not /MT.
|
||||
# These two options can't be mixed, because they requires link two imcompatiable runtime.
|
||||
|
|
@ -174,8 +125,7 @@ if (NGRAPH_ONNX_IMPORT_ENABLE OR USE_STATIC_PROTOBUF)
|
|||
endif()
|
||||
|
||||
set(BEFORE_ONNX_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
set(BUILD_STANDALONE_STATIC OFF)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
if (NOT NGRAPH_USE_SYSTEM_PROTOBUF)
|
||||
add_subdirectory(${CMAKE_SOURCE_DIR}/thirdparty/protobuf ${CMAKE_BINARY_DIR}/_deps/protobuf)
|
||||
|
|
@ -193,7 +143,6 @@ if (NGRAPH_ONNX_IMPORT_ENABLE OR USE_STATIC_PROTOBUF)
|
|||
|
||||
set(BUILD_SHARED_LIBS ${BEFORE_ONNX_BUILD_SHARED_LIBS})
|
||||
unset(BEFORE_ONNX_BUILD_SHARED_LIBS)
|
||||
unset(BUILD_STANDALONE_STATIC)
|
||||
endif()
|
||||
|
||||
add_subdirectory(frontend)
|
||||
|
|
|
|||
|
|
@ -2,41 +2,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
if(NOT WIN32)
|
||||
# There seems no suitable other way to identify exact output binary name for libprotobuf
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Use 'protobufd' directly as it is done in the same way in protobuf cmake files
|
||||
set(PROTOBUF_STATIC_LIB_OUTPUT
|
||||
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}protobufd${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
else(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(PROTOBUF_STATIC_LIB_OUTPUT ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
|
||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libprotobuf_static)
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
${PROTOBUF_STATIC_LIB_OUTPUT}
|
||||
COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}/thirdparty/cmake_static_protobuf
|
||||
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
||||
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
|
||||
-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=${CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY}
|
||||
-DCMAKE_PDB_OUTPUT_DIRECTORY=${CMAKE_PDB_OUTPUT_DIRECTORY}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
|
||||
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||
-DCMAKE_CXX_VISIBILITY_PRESET=${CMAKE_CXX_VISIBILITY_PRESET}
|
||||
-DNGRAPH_INSTALL_LIB=${NGRAPH_INSTALL_LIB}
|
||||
-DSYSTEM_PROTOC=${SYSTEM_PROTOC}
|
||||
${NGRAPH_FORWARD_CMAKE_ARGS}
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target libprotobuf
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/libprotobuf_static
|
||||
COMMENT "Build Protobuf Static Library"
|
||||
)
|
||||
|
||||
add_custom_target(libprotobuf_static
|
||||
DEPENDS ${PROTOBUF_STATIC_LIB_OUTPUT})
|
||||
endif()
|
||||
|
||||
set(FRONTEND_INSTALL_INCLUDE "${NGRAPH_INSTALL_INCLUDE}/ngraph/frontend")
|
||||
|
||||
add_subdirectory(frontend_manager)
|
||||
|
|
@ -46,10 +11,6 @@ if (NGRAPH_ONNX_IMPORT_ENABLE)
|
|||
add_subdirectory(onnx_import)
|
||||
endif()
|
||||
|
||||
if (NGRAPH_ONNX_EDITOR_ENABLE)
|
||||
add_subdirectory(onnx_editor)
|
||||
endif()
|
||||
|
||||
if (NGRAPH_PDPD_FRONTEND_ENABLE)
|
||||
add_subdirectory(paddlepaddle)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
|
||||
|
||||
set(TARGET_NAME "onnx_common")
|
||||
|
||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
|
|
|
|||
|
|
@ -2,39 +2,39 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(TARGET_NAME "onnx_editor")
|
||||
#set(TARGET_NAME "onnx_editor")
|
||||
|
||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
||||
file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
||||
#file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
#file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
||||
#file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
||||
|
||||
# Create named folders for the sources within the .vcproj
|
||||
# Empty name lists them directly under the .vcproj
|
||||
|
||||
source_group("src" FILES ${LIBRARY_SRC})
|
||||
source_group("include" FILES ${LIBRARY_HEADERS})
|
||||
source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS})
|
||||
#source_group("src" FILES ${LIBRARY_SRC})
|
||||
#source_group("include" FILES ${LIBRARY_HEADERS})
|
||||
#source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS})
|
||||
|
||||
# Create static library
|
||||
|
||||
add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
|
||||
add_library(ngraph::onnx_editor ALIAS ${TARGET_NAME})
|
||||
#add_library(${TARGET_NAME} OBJECT ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
|
||||
#add_library(ngraph::onnx_editor ALIAS ${TARGET_NAME})
|
||||
|
||||
# TODO Add handling ie_faster_build
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE onnx_common onnx_importer
|
||||
PUBLIC ngraph)
|
||||
#target_link_libraries(${TARGET_NAME} PRIVATE onnx_common
|
||||
# PUBLIC ngraph)
|
||||
|
||||
set(ONNX_EDITOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
set(ONNX_EDITOR_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
#set(ONNX_EDITOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
#set(ONNX_EDITOR_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ONNX_EDITOR_INCLUDE_DIR}>
|
||||
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>)
|
||||
#target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ONNX_EDITOR_INCLUDE_DIR}>
|
||||
# $<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_EDITOR_SRC_DIR})
|
||||
#target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_EDITOR_SRC_DIR})
|
||||
|
||||
if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_USE_PROTOBUF_LITE)
|
||||
endif()
|
||||
#if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
# target_compile_definitions(${TARGET_NAME} PRIVATE NGRAPH_USE_PROTOBUF_LITE)
|
||||
#endif()
|
||||
|
||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
||||
#add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace ngraph
|
|||
class EdgeMapper
|
||||
{
|
||||
public:
|
||||
EdgeMapper() = default;
|
||||
ONNX_IMPORTER_API EdgeMapper() = default;
|
||||
|
||||
/// \brief Creates an edge mapper based on a GraphProto object.
|
||||
///
|
||||
|
|
@ -51,7 +51,8 @@ namespace ngraph
|
|||
///
|
||||
/// \param input An EditorInput helper structure created based on a input name
|
||||
/// or a input index.
|
||||
InputEdge find_input_edge(const EditorNode& node, const EditorInput& input) const;
|
||||
ONNX_IMPORTER_API InputEdge find_input_edge(const EditorNode& node,
|
||||
const EditorInput& input) const;
|
||||
|
||||
/// \brief Returns an OutputEdge based on a node (node name or output name)
|
||||
/// and an output (output name or output index).
|
||||
|
|
@ -68,7 +69,8 @@ namespace ngraph
|
|||
///
|
||||
/// \param output An EditorOutput helper structure created based on a output name
|
||||
/// or a output index.
|
||||
OutputEdge find_output_edge(const EditorNode& node, const EditorOutput& output) const;
|
||||
ONNX_IMPORTER_API OutputEdge find_output_edge(const EditorNode& node,
|
||||
const EditorOutput& output) const;
|
||||
|
||||
/// \brief Returns an OutputEdge based on a output name.
|
||||
///
|
||||
|
|
@ -76,7 +78,7 @@ namespace ngraph
|
|||
///
|
||||
/// \param output_name A node output name.
|
||||
///
|
||||
OutputEdge find_output_edge(const std::string& output_name) const;
|
||||
ONNX_IMPORTER_API OutputEdge find_output_edge(const std::string& output_name) const;
|
||||
|
||||
/// \brief Returns a vector of InputEdges which consume an output of a node
|
||||
/// determined by provided output name.
|
||||
|
|
@ -85,7 +87,8 @@ namespace ngraph
|
|||
///
|
||||
/// \param output_name A node output name.
|
||||
///
|
||||
std::vector<InputEdge> find_output_consumers(const std::string& output_name) const;
|
||||
ONNX_IMPORTER_API std::vector<InputEdge>
|
||||
find_output_consumers(const std::string& output_name) const;
|
||||
|
||||
/// \brief Returns true if a provided node is correct (exists in a graph)
|
||||
/// and is not ambiguous (identification of an ONNX node can be ambiguous
|
||||
|
|
@ -94,7 +97,7 @@ namespace ngraph
|
|||
/// \param node An EditorNode helper structure created based on a node name
|
||||
/// or a node output name.
|
||||
///
|
||||
bool is_correct_and_unambiguous_node(const EditorNode& node) const;
|
||||
ONNX_IMPORTER_API bool is_correct_and_unambiguous_node(const EditorNode& node) const;
|
||||
|
||||
private:
|
||||
std::vector<int> find_node_indexes(const std::string& node_name,
|
||||
|
|
|
|||
|
|
@ -15,13 +15,6 @@
|
|||
#include "onnx_editor/editor.hpp"
|
||||
#include "onnx_editor/editor_types.hpp"
|
||||
|
||||
namespace ONNX_NAMESPACE
|
||||
{
|
||||
// forward declaration to avoid the necessity of include paths setting in components
|
||||
// that don't directly depend on the ONNX library
|
||||
class ModelProto;
|
||||
} // namespace ONNX_NAMESPACE
|
||||
|
||||
namespace ngraph
|
||||
{
|
||||
namespace onnx_editor
|
||||
|
|
@ -31,7 +24,7 @@ namespace ngraph
|
|||
/// \note This class can be used to modify an ONNX model before it gets translated to
|
||||
/// an ngraph::Function by the import_onnx_model function. It lets you modify the
|
||||
/// model's input types and shapes, extract a subgraph and more.
|
||||
class ONNXModelEditor final
|
||||
class ONNX_IMPORTER_API ONNXModelEditor final
|
||||
{
|
||||
public:
|
||||
ONNXModelEditor() = delete;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "onnx_import/utils/onnx_importer_visibility.hpp"
|
||||
|
||||
namespace ngraph
|
||||
{
|
||||
enum class EdgeType
|
||||
|
|
@ -85,7 +87,7 @@ namespace ngraph
|
|||
///
|
||||
/// The optional argument "new_input_name" can be used to set a custom input name
|
||||
/// which can be created during cutting a graph.
|
||||
struct EditorInput
|
||||
struct ONNX_IMPORTER_API EditorInput
|
||||
{
|
||||
EditorInput() = delete;
|
||||
EditorInput(std::string input_name, std::string new_input_name = "")
|
||||
|
|
@ -110,7 +112,7 @@ namespace ngraph
|
|||
/// ----(in_A)----> | test_node |
|
||||
/// +-----------+ ---(out2)--->
|
||||
/// You can indicate out2 as EditorOutput("out2") or EditorOutput(1)
|
||||
struct EditorOutput
|
||||
struct ONNX_IMPORTER_API EditorOutput
|
||||
{
|
||||
EditorOutput() = delete;
|
||||
EditorOutput(std::string output_name)
|
||||
|
|
@ -135,7 +137,7 @@ namespace ngraph
|
|||
/// You can indicate test_node by name as EditorNode("test_node")
|
||||
/// or by assigned output as EditorNode(EditorOutput("out1"))
|
||||
/// or EditorNode(EditorOutput("out2"))
|
||||
struct EditorNode
|
||||
struct ONNX_IMPORTER_API EditorNode
|
||||
{
|
||||
EditorNode(std::string node_name)
|
||||
: m_node_name{std::move(node_name)}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,17 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
|
||||
set(ONNX_OPSET_VERSION 13 CACHE INTERNAL "Supported version of ONNX operator set")
|
||||
|
||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
||||
file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
||||
|
||||
file(GLOB_RECURSE EDITOR_LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../onnx_editor/src/*.cpp)
|
||||
file(GLOB_RECURSE EDITOR_LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../onnx_editor/src/*.hpp)
|
||||
file(GLOB_RECURSE EDITOR_LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../onnx_editor/include/*.hpp)
|
||||
|
||||
# Remove disabled ops
|
||||
list(REMOVE_ITEM LIBRARY_SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/op/conv_integer.cpp
|
||||
|
|
@ -23,12 +28,13 @@ set(ONNX_IMPORT_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|||
# Create named folders for the sources within the .vcproj
|
||||
# Empty name lists them directly under the .vcproj
|
||||
|
||||
source_group("src" FILES ${LIBRARY_SRC})
|
||||
source_group("include" FILES ${LIBRARY_HEADERS})
|
||||
source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS})
|
||||
source_group("src" FILES ${LIBRARY_SRC} ${EDITOR_LIBRARY_SRC})
|
||||
source_group("include" FILES ${LIBRARY_HEADERS} ${EDITOR_LIBRARY_HEADERS})
|
||||
source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS} ${EDITOR_LIBRARY_PUBLIC_HEADERS})
|
||||
|
||||
# Create shared library
|
||||
add_library(onnx_importer SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
|
||||
add_library(onnx_importer SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}
|
||||
${EDITOR_LIBRARY_SRC} ${EDITOR_LIBRARY_HEADERS} ${EDITOR_LIBRARY_PUBLIC_HEADERS})
|
||||
add_library(ngraph::onnx_importer ALIAS onnx_importer)
|
||||
|
||||
add_clang_format_target(onnx_importer_clang FOR_TARGETS onnx_importer)
|
||||
|
|
@ -55,6 +61,12 @@ target_include_directories(onnx_importer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
|
|||
|
||||
target_compile_definitions(onnx_importer PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION})
|
||||
|
||||
set(ONNX_EDITOR_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../onnx_editor/include)
|
||||
set(ONNX_EDITOR_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../onnx_editor/src)
|
||||
|
||||
target_include_directories(onnx_importer PUBLIC $<BUILD_INTERFACE:${ONNX_EDITOR_INCLUDE_DIR}>)
|
||||
target_include_directories(onnx_importer PRIVATE ${ONNX_EDITOR_SRC_DIR})
|
||||
|
||||
if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
target_compile_definitions(onnx_importer PRIVATE NGRAPH_USE_PROTOBUF_LITE)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ namespace ngraph
|
|||
{
|
||||
public:
|
||||
Node() = delete;
|
||||
// TODO: hide this ctor since it uses protobufs generated structures
|
||||
Node(const ONNX_NAMESPACE::NodeProto& node_proto, const Graph& graph);
|
||||
|
||||
Node(Node&&) noexcept;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ namespace ngraph
|
|||
///
|
||||
/// \return An nGraph function that represents a single output from the created
|
||||
/// graph.
|
||||
ONNX_IMPORTER_API
|
||||
std::shared_ptr<Function> import_onnx_model(ONNX_NAMESPACE::ModelProto& model_proto,
|
||||
const std::string& model_path);
|
||||
} // namespace detail
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ foreach(INFILE ${proto_files})
|
|||
COMMAND ${PDPD_PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto
|
||||
DEPENDS ${PDPD_PROTOC_EXECUTABLE} ${GENERATED_PROTO}
|
||||
COMMENT "Running C++ protocol buffer compiler (${PDPD_PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}"
|
||||
VERBATIM)
|
||||
VERBATIM
|
||||
COMMAND_EXPAND_LISTS)
|
||||
list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}")
|
||||
list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}")
|
||||
endforeach()
|
||||
|
|
@ -55,12 +56,7 @@ set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIO
|
|||
# Create shared library
|
||||
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
|
||||
|
||||
add_dependencies(${TARGET_NAME} libprotobuf paddlepaddle_ngraph_frontend_proto)
|
||||
|
||||
if(NOT WIN32)
|
||||
# Addition dependency on static libprotobuf for non-Windows
|
||||
add_dependencies(${TARGET_NAME} libprotobuf_static)
|
||||
endif()
|
||||
add_dependencies(${TARGET_NAME} paddlepaddle_ngraph_frontend_proto)
|
||||
|
||||
target_include_directories(${TARGET_NAME}
|
||||
PUBLIC
|
||||
|
|
@ -76,11 +72,7 @@ if(COMMAND ie_add_vs_version_file)
|
|||
FILEDESCRIPTION "FrontEnd to load and convert PaddlePaddle file format")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE libprotobuf)
|
||||
else()
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${PROTOBUF_STATIC_LIB_OUTPUT})
|
||||
endif()
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES})
|
||||
|
||||
target_link_libraries(${TARGET_NAME} PUBLIC frontend_manager
|
||||
PRIVATE ngraph::builder)
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ if (NGRAPH_ONNX_IMPORT_ENABLE AND NOT NGRAPH_USE_PROTOBUF_LITE)
|
|||
onnx/onnx_tensor_names.cpp)
|
||||
endif()
|
||||
|
||||
if (NGRAPH_ONNX_EDITOR_ENABLE)
|
||||
if (NGRAPH_ONNX_IMPORT_ENABLE)
|
||||
list(APPEND SRC onnx/onnx_editor.cpp)
|
||||
list(APPEND MULTI_TEST_SRC
|
||||
onnx/onnx_test_utils.in.cpp
|
||||
|
|
@ -636,10 +636,6 @@ if (NGRAPH_ONNX_IMPORT_ENABLE)
|
|||
target_link_libraries(unit-test PRIVATE onnx_importer)
|
||||
endif()
|
||||
|
||||
if (NGRAPH_ONNX_EDITOR_ENABLE)
|
||||
target_link_libraries(unit-test PRIVATE onnx_editor)
|
||||
endif()
|
||||
|
||||
target_link_libraries(unit-test PRIVATE interpreter_backend)
|
||||
|
||||
install(TARGETS unit-test
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ static const std::vector<std::string> models{
|
|||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PDPDBasicTest,
|
||||
FrontEndBasicTest,
|
||||
::testing::Combine(::testing::Values(PDPD),
|
||||
::testing::Values(std::string(TEST_PDPD_MODELS)),
|
||||
::testing::ValuesIn(models)),
|
||||
FrontEndBasicTest::getTestCaseName);
|
||||
FrontEndBasicTest,
|
||||
::testing::Combine(::testing::Values(PDPD),
|
||||
::testing::Values(std::string(TEST_PDPD_MODELS)),
|
||||
::testing::ValuesIn(models)),
|
||||
FrontEndBasicTest::getTestCaseName);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ static CutModelParam getTestData_2in_2out()
|
|||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PDPDCutTest,
|
||||
FrontEndCutModelTest,
|
||||
::testing::Values(getTestData_2in_2out()),
|
||||
FrontEndCutModelTest::getTestCaseName);
|
||||
FrontEndCutModelTest,
|
||||
::testing::Values(getTestData_2in_2out()),
|
||||
FrontEndCutModelTest::getTestCaseName);
|
||||
|
|
@ -24,6 +24,6 @@ static LoadFromFEParam getTestData()
|
|||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PDPDCutTest,
|
||||
FrontEndLoadFromTest,
|
||||
::testing::Values(getTestData()),
|
||||
FrontEndLoadFromTest::getTestCaseName);
|
||||
FrontEndLoadFromTest,
|
||||
::testing::Values(getTestData()),
|
||||
FrontEndLoadFromTest::getTestCaseName);
|
||||
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include <fstream>
|
||||
|
||||
#include <cnpy.h>
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "op_fuzzy.hpp"
|
||||
#include "util/engine/test_engines.hpp"
|
||||
#include "util/test_control.hpp"
|
||||
#include <cnpy.h>
|
||||
#include "op_fuzzy.hpp"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
using namespace InferenceEngine;
|
||||
|
|
|
|||
|
|
@ -62,13 +62,13 @@ static PartShape getTestShape_conv2d_relu()
|
|||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PDPDPartialShapeTest,
|
||||
FrontEndPartialShapeTest,
|
||||
::testing::Combine(::testing::Values(BaseFEParam{
|
||||
PDPD, std::string(TEST_PDPD_MODELS)}),
|
||||
::testing::ValuesIn(std::vector<PartShape>{
|
||||
getTestShape_2in_2out(),
|
||||
getTestShape_conv2d_relu(),
|
||||
getTestShape_conv2d(),
|
||||
getTestShape_conv2d_setDynamicBatch(),
|
||||
getTestShape_2in_2out_dynbatch()})),
|
||||
FrontEndPartialShapeTest::getTestCaseName);
|
||||
FrontEndPartialShapeTest,
|
||||
::testing::Combine(::testing::Values(BaseFEParam{
|
||||
PDPD, std::string(TEST_PDPD_MODELS)}),
|
||||
::testing::ValuesIn(std::vector<PartShape>{
|
||||
getTestShape_2in_2out(),
|
||||
getTestShape_conv2d_relu(),
|
||||
getTestShape_conv2d(),
|
||||
getTestShape_conv2d_setDynamicBatch(),
|
||||
getTestShape_2in_2out_dynbatch()})),
|
||||
FrontEndPartialShapeTest::getTestCaseName);
|
||||
|
|
@ -21,6 +21,6 @@ static SetTypeFEParam getTestData_relu()
|
|||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(PDPDCutTest,
|
||||
FrontEndElementTypeTest,
|
||||
::testing::Values(getTestData_relu()),
|
||||
FrontEndElementTypeTest::getTestCaseName);
|
||||
FrontEndElementTypeTest,
|
||||
::testing::Values(getTestData_relu()),
|
||||
FrontEndElementTypeTest::getTestCaseName);
|
||||
|
|
@ -31,5 +31,6 @@ protected:
|
|||
|
||||
void doLoadFromFile();
|
||||
|
||||
void runConvertedModel(const std::shared_ptr<ngraph::Function> function, const std::string& model_file);
|
||||
void runConvertedModel(const std::shared_ptr<ngraph::Function> function,
|
||||
const std::string& model_file);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#include <cnpy.h>
|
||||
|
||||
#include "op_fuzzy.hpp"
|
||||
#include "util/engine/test_engines.hpp"
|
||||
#include "util/test_case.hpp"
|
||||
#include "util/test_control.hpp"
|
||||
#include "op_fuzzy.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(libprotobuf_static)
|
||||
|
||||
message("Add PROTOBUF dependency - static")
|
||||
|
||||
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_STANDALONE_STATIC_OLD ${BUILD_STANDALONE_STATIC})
|
||||
set(USE_STATIC_PROTOBUF_OLD ${USE_STATIC_PROTOBUF})
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(BUILD_STANDALONE_STATIC ON)
|
||||
set(USE_STATIC_PROTOBUF ON)
|
||||
|
||||
add_subdirectory(../protobuf ${CMAKE_BINARY_DIR}/_deps/static-protobuf)
|
||||
|
||||
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD})
|
||||
set(BUILD_STANDALONE_STATIC ${BUILD_STANDALONE_STATIC_OLD})
|
||||
set(USE_STATIC_PROTOBUF ${USE_STATIC_PROTOBUF_OLD})
|
||||
|
|
@ -2,6 +2,8 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Configure and install libonnx ...
|
||||
#------------------------------------------------------------------------------
|
||||
|
|
@ -17,22 +19,9 @@ macro(onnx_set_target_properties)
|
|||
elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
|
||||
target_compile_options(onnx PRIVATE -Wno-all)
|
||||
target_compile_options(onnx_proto PRIVATE -Wno-all -Wno-unused-variable)
|
||||
|
||||
# it fixes random problems with double registration of descriptors to protobuf database
|
||||
set_target_properties(onnx_proto PROPERTIES
|
||||
CXX_VISIBILITY_PRESET default
|
||||
C_VISIBILITY_PRESET default
|
||||
VISIBILITY_INLINES_HIDDEN OFF)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(onnx PUBLIC ONNX_BUILD_SHARED_LIBS)
|
||||
|
||||
install(TARGETS onnx_proto
|
||||
RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph
|
||||
ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph
|
||||
LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph)
|
||||
|
||||
export(TARGETS onnx onnx_proto NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}")
|
||||
endmacro()
|
||||
|
||||
set(ONNX_USE_PROTOBUF_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Use dynamic protobuf by ONNX library")
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Configure and install Google Protobuf ...
|
||||
# Configure Google Protobuf ...
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
|
||||
|
|
@ -13,7 +13,7 @@ if (MSVC)
|
|||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
find_program(SYSTEM_PROTOC protoc PATHS ENV PATH)
|
||||
find_host_program(SYSTEM_PROTOC protoc PATHS ENV PATH)
|
||||
|
||||
if(SYSTEM_PROTOC)
|
||||
execute_process(
|
||||
|
|
@ -33,38 +33,14 @@ if(CMAKE_CROSSCOMPILING)
|
|||
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build libprotoc and protoc compiler" FORCE)
|
||||
endif()
|
||||
|
||||
if (CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
set(MAKE_UTIL make)
|
||||
else()
|
||||
set(MAKE_UTIL $(MAKE))
|
||||
endif()
|
||||
|
||||
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs")
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests")
|
||||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support")
|
||||
|
||||
if (NOT BUILD_STANDALONE_STATIC)
|
||||
add_subdirectory(protobuf/cmake EXCLUDE_FROM_ALL)
|
||||
get_directory_property(protobuf_VERSION DIRECTORY protobuf/cmake DEFINITION protobuf_VERSION)
|
||||
endif()
|
||||
if (USE_STATIC_PROTOBUF)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
ext_protobuf_static
|
||||
URL ${CMAKE_CURRENT_SOURCE_DIR}/protobuf
|
||||
)
|
||||
FetchContent_GetProperties(ext_protobuf_static)
|
||||
if((NOT ext_protobuf_static_POPULATED) AND BUILD_STANDALONE_STATIC)
|
||||
FetchContent_Populate(ext_protobuf_static)
|
||||
add_subdirectory(${ext_protobuf_static_SOURCE_DIR}/cmake ${ext_protobuf_static_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
get_directory_property(protobuf_VERSION DIRECTORY ${ext_protobuf_static_SOURCE_DIR}/cmake DEFINITION protobuf_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
add_subdirectory(protobuf/cmake EXCLUDE_FROM_ALL)
|
||||
get_directory_property(protobuf_VERSION DIRECTORY protobuf/cmake DEFINITION protobuf_VERSION)
|
||||
|
||||
if (BUILD_STANDALONE_STATIC)
|
||||
set(Protobuf_INCLUDE_DIRS ${ext_protobuf_static_SOURCE_DIR}/src)
|
||||
else()
|
||||
set(Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/protobuf/src)
|
||||
endif()
|
||||
set(Protobuf_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/protobuf/src)
|
||||
|
||||
if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
set(Protobuf_LIBRARIES libprotobuf-lite)
|
||||
|
|
@ -75,18 +51,21 @@ endif()
|
|||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
|
||||
set(_proto_libs ${Protobuf_LIBRARIES})
|
||||
if(TARGET libprotoc)
|
||||
list(APPEND _proto_libs libprotoc)
|
||||
target_compile_options(libprotoc PRIVATE -Wno-all -Wno-unused-variable)
|
||||
target_compile_options(libprotoc PRIVATE -Wno-all -Wno-unused-variable)
|
||||
|
||||
# required for protoc compiler
|
||||
set_target_properties(libprotoc PROPERTIES
|
||||
CXX_VISIBILITY_PRESET default
|
||||
C_VISIBILITY_PRESET default
|
||||
VISIBILITY_INLINES_HIDDEN OFF)
|
||||
endif()
|
||||
set_target_properties(${_proto_libs} PROPERTIES
|
||||
CXX_VISIBILITY_PRESET default
|
||||
C_VISIBILITY_PRESET default
|
||||
VISIBILITY_INLINES_HIDDEN OFF)
|
||||
foreach(target libprotobuf libprotobuf-lite)
|
||||
foreach(target libprotobuf libprotobuf-lite)
|
||||
if(TARGET ${target})
|
||||
target_compile_options(${target}
|
||||
PRIVATE -Wno-all -Wno-unused-variable -Wno-inconsistent-missing-override
|
||||
PUBLIC -Wno-undef)
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(NGRAPH_USE_PROTOBUF_LITE)
|
||||
|
|
@ -110,15 +89,6 @@ if(CMAKE_CROSSCOMPILING AND NOT PROTOC_VERSION VERSION_EQUAL protobuf_VERSION)
|
|||
message(WARNING "system protobuf version does not match with the compiled one, please update system protobuf or submodule")
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_STANDALONE_STATIC)
|
||||
message("NGRAPH_INSTALL_LIB = ${NGRAPH_INSTALL_LIB}")
|
||||
install(TARGETS ${Protobuf_LIBRARIES}
|
||||
RUNTIME DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph
|
||||
ARCHIVE DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph
|
||||
LIBRARY DESTINATION ${NGRAPH_INSTALL_LIB} COMPONENT ngraph)
|
||||
export(TARGETS ${Protobuf_LIBRARIES} NAMESPACE ngraph:: APPEND FILE "${NGRAPH_TARGETS_FILE}")
|
||||
endif()
|
||||
|
||||
# forward variables used in the other places
|
||||
set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE)
|
||||
set(Protobuf_LIBRARIES ${Protobuf_LIBRARIES} PARENT_SCOPE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue