Install rules for static libraries case (#8384)

* Proper cmake install for static libraries case

* Added an ability to skip template plugin

* Added install rules for VPU / GPU

* Install more libraries

* Fixed absolute TBB include paths

* Disable GNA

* Fixed issue with linker

* Some fixes

* Fixed linkage issues in tests

* Disabled some tests

* Updated CI pipelines

* Fixed Windows linkage

* Fixed custom_opset test for static casr

* Fixed CVS-70313

* Continue on error

* Fixed clanf-format

* Try to fix Windows linker

* Fixed compilation

* Disable samples

* Fixed samples build with THREADING=SEQ

* Fixed link error on Windows

* Fixed ieFuncTests

* Added static Azure CI

* Revert "Fixed link error on Windows"

This reverts commit 78cca36fd2.

* Merge static and dynamic linux pipelines

* Fixed Azure
This commit is contained in:
Ilya Lavrenov authored and GitHub committed 2021-11-10 18:25:51 +03:00
1 parent 91da09b1e5
commit 461f746430
60 files changed
+427 -273

No files matched your search

@@ -208,6 +208,15 @@ endif()
# General flags
macro(ov_install_static_lib target comp)
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ${target} EXPORT OpenVINOTargets
RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT ${comp}
ARCHIVE DESTINATION ${IE_CPACK_ARCHIVE_PATH} COMPONENT ${comp}
LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT ${comp})
endif()
endmacro()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
@@ -54,8 +54,4 @@ endforeach()
set(IE_PLUGINS_MAP_DEFINITION "${IE_PLUGINS_MAP_DEFINITION}
};\n")
message("${IE_PLUGINS_DECLARATIONS}")
message("${IE_PLUGINS_MAP_DEFINITION}")
configure_file("${IE_PLUGINS_HPP_HEADER_IN}" "${IE_PLUGINS_HPP_HEADER}" @ONLY)
@@ -75,6 +75,8 @@ function(ie_add_plugin)
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE
IE_CREATE_EXTENSION=CreateExtensionShared${IE_PLUGIN_DEVICE_NAME})
endif()
# install static plugins
ov_install_static_lib(${IE_PLUGIN_NAME} core)
endif()
ie_add_vs_version_file(NAME ${IE_PLUGIN_NAME}
+71 -66
View File
@@ -1,25 +1,28 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
function(ie_generate_dev_package_config)
# dummy check that OpenCV is here
find_package(OpenCV QUIET)
# dummy check that OpenCV is here
find_package(OpenCV QUIET)
set(all_dev_targets gflags ie_libraries)
foreach(component IN LISTS openvino_export_components)
export(TARGETS ${${component}} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
list(APPEND all_dev_targets ${${component}})
endforeach()
add_custom_target(ie_dev_targets ALL DEPENDS ${all_dev_targets})
set(all_dev_targets gflags ie_libraries)
foreach(component IN LISTS openvino_export_components)
export(TARGETS ${${component}} NAMESPACE IE::
APPEND FILE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
list(APPEND all_dev_targets ${${component}})
endforeach()
add_custom_target(ie_dev_targets ALL DEPENDS ${all_dev_targets})
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR"
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake"
INSTALL_DESTINATION share # not used
PATH_VARS "OpenVINO_SOURCE_DIR;gflags_BINARY_DIR"
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig-version.cmake"
@ONLY)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in"
"${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig-version.cmake"
@ONLY)
endfunction()
ie_generate_dev_package_config()
@@ -29,60 +32,62 @@ ie_generate_dev_package_config()
#
function(register_extra_modules)
# post export
openvino_developer_export_targets(COMPONENT inference_engine TARGETS inference_engine)
openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph)
# post export
openvino_developer_export_targets(COMPONENT inference_engine TARGETS inference_engine)
openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph)
set(InferenceEngineDeveloperPackage_DIR "${CMAKE_CURRENT_BINARY_DIR}/runtime")
set(InferenceEngineDeveloperPackage_DIR "${CMAKE_CURRENT_BINARY_DIR}/runtime")
function(generate_fake_dev_package)
set(iedevconfig_file "${InferenceEngineDeveloperPackage_DIR}/InferenceEngineDeveloperPackageConfig.cmake")
file(REMOVE "${iedevconfig_file}")
function(generate_fake_dev_package)
set(iedevconfig_file "${InferenceEngineDeveloperPackage_DIR}/InferenceEngineDeveloperPackageConfig.cmake")
file(REMOVE "${iedevconfig_file}")
file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n")
file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n")
file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n")
file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n")
foreach(target IN LISTS ${openvino_export_components})
if(target)
file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n")
foreach(target IN LISTS ${openvino_export_components})
if(target)
file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n")
endif()
endforeach()
endfunction()
generate_fake_dev_package()
# automatically import plugins from the 'plugins' folder
file(GLOB local_extra_modules "runtime/plugins/*")
# add template plugin
if(ENABLE_TEMPLATE)
list(APPEND local_extra_modules "${OpenVINO_SOURCE_DIR}/docs/template_plugin")
endif()
# detect where IE_EXTRA_MODULES contains folders with CMakeLists.txt
# other folders are supposed to have sub-folders with CMakeLists.txt
foreach(module_path IN LISTS IE_EXTRA_MODULES)
if(EXISTS "${module_path}/CMakeLists.txt")
list(APPEND extra_modules "${module_path}")
elseif(module_path)
file(GLOB extra_modules ${extra_modules} "${module_path}/*")
endif()
endforeach()
# add each extra module
foreach(module_path IN LISTS extra_modules local_extra_modules)
if(module_path)
get_filename_component(module_name "${module_path}" NAME)
set(build_module ON)
if(NOT EXISTS "${module_path}/CMakeLists.txt") # if module is built not using cmake
set(build_module OFF)
endif()
if(NOT DEFINED BUILD_${module_name})
set(BUILD_${module_name} ${build_module} CACHE BOOL "Build ${module_name} extra module" FORCE)
endif()
if(BUILD_${module_name})
message(STATUS "Register ${module_name} to be built in build-modules/${module_name}")
add_subdirectory("${module_path}" "build-modules/${module_name}")
endif()
endif()
endforeach()
endfunction()
generate_fake_dev_package()
# automatically import plugins from the 'plugins' folder
file(GLOB local_extra_modules "runtime/plugins/*")
# add template plugin
list(APPEND local_extra_modules "${OpenVINO_SOURCE_DIR}/docs/template_plugin")
# detect where IE_EXTRA_MODULES contains folders with CMakeLists.txt
# other folders are supposed to have sub-folders with CMakeLists.txt
foreach(module_path IN LISTS IE_EXTRA_MODULES)
if(EXISTS "${module_path}/CMakeLists.txt")
list(APPEND extra_modules "${module_path}")
elseif(module_path)
file(GLOB extra_modules ${extra_modules} "${module_path}/*")
endif()
endforeach()
# add each extra module
foreach(module_path IN LISTS extra_modules local_extra_modules)
if(module_path)
get_filename_component(module_name "${module_path}" NAME)
set(build_module ON)
if(NOT EXISTS "${module_path}/CMakeLists.txt") # if module is built not using cmake
set(build_module OFF)
endif()
if(NOT DEFINED BUILD_${module_name})
set(BUILD_${module_name} ${build_module} CACHE BOOL "Build ${module_name} extra module" FORCE)
endif()
if(BUILD_${module_name})
message(STATUS "Register ${module_name} to be built in build-modules/${module_name}")
add_subdirectory("${module_path}" "build-modules/${module_name}")
endif()
endif()
endforeach()
endfunction()
register_extra_modules()
register_extra_modules()
+3 -1
View File
@@ -90,6 +90,8 @@ ie_option (ENABLE_MULTI "Enables Multi Device Plugin" ON)
ie_option (ENABLE_HETERO "Enables Hetero Device Plugin" ON)
ie_option (ENABLE_TEMPLATE "Enable template plugin" ON)
ie_dependent_option (ENABLE_VPU "vpu targeted plugins for inference engine" ON "NOT WINDOWS_PHONE;NOT WINDOWS_STORE" OFF)
ie_dependent_option (ENABLE_MYRIAD "myriad targeted plugin for inference engine" ON "ENABLE_VPU" OFF)
@@ -118,7 +120,7 @@ set(IE_EXTRA_MODULES "" CACHE STRING "Extra paths for extra modules to include i
ie_dependent_option(ENABLE_TBB_RELEASE_ONLY "Only Release TBB libraries are linked to the Inference Engine binaries" ON "THREADING MATCHES TBB;LINUX" OFF)
ie_option (ENABLE_SYSTEM_PUGIXML "use the system copy of pugixml" OFF)
ie_dependent_option (ENABLE_SYSTEM_PUGIXML "use the system copy of pugixml" OFF "BUILD_SHARED_LIBS" OFF)
ie_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
+12
View File
@@ -160,8 +160,20 @@ if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO" AND NOT TBB_FOUND)
${_tbb_dir}
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
set(install_tbbbind "@install_tbbbind@")
if(install_tbbbind)
set_and_check(_tbb_bind_dir "@PACKAGE_IE_TBBBIND_DIR@")
_ov_find_dependency(TBBBIND_2_5
PATHS ${_tbb_bind_dir}
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
set_target_properties(${TBBBIND_2_5_IMPORTED_TARGETS} PROPERTIES IMPORTED_GLOBAL ON)
endif()
endif()
_ov_find_dependency(Threads)
if(NOT TARGET inference_engine)
set(_ov_as_external_package ON)
include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake")
@@ -17,5 +17,8 @@ macro(_set_if_not_defined var val)
endif()
endmacro()
# for ittapi
_set_if_not_defined(FORCE_32 ON)
# need libusb 32-bits version
_set_if_not_defined(ENABLE_VPU OFF)