Static OpenVINO frontends (#8868)
* Static OpenVINO frontends * ONNX tests with shared extension CustomOpUser_ONNXImporter * Resolved issues with ONNX's NCC style check * Reverted openvino => ngraph for frontend includes install * Try to fix ONNX / Protobuf * Try to fix CI * Try * Fixed cmake stage with BUILD_SHARED_LIBS * Fixed export for linkable frontends * Fixed warnings on Linux * Fixed after ngraph => src
This commit is contained in:
parent
cf3c9ae04b
commit
c02fe4b813
@ -210,12 +210,10 @@ jobs:
|
|||||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddlepaddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-PaddlePaddle.xml
|
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\paddlepaddle_tests --gtest_print_time=1 --gtest_output=xml:TEST-PaddlePaddle.xml
|
||||||
displayName: 'PaddlePaddle Frontend UT'
|
displayName: 'PaddlePaddle Frontend UT'
|
||||||
continueOnError: false
|
continueOnError: false
|
||||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
|
||||||
|
|
||||||
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
|
- script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml
|
||||||
displayName: 'Tensorflow Frontend UT'
|
displayName: 'Tensorflow Frontend UT'
|
||||||
continueOnError: false
|
continueOnError: false
|
||||||
condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON')
|
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
set PATH=$(IB_DIR);%PATH%
|
set PATH=$(IB_DIR);%PATH%
|
||||||
|
@ -32,6 +32,7 @@ endif()
|
|||||||
|
|
||||||
# resolving dependencies for the project
|
# resolving dependencies for the project
|
||||||
message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
|
message (STATUS "PROJECT ............................... " ${PROJECT_NAME})
|
||||||
|
message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION})
|
||||||
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
|
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
|
||||||
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
|
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
|
||||||
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
|
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
|
||||||
|
@ -228,6 +228,7 @@ include(api_validator/api_validator)
|
|||||||
|
|
||||||
include(vs_version/vs_version)
|
include(vs_version/vs_version)
|
||||||
include(plugins/plugins)
|
include(plugins/plugins)
|
||||||
|
include(frontends/frontends)
|
||||||
include(add_ie_target)
|
include(add_ie_target)
|
||||||
include(CMakePackageConfigHelpers)
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
34
cmake/developer_package/frontends/create_frontends_hpp.cmake
Normal file
34
cmake/developer_package/frontends/create_frontends_hpp.cmake
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Copyright (C) 2018-2021 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
foreach(var OV_FRONTENDS_HPP_HEADER_IN OV_FRONTENDS_HPP_HEADER FRONTEND_NAMES)
|
||||||
|
if(NOT DEFINED ${var})
|
||||||
|
message(FATAL_ERROR "${var} is required, but not defined")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# configure variables
|
||||||
|
|
||||||
|
set(OV_FRONTEND_DECLARATIONS "")
|
||||||
|
set(OV_FRONTEND_MAP_DEFINITION " FrontendsStaticRegistry registry = {")
|
||||||
|
|
||||||
|
foreach(frontend IN LISTS FRONTEND_NAMES)
|
||||||
|
# common
|
||||||
|
set(_OV_FRONTEND_DATA_FUNC "GetFrontEndData${frontend}")
|
||||||
|
set(_OV_VERSION_FUNC "GetAPIVersion${frontend}")
|
||||||
|
|
||||||
|
# declarations
|
||||||
|
set(OV_FRONTEND_DECLARATIONS "${OV_FRONTEND_DECLARATIONS}
|
||||||
|
ov::frontend::FrontEndVersion ${_OV_VERSION_FUNC}();
|
||||||
|
void* ${_OV_FRONTEND_DATA_FUNC}();")
|
||||||
|
|
||||||
|
set(OV_FRONTEND_MAP_DEFINITION "${OV_FRONTEND_MAP_DEFINITION}
|
||||||
|
{ Value { ${_OV_FRONTEND_DATA_FUNC}, ${_OV_VERSION_FUNC} } },")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(OV_FRONTEND_MAP_DEFINITION "${OV_FRONTEND_MAP_DEFINITION}
|
||||||
|
};
|
||||||
|
return registry;")
|
||||||
|
|
||||||
|
configure_file("${OV_FRONTENDS_HPP_HEADER_IN}" "${OV_FRONTENDS_HPP_HEADER}" @ONLY)
|
241
cmake/developer_package/frontends/frontends.cmake
Normal file
241
cmake/developer_package/frontends/frontends.cmake
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
# Copyright (C) 2018-2021 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
set(FRONTEND_INSTALL_INCLUDE "runtime/include/ngraph/frontend")
|
||||||
|
set(FRONTEND_NAME_SUFFIX "_ov_frontend")
|
||||||
|
|
||||||
|
set(FRONTEND_NAMES "" CACHE INTERNAL "")
|
||||||
|
|
||||||
|
if(NOT TARGET ov_frontends)
|
||||||
|
add_custom_target(ov_frontends)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#
|
||||||
|
# ov_target_link_frontends(<TARGET_NAME>)
|
||||||
|
#
|
||||||
|
function(ov_target_link_frontends TARGET_NAME)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(name IN LISTS FRONTEND_NAMES)
|
||||||
|
set(frontend_target_name "${name}${FRONTEND_NAME_SUFFIX}")
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE ${frontend_target_name})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
#
|
||||||
|
# ov_generate_frontends_hpp()
|
||||||
|
#
|
||||||
|
function(ov_generate_frontends_hpp)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# add frontends to libraries including ov_frontends.hpp
|
||||||
|
ov_target_link_frontends(frontend_common)
|
||||||
|
|
||||||
|
set(ov_frontends_hpp "${CMAKE_BINARY_DIR}/src/frontends/common/src/ov_frontends.hpp")
|
||||||
|
set(frontends_hpp_in "${IEDevScripts_DIR}/frontends/ov_frontends.hpp.in")
|
||||||
|
|
||||||
|
add_custom_command(OUTPUT "${ov_frontends_hpp}"
|
||||||
|
COMMAND
|
||||||
|
"${CMAKE_COMMAND}"
|
||||||
|
-D "OV_FRONTENDS_HPP_HEADER_IN=${frontends_hpp_in}"
|
||||||
|
-D "OV_FRONTENDS_HPP_HEADER=${ov_frontends_hpp}"
|
||||||
|
-D "FRONTEND_NAMES=${FRONTEND_NAMES}"
|
||||||
|
-P "${IEDevScripts_DIR}/frontends/create_frontends_hpp.cmake"
|
||||||
|
DEPENDS
|
||||||
|
"${frontends_hpp_in}"
|
||||||
|
"${IEDevScripts_DIR}/frontends/create_frontends_hpp.cmake"
|
||||||
|
COMMENT
|
||||||
|
"Generate ov_frontends.hpp for static build"
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
# for some reason dependency on source files does not work
|
||||||
|
# so, we have to use explicit target and make it dependency for frontend_common
|
||||||
|
add_custom_target(_ov_frontends_hpp DEPENDS ${ov_frontends_hpp})
|
||||||
|
add_dependencies(frontend_common _ov_frontends_hpp)
|
||||||
|
|
||||||
|
# add dependency for object files
|
||||||
|
get_target_property(sources frontend_common::static SOURCES)
|
||||||
|
foreach(source IN LISTS sources)
|
||||||
|
if("${source}" MATCHES "\\$\\<TARGET_OBJECTS\\:([A-Za-z0-9_]*)\\>")
|
||||||
|
# object library
|
||||||
|
set(obj_library ${CMAKE_MATCH_1})
|
||||||
|
get_target_property(obj_sources ${obj_library} SOURCES)
|
||||||
|
list(APPEND all_sources ${obj_sources})
|
||||||
|
else()
|
||||||
|
# usual source
|
||||||
|
list(APPEND all_sources ${source})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# add dependency on header file generation for all inference_engine source files
|
||||||
|
set_source_files_properties(${all_sources} PROPERTIES OBJECT_DEPENDS ${ov_frontends_hpp})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
unset(protobuf_lite_installed CACHE)
|
||||||
|
unset(protobuf_installed CACHE)
|
||||||
|
|
||||||
|
#
|
||||||
|
# ov_add_frontend(NAME <IR|ONNX|...>
|
||||||
|
# FILEDESCRIPTION <description>
|
||||||
|
# [LINKABLE_FRONTEND]
|
||||||
|
# [SKIP_INSTALL]
|
||||||
|
# [PROTOBUF_LITE]
|
||||||
|
# [LINK_LIBRARIES <lib1 lib2 ...>])
|
||||||
|
#
|
||||||
|
macro(ov_add_frontend)
|
||||||
|
set(options LINKABLE_FRONTEND PROTOBUF_LITE SKIP_NCC_STYLE SKIP_INSTALL)
|
||||||
|
set(oneValueArgs NAME FILEDESCRIPTION)
|
||||||
|
set(multiValueArgs LINK_LIBRARIES PROTO_FILES)
|
||||||
|
cmake_parse_arguments(OV_FRONTEND "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
foreach(prop NAME FILEDESCRIPTION)
|
||||||
|
if(NOT DEFINED OV_FRONTEND_${prop})
|
||||||
|
message(FATAL_ERROR "Frontend ${prop} property is not defined")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(TARGET_NAME "${OV_FRONTEND_NAME}${FRONTEND_NAME_SUFFIX}")
|
||||||
|
|
||||||
|
list(APPEND FRONTEND_NAMES ${OV_FRONTEND_NAME})
|
||||||
|
set(FRONTEND_NAMES "${FRONTEND_NAMES}" CACHE INTERNAL "" FORCE)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
set(${TARGET_NAME}_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})
|
||||||
|
|
||||||
|
# Generate protobuf file on build time for each '.proto' file in src/proto
|
||||||
|
file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto)
|
||||||
|
|
||||||
|
foreach(INFILE IN LISTS proto_files)
|
||||||
|
get_filename_component(FILE_DIR ${INFILE} DIRECTORY)
|
||||||
|
get_filename_component(FILE_WE ${INFILE} NAME_WE)
|
||||||
|
set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc)
|
||||||
|
set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h)
|
||||||
|
set(GENERATED_PROTO ${INFILE})
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}"
|
||||||
|
COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto
|
||||||
|
DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO}
|
||||||
|
COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}"
|
||||||
|
VERBATIM
|
||||||
|
COMMAND_EXPAND_LISTS)
|
||||||
|
list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}")
|
||||||
|
list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Disable all warnings for generated code
|
||||||
|
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED TRUE)
|
||||||
|
|
||||||
|
# Create library
|
||||||
|
add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
|
||||||
|
|
||||||
|
if(OV_FRONTEND_LINKABLE_FRONTEND)
|
||||||
|
# create beautiful alias
|
||||||
|
add_library(openvino::frontend::${OV_FRONTEND_NAME} ALIAS ${TARGET_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
# override default function names
|
||||||
|
target_compile_definitions(${TARGET_NAME} PRIVATE
|
||||||
|
"-DGetFrontEndData=GetFrontEndData${OV_FRONTEND_NAME}"
|
||||||
|
"-DGetAPIVersion=GetAPIVersion${OV_FRONTEND_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OV_FRONTEND_SKIP_NCC_STYLE)
|
||||||
|
# frontend's CMakeLists.txt must define its own custom 'ov_ncc_naming_style' step
|
||||||
|
else()
|
||||||
|
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
||||||
|
INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
||||||
|
ADDITIONAL_INCLUDE_DIRECTORIES
|
||||||
|
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(${TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${${TARGET_NAME}_INCLUDE_DIR}>
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
ie_add_vs_version_file(NAME ${TARGET_NAME}
|
||||||
|
FILEDESCRIPTION ${OV_FRONTEND_FILEDESCRIPTION})
|
||||||
|
|
||||||
|
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
||||||
|
|
||||||
|
target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static ${OV_FRONTEND_LINK_LIBRARIES})
|
||||||
|
|
||||||
|
# WA for TF frontends which always requires protobuf (not protobuf-lite)
|
||||||
|
# if TF FE is built in static mode, use protobuf for all other FEs
|
||||||
|
if(FORCE_FRONTENDS_USE_PROTOBUF)
|
||||||
|
set(OV_FRONTEND_PROTOBUF_LITE OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(proto_files)
|
||||||
|
if(OV_FRONTEND_PROTOBUF_LITE)
|
||||||
|
if(NOT protobuf_lite_installed)
|
||||||
|
ov_install_static_lib(${Protobuf_LITE_LIBRARIES} ngraph)
|
||||||
|
set(protobuf_lite_installed ON CACHE INTERNAL "" FORCE)
|
||||||
|
endif()
|
||||||
|
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES})
|
||||||
|
else()
|
||||||
|
if(NOT protobuf_installed)
|
||||||
|
ov_install_static_lib(${Protobuf_LIBRARIES} ngraph)
|
||||||
|
set(protobuf_installed ON CACHE INTERNAL "" FORCE)
|
||||||
|
endif()
|
||||||
|
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# prptobuf generated code emits -Wsuggest-override error
|
||||||
|
if(SUGGEST_OVERRIDE_SUPPORTED)
|
||||||
|
target_compile_options(${TARGET_NAME} PRIVATE -Wno-suggest-override)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}
|
||||||
|
EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS})
|
||||||
|
|
||||||
|
add_dependencies(ov_frontends ${TARGET_NAME})
|
||||||
|
|
||||||
|
if(NOT OV_FRONTEND_SKIP_INSTALL)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
if(OV_FRONTEND_LINKABLE_FRONTEND)
|
||||||
|
set(export_set EXPORT OpenVINOTargets)
|
||||||
|
endif()
|
||||||
|
install(TARGETS ${TARGET_NAME} ${export_set}
|
||||||
|
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph
|
||||||
|
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph
|
||||||
|
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph)
|
||||||
|
else()
|
||||||
|
ov_install_static_lib(${TARGET_NAME} ngraph)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(OV_FRONTEND_LINKABLE_FRONTEND)
|
||||||
|
# install -dev part
|
||||||
|
install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/${OV_FRONTEND_NAME}_frontend
|
||||||
|
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
||||||
|
COMPONENT ngraph_dev
|
||||||
|
FILES_MATCHING PATTERN "*.hpp")
|
||||||
|
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::${OV_FRONTEND_NAME})
|
||||||
|
export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
|
||||||
|
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# skipped frontend has to be installed in static libraries case
|
||||||
|
ov_install_static_lib(${TARGET_NAME} ngraph)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
27
cmake/developer_package/frontends/ov_frontends.hpp.in
Normal file
27
cmake/developer_package/frontends/ov_frontends.hpp.in
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (C) 2018-2021 Intel Corporation
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/frontend.hpp"
|
||||||
|
|
||||||
|
@OV_FRONTEND_DECLARATIONS@
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
using GetFrontEndDataFunc = void*();
|
||||||
|
using GetAPIVersionFunc = ov::frontend::FrontEndVersion();
|
||||||
|
|
||||||
|
struct Value {
|
||||||
|
GetFrontEndDataFunc* m_dataFunc;
|
||||||
|
GetAPIVersionFunc* m_versionFunc;
|
||||||
|
};
|
||||||
|
|
||||||
|
using FrontendsStaticRegistry = std::vector<Value>;
|
||||||
|
|
||||||
|
const FrontendsStaticRegistry getStaticFrontendsRegistry() {
|
||||||
|
@OV_FRONTEND_MAP_DEFINITION@
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
@ -75,8 +75,6 @@ function(ie_add_plugin)
|
|||||||
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE
|
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE
|
||||||
IE_CREATE_EXTENSION=CreateExtensionShared${IE_PLUGIN_DEVICE_NAME})
|
IE_CREATE_EXTENSION=CreateExtensionShared${IE_PLUGIN_DEVICE_NAME})
|
||||||
endif()
|
endif()
|
||||||
# install static plugins
|
|
||||||
ov_install_static_lib(${IE_PLUGIN_NAME} core)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ie_add_vs_version_file(NAME ${IE_PLUGIN_NAME}
|
ie_add_vs_version_file(NAME ${IE_PLUGIN_NAME}
|
||||||
@ -137,13 +135,17 @@ function(ie_add_plugin)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# install rules
|
# install rules
|
||||||
if(NOT IE_PLUGIN_SKIP_INSTALL)
|
if(NOT IE_PLUGIN_SKIP_INSTALL OR NOT BUILD_SHARED_LIBS)
|
||||||
string(TOLOWER "${IE_PLUGIN_DEVICE_NAME}" install_component)
|
string(TOLOWER "${IE_PLUGIN_DEVICE_NAME}" install_component)
|
||||||
ie_cpack_add_component(${install_component} REQUIRED DEPENDS core)
|
ie_cpack_add_component(${install_component} REQUIRED DEPENDS core)
|
||||||
|
|
||||||
install(TARGETS ${IE_PLUGIN_NAME}
|
if(BUILD_SHARED_LIBS)
|
||||||
LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH}
|
install(TARGETS ${IE_PLUGIN_NAME}
|
||||||
COMPONENT ${install_component})
|
LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH}
|
||||||
|
COMPONENT ${install_component})
|
||||||
|
else()
|
||||||
|
ov_install_static_lib(${IE_PLUGIN_NAME} ${install_component})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -244,12 +246,18 @@ macro(ie_register_plugins_dynamic)
|
|||||||
VERBATIM)
|
VERBATIM)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
#
|
||||||
|
# ie_register_plugins()
|
||||||
|
#
|
||||||
macro(ie_register_plugins)
|
macro(ie_register_plugins)
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
ie_register_plugins_dynamic(${ARGN})
|
ie_register_plugins_dynamic(${ARGN})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
#
|
||||||
|
# ie_target_link_plugins(<TARGET_NAME>)
|
||||||
|
#
|
||||||
function(ie_target_link_plugins TARGET_NAME)
|
function(ie_target_link_plugins TARGET_NAME)
|
||||||
if(BUILD_SHARED_LIBS)
|
if(BUILD_SHARED_LIBS)
|
||||||
return()
|
return()
|
||||||
@ -332,8 +340,8 @@ function(ie_generate_plugins_hpp)
|
|||||||
|
|
||||||
# for some reason dependency on source files does not work
|
# for some reason dependency on source files does not work
|
||||||
# so, we have to use explicit target and make it dependency for inference_engine
|
# so, we have to use explicit target and make it dependency for inference_engine
|
||||||
add_custom_target(ie_generate_hpp DEPENDS ${ie_plugins_hpp})
|
add_custom_target(_ie_plugins_hpp DEPENDS ${ie_plugins_hpp})
|
||||||
add_dependencies(inference_engine ie_generate_hpp)
|
add_dependencies(inference_engine _ie_plugins_hpp)
|
||||||
|
|
||||||
# add dependency for object files
|
# add dependency for object files
|
||||||
get_target_property(sources inference_engine SOURCES)
|
get_target_property(sources inference_engine SOURCES)
|
||||||
|
@ -161,13 +161,19 @@ ie_dependent_option(NGRAPH_PDPD_FRONTEND_ENABLE "Enable PaddlePaddle FrontEnd" O
|
|||||||
ie_option(NGRAPH_IR_FRONTEND_ENABLE "Enable IR FrontEnd" ON)
|
ie_option(NGRAPH_IR_FRONTEND_ENABLE "Enable IR FrontEnd" ON)
|
||||||
ie_dependent_option(NGRAPH_TF_FRONTEND_ENABLE "Enable TensorFlow FrontEnd" ON "protoc_available" OFF)
|
ie_dependent_option(NGRAPH_TF_FRONTEND_ENABLE "Enable TensorFlow FrontEnd" ON "protoc_available" OFF)
|
||||||
ie_dependent_option(NGRAPH_USE_SYSTEM_PROTOBUF "Use system protobuf" OFF
|
ie_dependent_option(NGRAPH_USE_SYSTEM_PROTOBUF "Use system protobuf" OFF
|
||||||
"NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_TF_FRONTEND_ENABLE" OFF)
|
"NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_TF_FRONTEND_ENABLE;BUILD_SHARED_LIBS" OFF)
|
||||||
ie_dependent_option(NGRAPH_UNIT_TEST_ENABLE "Enables ngraph unit tests" ON "ENABLE_TESTS;NOT ANDROID" OFF)
|
ie_dependent_option(NGRAPH_UNIT_TEST_ENABLE "Enables ngraph unit tests" ON "ENABLE_TESTS;NOT ANDROID" OFF)
|
||||||
ie_dependent_option(NGRAPH_UNIT_TEST_BACKENDS_ENABLE "Control the building of unit tests using backends" ON
|
ie_dependent_option(NGRAPH_UNIT_TEST_BACKENDS_ENABLE "Control the building of unit tests using backends" ON
|
||||||
"NGRAPH_UNIT_TEST_ENABLE" OFF)
|
"NGRAPH_UNIT_TEST_ENABLE" OFF)
|
||||||
ie_option(OPENVINO_DEBUG_ENABLE "Enable output for OPENVINO_DEBUG statements" OFF)
|
ie_option(OPENVINO_DEBUG_ENABLE "Enable output for OPENVINO_DEBUG statements" OFF)
|
||||||
ie_option(ENABLE_REQUIREMENTS_INSTALL "Dynamic dependencies install" ON)
|
ie_option(ENABLE_REQUIREMENTS_INSTALL "Dynamic dependencies install" ON)
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS AND NGRAPH_TF_FRONTEND_ENABLE)
|
||||||
|
set(FORCE_FRONTENDS_USE_PROTOBUF ON)
|
||||||
|
else()
|
||||||
|
set(FORCE_FRONTENDS_USE_PROTOBUF OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
# WA for ngraph python build on Windows debug
|
# WA for ngraph python build on Windows debug
|
||||||
list(REMOVE_ITEM IE_OPTIONS NGRAPH_UNIT_TEST_ENABLE NGRAPH_UNIT_TEST_BACKENDS_ENABLE)
|
list(REMOVE_ITEM IE_OPTIONS NGRAPH_UNIT_TEST_ENABLE NGRAPH_UNIT_TEST_BACKENDS_ENABLE)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IE_BUILD_POSTFIX // should be already defined by cmake
|
#ifndef IE_BUILD_POSTFIX // should be already defined by cmake
|
||||||
#define IE_BUILD_POSTFIX ""
|
# error "IE_BUILD_POSTFIX is not defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static std::string get_extension_path() {
|
static std::string get_extension_path() {
|
||||||
@ -69,6 +69,12 @@ TEST_F(CustomOpsSerializationTest, CustomOpUser_MO) {
|
|||||||
|
|
||||||
#ifdef NGRAPH_ONNX_FRONTEND_ENABLE
|
#ifdef NGRAPH_ONNX_FRONTEND_ENABLE
|
||||||
|
|
||||||
|
// This test will not work because template_extension for ONNX registers
|
||||||
|
// extension via `register_operator` function which registers operator
|
||||||
|
// is template_extension's copy of onnx_importer. So, extensions as
|
||||||
|
// a shared library for ONNX don't make sence in static OpenVINO build
|
||||||
|
#ifndef OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) {
|
TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) {
|
||||||
const std::string model = CommonTestUtils::getModelFromTestModelZoo(
|
const std::string model = CommonTestUtils::getModelFromTestModelZoo(
|
||||||
IR_SERIALIZATION_MODELS_PATH "custom_op.onnx");
|
IR_SERIALIZATION_MODELS_PATH "custom_op.onnx");
|
||||||
@ -90,7 +96,9 @@ TEST_F(CustomOpsSerializationTest, CustomOpUser_ONNXImporter) {
|
|||||||
ASSERT_TRUE(success) << message;
|
ASSERT_TRUE(success) << message;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
|
#endif // NGRAPH_ONNX_FRONTEND_ENABLE
|
||||||
|
|
||||||
TEST_F(CustomOpsSerializationTest, CustomOpTransformation) {
|
TEST_F(CustomOpsSerializationTest, CustomOpTransformation) {
|
||||||
const std::string model = CommonTestUtils::getModelFromTestModelZoo(
|
const std::string model = CommonTestUtils::getModelFromTestModelZoo(
|
||||||
|
@ -2,23 +2,23 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
set(FRONTEND_INSTALL_INCLUDE "runtime/include/ngraph/frontend")
|
|
||||||
set(FRONTEND_NAME_SUFFIX "_ov_frontend")
|
|
||||||
|
|
||||||
add_subdirectory(common)
|
add_subdirectory(common)
|
||||||
|
|
||||||
if (NGRAPH_ONNX_FRONTEND_ENABLE)
|
if(NGRAPH_ONNX_FRONTEND_ENABLE)
|
||||||
add_subdirectory(onnx)
|
add_subdirectory(onnx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NGRAPH_PDPD_FRONTEND_ENABLE)
|
if(NGRAPH_PDPD_FRONTEND_ENABLE)
|
||||||
add_subdirectory(paddlepaddle)
|
add_subdirectory(paddlepaddle)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NGRAPH_IR_FRONTEND_ENABLE)
|
if(NGRAPH_IR_FRONTEND_ENABLE)
|
||||||
add_subdirectory(ir)
|
add_subdirectory(ir)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NGRAPH_TF_FRONTEND_ENABLE)
|
if(NGRAPH_TF_FRONTEND_ENABLE)
|
||||||
add_subdirectory(tensorflow)
|
add_subdirectory(tensorflow)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# used for static build
|
||||||
|
ov_generate_frontends_hpp()
|
||||||
|
@ -28,15 +28,19 @@ add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HE
|
|||||||
add_library(ngraph::${TARGET_NAME} ALIAS ${TARGET_NAME})
|
add_library(ngraph::${TARGET_NAME} ALIAS ${TARGET_NAME})
|
||||||
add_library(openvino::frontend::common ALIAS ${TARGET_NAME})
|
add_library(openvino::frontend::common ALIAS ${TARGET_NAME})
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC
|
target_include_directories(${TARGET_NAME}
|
||||||
|
PUBLIC
|
||||||
$<BUILD_INTERFACE:${FRONTEND_INCLUDE_DIR}>
|
$<BUILD_INTERFACE:${FRONTEND_INCLUDE_DIR}>
|
||||||
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>)
|
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>
|
||||||
|
PRIVATE
|
||||||
|
# for ov_frontends.hpp in static build
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/src")
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS} openvino::util PUBLIC ngraph)
|
target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS} openvino::util PUBLIC ngraph)
|
||||||
set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin_loader.cpp APPEND PROPERTY COMPILE_DEFINITIONS
|
set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/plugin_loader.cpp APPEND PROPERTY COMPILE_DEFINITIONS
|
||||||
FRONTEND_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"
|
FRONTEND_LIB_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}"
|
||||||
FRONTEND_LIB_SUFFIX="${FRONTEND_NAME_SUFFIX}${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
FRONTEND_LIB_SUFFIX="${FRONTEND_NAME_SUFFIX}${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||||
)
|
|
||||||
|
|
||||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
||||||
|
|
||||||
@ -76,7 +80,7 @@ install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/common
|
|||||||
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
||||||
COMPONENT ngraph_dev
|
COMPONENT ngraph_dev
|
||||||
FILES_MATCHING PATTERN "*.hpp")
|
FILES_MATCHING PATTERN "*.hpp")
|
||||||
|
|
||||||
install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/
|
install(DIRECTORY ${FRONTEND_INCLUDE_DIR}/
|
||||||
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
||||||
COMPONENT ngraph_dev
|
COMPONENT ngraph_dev
|
||||||
|
@ -26,6 +26,26 @@
|
|||||||
using namespace ov;
|
using namespace ov;
|
||||||
using namespace ov::frontend;
|
using namespace ov::frontend;
|
||||||
|
|
||||||
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
|
# include "ov_frontends.hpp"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
std::vector<PluginData> load_static_plugins() {
|
||||||
|
std::vector<PluginData> res;
|
||||||
|
for (const auto& frontend : getStaticFrontendsRegistry()) {
|
||||||
|
PluginHandle fakeGuard([]() {});
|
||||||
|
std::unique_ptr<FrontEndPluginInfo> fact{reinterpret_cast<FrontEndPluginInfo*>(frontend.m_dataFunc())};
|
||||||
|
res.emplace_back(std::move(fakeGuard), std::move(*fact));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# define DLOPEN(file_str) LoadLibrary(TEXT(file_str.c_str()))
|
# define DLOPEN(file_str) LoadLibrary(TEXT(file_str.c_str()))
|
||||||
# define DLSYM(obj, func) GetProcAddress(obj, func)
|
# define DLSYM(obj, func) GetProcAddress(obj, func)
|
||||||
@ -43,8 +63,8 @@ static std::vector<std::string> list_files(const std::string& path) {
|
|||||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||||
std::vector<std::string> res;
|
std::vector<std::string> res;
|
||||||
try {
|
try {
|
||||||
auto prefix = std::string(FRONTEND_LIB_PREFIX);
|
const auto prefix = std::string(FRONTEND_LIB_PREFIX);
|
||||||
auto suffix = std::string(FRONTEND_LIB_SUFFIX);
|
const auto suffix = std::string(FRONTEND_LIB_SUFFIX);
|
||||||
ov::util::iterate_files(
|
ov::util::iterate_files(
|
||||||
path,
|
path,
|
||||||
[&res, &prefix, &suffix](const std::string& file_path, bool is_dir) {
|
[&res, &prefix, &suffix](const std::string& file_path, bool is_dir) {
|
||||||
@ -55,12 +75,7 @@ static std::vector<std::string> list_files(const std::string& path) {
|
|||||||
res.push_back(file_path);
|
res.push_back(file_path);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// ilavreno: this is current solution for static runtime
|
false,
|
||||||
// since frontends are still dynamic libraries and they are located in
|
|
||||||
// a different folder with compare to frontend_common one (in ./lib)
|
|
||||||
// we are trying to use recursive search. Can be reverted back in future
|
|
||||||
// once the frontends are static too.
|
|
||||||
true,
|
|
||||||
true);
|
true);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// Ignore exceptions
|
// Ignore exceptions
|
||||||
@ -69,10 +84,9 @@ static std::vector<std::string> list_files(const std::string& path) {
|
|||||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<PluginData> ov::frontend::load_plugins(const std::string& dir_name) {
|
static std::vector<PluginData> load_dynamic_plugins(const std::string& dir_name) {
|
||||||
auto files = list_files(dir_name);
|
|
||||||
std::vector<PluginData> res;
|
std::vector<PluginData> res;
|
||||||
for (const auto& file : files) {
|
for (const auto& file : list_files(dir_name)) {
|
||||||
auto shared_object = DLOPEN(file);
|
auto shared_object = DLOPEN(file);
|
||||||
if (!shared_object) {
|
if (!shared_object) {
|
||||||
NGRAPH_DEBUG << "Error loading FrontEnd " << file << " " << DLERROR() << std::endl;
|
NGRAPH_DEBUG << "Error loading FrontEnd " << file << " " << DLERROR() << std::endl;
|
||||||
@ -105,3 +119,19 @@ std::vector<PluginData> ov::frontend::load_plugins(const std::string& dir_name)
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<PluginData> ov::frontend::load_plugins(const std::string& dir_name) {
|
||||||
|
std::vector<PluginData> res;
|
||||||
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
|
res = load_static_plugins();
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
for (auto&& fe : load_dynamic_plugins(dir_name)) {
|
||||||
|
// if frontend is registered as static one, skip dynamic version
|
||||||
|
if (std::find_if(res.begin(), res.end(), [&fe](const PluginData& pd) {
|
||||||
|
return pd.m_plugin_info.m_name == fe.m_plugin_info.m_name;
|
||||||
|
}) == res.end()) {
|
||||||
|
res.emplace_back(std::move(fe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
@ -7,10 +7,8 @@
|
|||||||
#include <manager.hpp>
|
#include <manager.hpp>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
static const char FileSeparator[] = "\\";
|
|
||||||
static const char PathSeparator[] = ";";
|
static const char PathSeparator[] = ";";
|
||||||
#else
|
#else
|
||||||
static const char FileSeparator[] = "/";
|
|
||||||
static const char PathSeparator[] = ":";
|
static const char PathSeparator[] = ":";
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
@ -42,6 +40,7 @@ private:
|
|||||||
|
|
||||||
struct PluginData {
|
struct PluginData {
|
||||||
PluginData(PluginHandle&& h, FrontEndPluginInfo&& info) : m_lib_handle(std::move(h)), m_plugin_info(info) {}
|
PluginData(PluginHandle&& h, FrontEndPluginInfo&& info) : m_lib_handle(std::move(h)), m_plugin_info(info) {}
|
||||||
|
PluginData(PluginData&& pd) : m_lib_handle(std::move(pd.m_lib_handle)), m_plugin_info(pd.m_plugin_info) {}
|
||||||
|
|
||||||
PluginHandle m_lib_handle; // Shall be destroyed when plugin is not needed anymore to free memory
|
PluginHandle m_lib_handle; // Shall be destroyed when plugin is not needed anymore to free memory
|
||||||
FrontEndPluginInfo m_plugin_info;
|
FrontEndPluginInfo m_plugin_info;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
|
|
||||||
#include "common/frontend_exceptions.hpp"
|
#include "common/frontend_exceptions.hpp"
|
||||||
|
#include "openvino/util/file_util.hpp"
|
||||||
#include "plugin_loader.hpp"
|
#include "plugin_loader.hpp"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -25,18 +26,6 @@
|
|||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
|
||||||
std::string get_path_name(const std::string& s) {
|
|
||||||
size_t i = s.rfind(FileSeparator, s.length());
|
|
||||||
if (i != std::string::npos) {
|
|
||||||
return (s.substr(0, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
static std::string _get_frontend_library_path() {
|
static std::string _get_frontend_library_path() {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CHAR ie_library_path[MAX_PATH];
|
CHAR ie_library_path[MAX_PATH];
|
||||||
@ -47,11 +36,11 @@ static std::string _get_frontend_library_path() {
|
|||||||
FRONT_END_INITIALIZATION_CHECK(false, "GetModuleHandle returned ", GetLastError());
|
FRONT_END_INITIALIZATION_CHECK(false, "GetModuleHandle returned ", GetLastError());
|
||||||
}
|
}
|
||||||
GetModuleFileNameA(hm, (LPSTR)ie_library_path, sizeof(ie_library_path));
|
GetModuleFileNameA(hm, (LPSTR)ie_library_path, sizeof(ie_library_path));
|
||||||
return get_path_name(std::string(ie_library_path));
|
return ov::util::get_directory(std::string(ie_library_path));
|
||||||
#elif defined(__APPLE__) || defined(__linux__)
|
#elif defined(__APPLE__) || defined(__linux__)
|
||||||
Dl_info info;
|
Dl_info info;
|
||||||
dladdr(reinterpret_cast<void*>(ov::frontend::get_frontend_library_path), &info);
|
dladdr(reinterpret_cast<void*>(ov::frontend::get_frontend_library_path), &info);
|
||||||
return get_path_name(std::string(info.dli_fname)).c_str();
|
return ov::util::get_directory(std::string(info.dli_fname)).c_str();
|
||||||
#else
|
#else
|
||||||
# error "Unsupported OS"
|
# error "Unsupported OS"
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
@ -2,55 +2,12 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
set(TARGET_NAME "ir_ov_frontend")
|
ov_add_frontend(NAME ir
|
||||||
|
FILEDESCRIPTION "FrontEnd to load OpenVINO IR file format"
|
||||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
LINK_LIBRARIES inference_engine_transformations pugixml::static
|
||||||
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
# TODO: remove dependencies below in CVS-69781
|
||||||
file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
inference_engine inference_engine_plugin_api)
|
||||||
|
|
||||||
set(${TARGET_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Add include path to so_extension.hpp
|
# Add include path to so_extension.hpp
|
||||||
set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/frontend.cpp
|
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/frontend.cpp
|
||||||
APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/core/src/")
|
PROPERTIES INCLUDE_DIRECTORIES "${OpenVINO_SOURCE_DIR}/src/core/src/")
|
||||||
|
|
||||||
# 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})
|
|
||||||
|
|
||||||
# Create library
|
|
||||||
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
|
|
||||||
|
|
||||||
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
|
||||||
INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
||||||
ADDITIONAL_INCLUDE_DIRECTORIES
|
|
||||||
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME}
|
|
||||||
PUBLIC
|
|
||||||
$<BUILD_INTERFACE:${${TARGET_NAME}_INCLUDE_DIR}>
|
|
||||||
PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
ie_add_vs_version_file(NAME ${TARGET_NAME}
|
|
||||||
FILEDESCRIPTION "FrontEnd to load and convert OpenVINO IR file format")
|
|
||||||
|
|
||||||
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static
|
|
||||||
ngraph::builder inference_engine_transformations
|
|
||||||
inference_engine pugixml::static inference_engine_plugin_api)
|
|
||||||
|
|
||||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}
|
|
||||||
EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
|
|
||||||
install(TARGETS ${TARGET_NAME}
|
|
||||||
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph
|
|
||||||
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph
|
|
||||||
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph)
|
|
||||||
|
@ -6,12 +6,18 @@
|
|||||||
|
|
||||||
#include <openvino/core/visibility.hpp>
|
#include <openvino/core/visibility.hpp>
|
||||||
|
|
||||||
// Defined if we are building the plugin DLL (instead of using it)
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
#ifdef ir_ov_frontend_EXPORTS
|
# define IR_API
|
||||||
# define IR_API OPENVINO_CORE_EXPORTS
|
# define IR_C_API
|
||||||
#else
|
#else
|
||||||
# define IR_API OPENVINO_CORE_IMPORTS
|
# ifdef ir_ov_frontend_EXPORTS
|
||||||
#endif // ir_ov_frontend_EXPORTS
|
# define IR_API OPENVINO_CORE_EXPORTS
|
||||||
|
# define IR_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
|
||||||
|
# else
|
||||||
|
# define IR_API OPENVINO_CORE_IMPORTS
|
||||||
|
# define IR_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS
|
||||||
|
# endif // ir_ov_frontend_EXPORTS
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
#define IR_ASSERT(ex, msg) \
|
#define IR_ASSERT(ex, msg) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -236,11 +236,11 @@ std::string FrontEndIR::get_name() const {
|
|||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace ov
|
} // namespace ov
|
||||||
|
|
||||||
extern "C" IR_API ov::frontend::FrontEndVersion GetAPIVersion() {
|
IR_C_API ov::frontend::FrontEndVersion GetAPIVersion() {
|
||||||
return OV_FRONTEND_API_VERSION;
|
return OV_FRONTEND_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" IR_API void* GetFrontEndData() {
|
IR_C_API void* GetFrontEndData() {
|
||||||
frontend::FrontEndPluginInfo* res = new frontend::FrontEndPluginInfo();
|
frontend::FrontEndPluginInfo* res = new frontend::FrontEndPluginInfo();
|
||||||
res->m_name = "ir";
|
res->m_name = "ir";
|
||||||
res->m_creator = []() {
|
res->m_creator = []() {
|
||||||
|
@ -2,67 +2,24 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
set(TARGET_NAME onnx_ov_frontend)
|
ov_add_frontend(NAME onnx
|
||||||
|
LINKABLE_FRONTEND
|
||||||
|
PROTOBUF_LITE
|
||||||
|
SKIP_NCC_STYLE
|
||||||
|
FILEDESCRIPTION "FrontEnd to load and convert ONNX file format"
|
||||||
|
LINK_LIBRARIES ngraph::builder openvino::util onnx_common inference_engine_transformations)
|
||||||
|
|
||||||
set(ONNX_OPSET_VERSION 13 CACHE INTERNAL "Supported version of ONNX operator set")
|
set(ONNX_OPSET_VERSION 13 CACHE INTERNAL "Supported version of ONNX operator set")
|
||||||
set(ONNX_FRONTEND_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
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 ${ONNX_FRONTEND_INCLUDE_DIR}/*.hpp)
|
|
||||||
|
|
||||||
# Remove disabled ops
|
|
||||||
list(REMOVE_ITEM LIBRARY_SRC
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/op/quant_conv.cpp
|
|
||||||
)
|
|
||||||
list(REMOVE_ITEM LIBRARY_HEADERS
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/op/quant_conv.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})
|
|
||||||
|
|
||||||
# Create library
|
|
||||||
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS})
|
|
||||||
add_library(openvino::frontend::onnx ALIAS ${TARGET_NAME})
|
|
||||||
|
|
||||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
|
||||||
|
|
||||||
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
|
||||||
INCLUDE_DIRECTORY "${ONNX_FRONTEND_INCLUDE_DIR}"
|
|
||||||
DEFINITIONS
|
|
||||||
$<TARGET_PROPERTY:onnx,INTERFACE_COMPILE_DEFINITIONS>
|
|
||||||
ADDITIONAL_INCLUDE_DIRECTORIES
|
|
||||||
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
|
||||||
|
|
||||||
ie_add_vs_version_file(NAME ${TARGET_NAME}
|
|
||||||
FILEDESCRIPTION "nGraph ONNX frontend library")
|
|
||||||
|
|
||||||
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PUBLIC ngraph PRIVATE frontend_common ngraph::builder openvino::util onnx_common inference_engine_transformations)
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ONNX_FRONTEND_INCLUDE_DIR}>
|
|
||||||
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>)
|
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
||||||
|
|
||||||
target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION})
|
target_compile_definitions(${TARGET_NAME} PRIVATE ONNX_OPSET_VERSION=${ONNX_OPSET_VERSION})
|
||||||
|
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::onnx)
|
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
||||||
install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets
|
INCLUDE_DIRECTORY "${${TARGET_NAME}_INCLUDE_DIR}"
|
||||||
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph
|
DEFINITIONS
|
||||||
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph
|
$<TARGET_PROPERTY:onnx,INTERFACE_COMPILE_DEFINITIONS>
|
||||||
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph)
|
ADDITIONAL_INCLUDE_DIRECTORIES
|
||||||
|
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||||
|
|
||||||
install(DIRECTORY ${ONNX_FRONTEND_INCLUDE_DIR}/onnx_frontend
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/onnx_import
|
||||||
${ONNX_FRONTEND_INCLUDE_DIR}/onnx_import
|
|
||||||
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
||||||
COMPONENT ngraph_dev
|
COMPONENT ngraph_dev
|
||||||
FILES_MATCHING PATTERN "*.hpp")
|
FILES_MATCHING PATTERN "*.hpp")
|
||||||
|
|
||||||
export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
|
|
||||||
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
|
||||||
|
@ -6,11 +6,18 @@
|
|||||||
|
|
||||||
#include <common/frontend.hpp>
|
#include <common/frontend.hpp>
|
||||||
|
|
||||||
#ifdef onnx_ov_frontend_EXPORTS
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
# define ONNX_FRONTEND_API OPENVINO_CORE_EXPORTS
|
# define ONNX_FRONTEND_API
|
||||||
|
# define ONNX_FRONTEND_C_API
|
||||||
#else
|
#else
|
||||||
# define ONNX_FRONTEND_API OPENVINO_CORE_IMPORTS
|
# ifdef onnx_ov_frontend_EXPORTS
|
||||||
#endif
|
# define ONNX_FRONTEND_API OPENVINO_CORE_EXPORTS
|
||||||
|
# define ONNX_FRONTEND_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
|
||||||
|
# else
|
||||||
|
# define ONNX_FRONTEND_API OPENVINO_CORE_IMPORTS
|
||||||
|
# define ONNX_FRONTEND_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS
|
||||||
|
# endif // onnx_ov_frontend_EXPORTS
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
namespace ov {
|
namespace ov {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
@ -4,8 +4,12 @@
|
|||||||
|
|
||||||
#include "ngraph/visibility.hpp"
|
#include "ngraph/visibility.hpp"
|
||||||
|
|
||||||
#ifdef onnx_ov_frontend_EXPORTS
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
# define ONNX_IMPORTER_API OPENVINO_CORE_EXPORTS
|
# define ONNX_IMPORTER_API
|
||||||
#else
|
#else
|
||||||
# define ONNX_IMPORTER_API OPENVINO_CORE_IMPORTS
|
# ifdef onnx_ov_frontend_EXPORTS
|
||||||
#endif
|
# define ONNX_IMPORTER_API OPENVINO_CORE_EXPORTS
|
||||||
|
# else
|
||||||
|
# define ONNX_IMPORTER_API OPENVINO_CORE_IMPORTS
|
||||||
|
# endif // onnx_ov_frontend_EXPORTS
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
@ -71,7 +71,7 @@ void Model::enable_opset_domain(const std::string& domain) {
|
|||||||
if (m_opset.find(domain) == std::end(m_opset)) {
|
if (m_opset.find(domain) == std::end(m_opset)) {
|
||||||
OperatorSet opset{OperatorsBridge::get_operator_set(domain)};
|
OperatorSet opset{OperatorsBridge::get_operator_set(domain)};
|
||||||
if (opset.empty()) {
|
if (opset.empty()) {
|
||||||
NGRAPH_WARN << "Couldn't enable domain: " << domain << " since it hasn't any registered operators.";
|
NGRAPH_WARN << "Couldn't enable domain: " << domain << " since it does not have any registered operators.";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@ using VariantString = VariantWrapper<std::string>;
|
|||||||
using VariantWString = VariantWrapper<std::wstring>;
|
using VariantWString = VariantWrapper<std::wstring>;
|
||||||
using VariantIstreamPtr = VariantWrapper<std::istream*>;
|
using VariantIstreamPtr = VariantWrapper<std::istream*>;
|
||||||
|
|
||||||
extern "C" ONNX_FRONTEND_API FrontEndVersion GetAPIVersion() {
|
ONNX_FRONTEND_C_API FrontEndVersion GetAPIVersion() {
|
||||||
return OV_FRONTEND_API_VERSION;
|
return OV_FRONTEND_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" ONNX_FRONTEND_API void* GetFrontEndData() {
|
ONNX_FRONTEND_C_API void* GetFrontEndData() {
|
||||||
FrontEndPluginInfo* res = new FrontEndPluginInfo();
|
FrontEndPluginInfo* res = new FrontEndPluginInfo();
|
||||||
res->m_name = "onnx";
|
res->m_name = "onnx";
|
||||||
res->m_creator = []() {
|
res->m_creator = []() {
|
||||||
|
@ -2,22 +2,25 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
// Disabled in CMakeList
|
// Disabled in CMakeLists.txt
|
||||||
// Update to higher opset required
|
// Update to higher opset is required
|
||||||
|
|
||||||
#include <cstddef>
|
#if 0
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "default_opset.hpp"
|
# include "op/quant_conv.hpp"
|
||||||
#include "exceptions.hpp"
|
|
||||||
#include "ngraph/builder/quantization/quantized_linear_convolution.hpp"
|
# include <cstddef>
|
||||||
#include "ngraph/coordinate_diff.hpp"
|
# include <memory>
|
||||||
#include "ngraph/frontend/onnx_import/utils/convpool.hpp"
|
# include <vector>
|
||||||
#include "ngraph/op/util/attr_types.hpp"
|
|
||||||
#include "ngraph/opsets/opset0.hpp"
|
# include "default_opset.hpp"
|
||||||
#include "ngraph/strides.hpp"
|
# include "exceptions.hpp"
|
||||||
#include "op/quant_conv.hpp"
|
# include "ngraph/builder/quantization/quantized_linear_convolution.hpp"
|
||||||
|
# include "ngraph/coordinate_diff.hpp"
|
||||||
|
# include "ngraph/frontend/onnx_import/utils/convpool.hpp"
|
||||||
|
# include "ngraph/op/util/attr_types.hpp"
|
||||||
|
# include "ngraph/opsets/opset0.hpp"
|
||||||
|
# include "ngraph/strides.hpp"
|
||||||
|
|
||||||
namespace ngraph
|
namespace ngraph
|
||||||
{
|
{
|
||||||
@ -269,3 +272,5 @@ namespace ngraph
|
|||||||
} // namespace onnx_import
|
} // namespace onnx_import
|
||||||
|
|
||||||
} // namespace ngraph
|
} // namespace ngraph
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -10,26 +10,22 @@
|
|||||||
#include "ngraph/node.hpp"
|
#include "ngraph/node.hpp"
|
||||||
#include "onnx_import/core/node.hpp"
|
#include "onnx_import/core/node.hpp"
|
||||||
|
|
||||||
namespace ngraph
|
namespace ngraph {
|
||||||
{
|
namespace onnx_import {
|
||||||
namespace onnx_import
|
namespace op {
|
||||||
{
|
namespace set_1 {
|
||||||
namespace op
|
/// \brief Performs ONNX Quant Conv operation.
|
||||||
{
|
///
|
||||||
namespace set_1
|
/// \param node The ONNX node object representing this operation.
|
||||||
{
|
///
|
||||||
/// \brief Performs ONNX Quant Conv operation.
|
/// \return The vector containing Ngraph nodes producing output of ONNX quantizied
|
||||||
///
|
/// convolution operation.
|
||||||
/// \param node The ONNX node object representing this operation.
|
OutputVector quant_conv(const Node& node);
|
||||||
///
|
|
||||||
/// \return The vector containing Ngraph nodes producing output of ONNX quantizied
|
|
||||||
/// convolution operation.
|
|
||||||
OutputVector quant_conv(const Node& node);
|
|
||||||
|
|
||||||
} // namespace set_1
|
} // namespace set_1
|
||||||
|
|
||||||
} // namespace op
|
} // namespace op
|
||||||
|
|
||||||
} // namespace onnx_import
|
} // namespace onnx_import
|
||||||
|
|
||||||
} // namespace ngraph
|
} // namespace ngraph
|
||||||
|
@ -26,7 +26,14 @@ target_include_directories(${TARGET_NAME} PUBLIC $<BUILD_INTERFACE:${ONNX_COMMON
|
|||||||
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>)
|
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE ngraph)
|
target_link_libraries(${TARGET_NAME} PRIVATE ngraph)
|
||||||
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LITE_LIBRARIES})
|
|
||||||
|
if(ONNX_USE_LITE_PROTO)
|
||||||
|
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LITE_LIBRARIES})
|
||||||
|
else()
|
||||||
|
link_system_libraries(${TARGET_NAME} PUBLIC onnx_proto onnx ${Protobuf_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_COMMON_SRC_DIR})
|
target_include_directories(${TARGET_NAME} PRIVATE ${ONNX_COMMON_SRC_DIR})
|
||||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME})
|
||||||
|
|
||||||
|
ov_install_static_lib(${TARGET_NAME} ngraph)
|
||||||
|
@ -2,96 +2,8 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
set(TARGET_NAME "paddlepaddle_ov_frontend")
|
ov_add_frontend(NAME paddlepaddle
|
||||||
|
LINKABLE_FRONTEND
|
||||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
PROTOBUF_LITE
|
||||||
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
FILEDESCRIPTION "FrontEnd to load and convert PaddlePaddle file format"
|
||||||
file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
LINK_LIBRARIES ngraph::builder)
|
||||||
|
|
||||||
set(${TARGET_NAME}_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})
|
|
||||||
|
|
||||||
set(PROTO_SRCS)
|
|
||||||
set(PROTO_HDRS)
|
|
||||||
|
|
||||||
# Generate protobuf file on build time for each '.proto' file in src/proto
|
|
||||||
file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto)
|
|
||||||
|
|
||||||
foreach(INFILE ${proto_files})
|
|
||||||
get_filename_component(FILE_DIR ${INFILE} DIRECTORY)
|
|
||||||
get_filename_component(FILE_WE ${INFILE} NAME_WE)
|
|
||||||
set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc)
|
|
||||||
set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h)
|
|
||||||
set(GENERATED_PROTO ${INFILE})
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}"
|
|
||||||
COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto
|
|
||||||
DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO}
|
|
||||||
COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}"
|
|
||||||
VERBATIM
|
|
||||||
COMMAND_EXPAND_LISTS)
|
|
||||||
list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}")
|
|
||||||
list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_custom_target(${TARGET_NAME}_proto DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
|
|
||||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE)
|
|
||||||
|
|
||||||
# Disable all warnings for generated code
|
|
||||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w)
|
|
||||||
|
|
||||||
# Create library
|
|
||||||
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
add_library(openvino::frontend::paddlepaddle ALIAS ${TARGET_NAME})
|
|
||||||
|
|
||||||
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_proto)
|
|
||||||
|
|
||||||
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
|
||||||
INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
||||||
ADDITIONAL_INCLUDE_DIRECTORIES
|
|
||||||
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME}
|
|
||||||
PUBLIC
|
|
||||||
$<BUILD_INTERFACE:${${TARGET_NAME}_INCLUDE_DIR}>
|
|
||||||
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>
|
|
||||||
PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${Protobuf_INCLUDE_DIRS}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
ie_add_vs_version_file(NAME ${TARGET_NAME}
|
|
||||||
FILEDESCRIPTION "FrontEnd to load and convert PaddlePaddle file format")
|
|
||||||
|
|
||||||
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
|
||||||
|
|
||||||
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES})
|
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static
|
|
||||||
PRIVATE inference_engine_transformations)
|
|
||||||
|
|
||||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}
|
|
||||||
EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
|
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::paddlepaddle)
|
|
||||||
install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets
|
|
||||||
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph
|
|
||||||
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph
|
|
||||||
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph)
|
|
||||||
|
|
||||||
install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/paddlepaddle_frontend
|
|
||||||
DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
|
||||||
COMPONENT ngraph_dev
|
|
||||||
FILES_MATCHING PATTERN "*.hpp")
|
|
||||||
|
|
||||||
export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
|
|
||||||
APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
|
||||||
|
@ -6,12 +6,18 @@
|
|||||||
|
|
||||||
#include <manager.hpp>
|
#include <manager.hpp>
|
||||||
|
|
||||||
// Defined if we are building the plugin DLL (instead of using it)
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
#ifdef paddlepaddle_ov_frontend_EXPORTS
|
# define PDPD_API
|
||||||
# define PDPD_API OPENVINO_CORE_EXPORTS
|
# define PDPD_C_API
|
||||||
#else
|
#else
|
||||||
# define PDPD_API OPENVINO_CORE_IMPORTS
|
# ifdef paddlepaddle_ov_frontend_EXPORTS
|
||||||
#endif // paddlepaddle_ov_frontend_EXPORTS
|
# define PDPD_API OPENVINO_CORE_EXPORTS
|
||||||
|
# define PDPD_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
|
||||||
|
# else
|
||||||
|
# define PDPD_API OPENVINO_CORE_IMPORTS
|
||||||
|
# define PDPD_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS
|
||||||
|
# endif // paddlepaddle_ov_frontend_EXPORTS
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
|
||||||
#define PDPD_ASSERT(ex, msg) \
|
#define PDPD_ASSERT(ex, msg) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -329,11 +329,11 @@ std::string FrontEndPDPD::get_name() const {
|
|||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace ov
|
} // namespace ov
|
||||||
|
|
||||||
extern "C" PDPD_API FrontEndVersion GetAPIVersion() {
|
PDPD_C_API FrontEndVersion GetAPIVersion() {
|
||||||
return OV_FRONTEND_API_VERSION;
|
return OV_FRONTEND_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" PDPD_API void* GetFrontEndData() {
|
PDPD_C_API void* GetFrontEndData() {
|
||||||
FrontEndPluginInfo* res = new FrontEndPluginInfo();
|
FrontEndPluginInfo* res = new FrontEndPluginInfo();
|
||||||
res->m_name = "paddle";
|
res->m_name = "paddle";
|
||||||
res->m_creator = []() {
|
res->m_creator = []() {
|
||||||
|
@ -2,103 +2,14 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
set(TARGET_NAME "tensorflow_ov_frontend")
|
ov_add_frontend(NAME tensorflow
|
||||||
|
LINKABLE_FRONTEND
|
||||||
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
SKIP_INSTALL
|
||||||
file(GLOB_RECURSE LIBRARY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp)
|
FILEDESCRIPTION "FrontEnd to load and convert TensorFlow file format"
|
||||||
file(GLOB_RECURSE LIBRARY_PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
|
LINK_LIBRARIES openvino::util)
|
||||||
|
|
||||||
set(${TARGET_NAME}_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})
|
|
||||||
|
|
||||||
set(PROTO_SRCS)
|
|
||||||
set(PROTO_HDRS)
|
|
||||||
|
|
||||||
# Generate protobuf file on build time for each '.proto' file in src/proto
|
|
||||||
file(GLOB proto_files ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/*.proto)
|
|
||||||
|
|
||||||
foreach(INFILE ${proto_files})
|
|
||||||
get_filename_component(FILE_DIR ${INFILE} DIRECTORY)
|
|
||||||
get_filename_component(FILE_WE ${INFILE} NAME_WE)
|
|
||||||
set(OUTPUT_PB_SRC ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.cc)
|
|
||||||
set(OUTPUT_PB_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${FILE_WE}.pb.h)
|
|
||||||
set(GENERATED_PROTO ${INFILE})
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${OUTPUT_PB_SRC}" "${OUTPUT_PB_HEADER}"
|
|
||||||
COMMAND ${PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} -I ${FILE_DIR} ${FILE_WE}.proto
|
|
||||||
DEPENDS ${PROTOC_EXECUTABLE} ${GENERATED_PROTO}
|
|
||||||
COMMENT "Running C++ protocol buffer compiler (${PROTOC_EXECUTABLE}) on ${GENERATED_PROTO}"
|
|
||||||
VERBATIM
|
|
||||||
COMMAND_EXPAND_LISTS)
|
|
||||||
list(APPEND PROTO_SRCS "${OUTPUT_PB_SRC}")
|
|
||||||
list(APPEND PROTO_HDRS "${OUTPUT_PB_HEADER}")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
add_custom_target(${TARGET_NAME}_proto DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
|
|
||||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE)
|
|
||||||
|
|
||||||
# Disable all warnings for generated code
|
|
||||||
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w)
|
|
||||||
|
|
||||||
# Create library
|
|
||||||
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS} ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
add_library(openvino::frontend::tensorflow ALIAS ${TARGET_NAME})
|
|
||||||
|
|
||||||
add_dependencies(${TARGET_NAME} ${TARGET_NAME}_proto)
|
|
||||||
|
|
||||||
ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME}
|
|
||||||
INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
||||||
ADDITIONAL_INCLUDE_DIRECTORIES
|
|
||||||
$<TARGET_PROPERTY:frontend_common::static,INTERFACE_INCLUDE_DIRECTORIES>)
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME}
|
|
||||||
PUBLIC
|
|
||||||
$<BUILD_INTERFACE:${${TARGET_NAME}_INCLUDE_DIR}>
|
|
||||||
$<INSTALL_INTERFACE:${FRONTEND_INSTALL_INCLUDE}>
|
|
||||||
PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${Protobuf_INCLUDE_DIRS}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
ie_add_vs_version_file(NAME ${TARGET_NAME}
|
|
||||||
FILEDESCRIPTION "FrontEnd to load and convert TensorFlow file format")
|
|
||||||
|
|
||||||
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
|
|
||||||
|
|
||||||
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES})
|
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} PRIVATE frontend_common::static
|
|
||||||
PRIVATE inference_engine_transformations libprotobuf openvino::util)
|
|
||||||
|
|
||||||
add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}
|
|
||||||
EXCLUDE_PATTERNS ${PROTO_SRCS} ${PROTO_HDRS})
|
|
||||||
|
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME frontend::tensorflow)
|
|
||||||
|
|
||||||
|
# TODO: once TensorFlow FE become releasable component, need to remove these lines and SKIP_INSTALL above
|
||||||
install(TARGETS ${TARGET_NAME}
|
install(TARGETS ${TARGET_NAME}
|
||||||
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
|
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL
|
||||||
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT tests EXCLUDE_FROM_ALL
|
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT tests EXCLUDE_FROM_ALL
|
||||||
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
|
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT tests EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
# TODO: add install commands once TensorFlow frontend is complete, and delete the install above
|
|
||||||
#install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets
|
|
||||||
# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ngraph
|
|
||||||
# ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph
|
|
||||||
# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ngraph)
|
|
||||||
|
|
||||||
#install(DIRECTORY ${${TARGET_NAME}_INCLUDE_DIR}/tensorflow_frontend
|
|
||||||
# DESTINATION ${FRONTEND_INSTALL_INCLUDE}
|
|
||||||
# COMPONENT ngraph_dev
|
|
||||||
# FILES_MATCHING PATTERN "*.hpp")
|
|
||||||
#
|
|
||||||
#export(TARGETS ${TARGET_NAME} NAMESPACE openvino::
|
|
||||||
# APPEND FILE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
|
||||||
|
@ -6,8 +6,15 @@
|
|||||||
|
|
||||||
#include "common/frontend_exceptions.hpp"
|
#include "common/frontend_exceptions.hpp"
|
||||||
|
|
||||||
#ifdef tensorflow_ov_frontend_EXPORTS
|
#ifdef OPENVINO_STATIC_LIBRARY
|
||||||
# define TF_API OPENVINO_CORE_EXPORTS
|
# define TF_API
|
||||||
|
# define TF_C_API
|
||||||
#else
|
#else
|
||||||
# define TF_API OPENVINO_CORE_IMPORTS
|
# ifdef tensorflow_ov_frontend_EXPORTS
|
||||||
#endif // tensorflow_ov_frontend_EXPORTS
|
# define TF_API OPENVINO_CORE_EXPORTS
|
||||||
|
# define TF_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS
|
||||||
|
# else
|
||||||
|
# define TF_API OPENVINO_CORE_IMPORTS
|
||||||
|
# define TF_C_API OPENVINO_EXTERN_C OPENVINO_CORE_IMPORTS
|
||||||
|
# endif // tensorflow_ov_frontend_EXPORTS
|
||||||
|
#endif // OPENVINO_STATIC_LIBRARY
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
#include "manager.hpp"
|
#include "manager.hpp"
|
||||||
#include "tensorflow_frontend/frontend.hpp"
|
#include "tensorflow_frontend/frontend.hpp"
|
||||||
|
|
||||||
extern "C" OPENVINO_CORE_EXPORTS ov::frontend::FrontEndVersion GetAPIVersion() {
|
TF_C_API ov::frontend::FrontEndVersion GetAPIVersion() {
|
||||||
return OV_FRONTEND_API_VERSION;
|
return OV_FRONTEND_API_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" OPENVINO_CORE_EXPORTS void* GetFrontEndData() {
|
TF_C_API void* GetFrontEndData() {
|
||||||
auto res = new ov::frontend::FrontEndPluginInfo();
|
auto res = new ov::frontend::FrontEndPluginInfo();
|
||||||
res->m_name = "tf";
|
res->m_name = "tf";
|
||||||
res->m_creator = []() {
|
res->m_creator = []() {
|
||||||
|
8
thirdparty/CMakeLists.txt
vendored
8
thirdparty/CMakeLists.txt
vendored
@ -90,24 +90,26 @@ if(NGRAPH_PDPD_FRONTEND_ENABLE OR NGRAPH_ONNX_FRONTEND_ENABLE OR NGRAPH_TF_FRONT
|
|||||||
endif()
|
endif()
|
||||||
find_package(Protobuf 3.9.0 REQUIRED)
|
find_package(Protobuf 3.9.0 REQUIRED)
|
||||||
set(Protobuf_LITE_LIBRARIES protobuf::libprotobuf-lite)
|
set(Protobuf_LITE_LIBRARIES protobuf::libprotobuf-lite)
|
||||||
|
set(Protobuf_LIBRARIES protobuf::libprotobuf)
|
||||||
set(SYSTEM_PROTOC protobuf::protoc)
|
set(SYSTEM_PROTOC protobuf::protoc)
|
||||||
set(PROTOC_EXECUTABLE ${SYSTEM_PROTOC})
|
set(PROTOC_EXECUTABLE ${SYSTEM_PROTOC})
|
||||||
|
|
||||||
foreach(target ${SYSTEM_PROTOC} ${Protobuf_LITE_LIBRARIES})
|
foreach(target ${SYSTEM_PROTOC} ${Protobuf_LIBRARIES} ${Protobuf_LITE_LIBRARIES})
|
||||||
set_property(TARGET ${target} PROPERTY IMPORTED_GLOBAL TRUE)
|
set_property(TARGET ${target} PROPERTY IMPORTED_GLOBAL TRUE)
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
add_subdirectory(protobuf)
|
add_subdirectory(protobuf EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# forward variables used in the other places
|
# forward variables used in the other places
|
||||||
set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE)
|
set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE)
|
||||||
set(PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE} PARENT_SCOPE)
|
set(PROTOC_EXECUTABLE ${PROTOC_EXECUTABLE} PARENT_SCOPE)
|
||||||
|
set(Protobuf_LIBRARIES ${Protobuf_LIBRARIES} PARENT_SCOPE)
|
||||||
set(Protobuf_LITE_LIBRARIES ${Protobuf_LITE_LIBRARIES} PARENT_SCOPE)
|
set(Protobuf_LITE_LIBRARIES ${Protobuf_LITE_LIBRARIES} PARENT_SCOPE)
|
||||||
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE)
|
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE)
|
||||||
|
|
||||||
# set public / interface compile options
|
# set public / interface compile options
|
||||||
foreach(target IN LISTS Protobuf_LITE_LIBRARIES)
|
foreach(target IN LISTS Protobuf_LITE_LIBRARIES Protobuf_LIBRARIES)
|
||||||
set(link_type PUBLIC)
|
set(link_type PUBLIC)
|
||||||
if(NGRAPH_USE_SYSTEM_PROTOBUF)
|
if(NGRAPH_USE_SYSTEM_PROTOBUF)
|
||||||
set(link_type INTERFACE)
|
set(link_type INTERFACE)
|
||||||
|
47
thirdparty/onnx/CMakeLists.txt
vendored
47
thirdparty/onnx/CMakeLists.txt
vendored
@ -8,26 +8,51 @@
|
|||||||
|
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF)
|
||||||
set(NGRAPH_ONNX_NAMESPACE ngraph_onnx)
|
set(NGRAPH_ONNX_NAMESPACE ngraph_onnx)
|
||||||
set(BUILD_SHARED_LIBS OFF)
|
|
||||||
|
|
||||||
if(NOT DEFINED ONNX_USE_MSVC_STATIC_RUNTIME)
|
if(NOT DEFINED ONNX_USE_MSVC_STATIC_RUNTIME)
|
||||||
set(ONNX_USE_MSVC_STATIC_RUNTIME OFF)
|
set(ONNX_USE_MSVC_STATIC_RUNTIME OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
macro(onnx_set_target_properties)
|
if(FORCE_FRONTENDS_USE_PROTOBUF)
|
||||||
target_include_directories(onnx SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
|
set(ONNX_USE_LITE_PROTO_DEFAULT OFF)
|
||||||
target_include_directories(onnx_proto SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
|
else()
|
||||||
|
set(ONNX_USE_LITE_PROTO_DEFAULT ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
ov_disable_all_warnings(onnx onnx_proto)
|
set(ONNX_USE_PROTOBUF_SHARED_LIBS CACHE BOOL "Use dynamic protobuf by ONNX library" FORCE)
|
||||||
endmacro()
|
|
||||||
|
|
||||||
set(ONNX_USE_PROTOBUF_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Use dynamic protobuf by ONNX library" FORCE)
|
|
||||||
set(ONNX_NAMESPACE ${NGRAPH_ONNX_NAMESPACE})
|
set(ONNX_NAMESPACE ${NGRAPH_ONNX_NAMESPACE})
|
||||||
set(ONNX_USE_LITE_PROTO ON CACHE BOOL "Use protobuf lite for ONNX library" FORCE)
|
set(ONNX_USE_LITE_PROTO ${ONNX_USE_LITE_PROTO_DEFAULT} CACHE BOOL "Use protobuf lite for ONNX library" FORCE)
|
||||||
set(ONNX_ML ON CACHE BOOL "Use ONNX ML" FORCE)
|
set(ONNX_ML ON CACHE BOOL "Use ONNX ML" FORCE)
|
||||||
if(CMAKE_CROSSCOMPILING)
|
if(CMAKE_CROSSCOMPILING)
|
||||||
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${SYSTEM_PROTOC})
|
set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${SYSTEM_PROTOC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(onnx EXCLUDE_FROM_ALL)
|
# build targets
|
||||||
onnx_set_target_properties()
|
|
||||||
|
function(ov_onnx_build_static)
|
||||||
|
set(BUILD_SHARED_LIBS OFF)
|
||||||
|
add_subdirectory(onnx EXCLUDE_FROM_ALL)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
ov_onnx_build_static()
|
||||||
|
|
||||||
|
target_include_directories(onnx SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
|
||||||
|
target_include_directories(onnx_proto SYSTEM PRIVATE "${Protobuf_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
ov_disable_all_warnings(onnx onnx_proto)
|
||||||
|
|
||||||
|
# install
|
||||||
|
|
||||||
|
ov_install_static_lib(onnx ngraph)
|
||||||
|
ov_install_static_lib(onnx_proto ngraph)
|
||||||
|
|
||||||
|
# WA for ONNX: protobuf must be in the same export set of ONNX targets
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
if(ONNX_USE_LITE_PROTO)
|
||||||
|
install(TARGETS ${Protobuf_LITE_LIBRARIES} EXPORT ONNXTargets
|
||||||
|
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph)
|
||||||
|
else()
|
||||||
|
install(TARGETS ${Protobuf_LIBRARIES} EXPORT ONNXTargets
|
||||||
|
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ngraph)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
12
thirdparty/protobuf/CMakeLists.txt
vendored
12
thirdparty/protobuf/CMakeLists.txt
vendored
@ -16,9 +16,11 @@ if(OV_COMPILER_IS_CLANG)
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests")
|
set(protobuf_VERBOSE ON)
|
||||||
set(protobuf_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS} CACHE BOOL "Build shared libs" FORCE)
|
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests" FORCE)
|
||||||
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support")
|
set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
|
||||||
|
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
|
||||||
|
set(protobuf_BUILD_CONFORMANCE OFF CACHE BOOL "" FORCE)
|
||||||
|
|
||||||
# When we build dll libraries. These flags make sure onnx and protobuf build with /MD, not /MT.
|
# 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.
|
# These two options can't be mixed, because they requires link two imcompatiable runtime.
|
||||||
@ -77,7 +79,8 @@ 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")
|
message(WARNING "system protobuf version does not match with the compiled one, please update system protobuf or submodule")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# forward variables used in the other places
|
# set to parent scope
|
||||||
|
|
||||||
if(SYSTEM_PROTOC)
|
if(SYSTEM_PROTOC)
|
||||||
set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE)
|
set(SYSTEM_PROTOC ${SYSTEM_PROTOC} PARENT_SCOPE)
|
||||||
set(PROTOC_EXECUTABLE ${SYSTEM_PROTOC} PARENT_SCOPE)
|
set(PROTOC_EXECUTABLE ${SYSTEM_PROTOC} PARENT_SCOPE)
|
||||||
@ -87,4 +90,5 @@ endif()
|
|||||||
|
|
||||||
set(protobuf_VERSION ${protobuf_VERSION} PARENT_SCOPE)
|
set(protobuf_VERSION ${protobuf_VERSION} PARENT_SCOPE)
|
||||||
set(Protobuf_LITE_LIBRARIES libprotobuf-lite PARENT_SCOPE)
|
set(Protobuf_LITE_LIBRARIES libprotobuf-lite PARENT_SCOPE)
|
||||||
|
set(Protobuf_LIBRARIES libprotobuf PARENT_SCOPE)
|
||||||
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE)
|
set(Protobuf_INCLUDE_DIRS ${Protobuf_INCLUDE_DIRS} PARENT_SCOPE)
|
||||||
|
Loading…
Reference in New Issue
Block a user