diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 16c9969065c834..e099ff08fa156c 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -21,6 +21,14 @@ resources: jobs: - job: Lin + strategy: + matrix: + Dynamic: + CMAKE_BUILD_SHARED_LIBS: 'ON' + Static: + CMAKE_BUILD_SHARED_LIBS: 'OFF' + maxParallel: 2 + # About 150% of total time timeoutInMinutes: 90 @@ -126,6 +134,9 @@ jobs: -DVERBOSE_BUILD=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_PYTHON=ON + -DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) + -DENABLE_GNA=$(CMAKE_BUILD_SHARED_LIBS) + -DENABLE_CLDNN=$(CMAKE_BUILD_SHARED_LIBS) -DPYTHON_EXECUTABLE=/usr/bin/python3.8 -DENABLE_WHEEL=ON -DENABLE_TESTS=ON @@ -183,10 +194,12 @@ jobs: - script: $(INSTALL_DIR)/samples/cpp/build_samples.sh workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build cpp samples' + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: $(INSTALL_DIR)/samples/c/build_samples.sh workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build c samples' + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: rm -fr $(BUILD_DIR) displayName: 'Clean build dir' @@ -199,6 +212,7 @@ jobs: . $(SETUPVARS) -pyver 3.8 && python3 -m pytest -s $(INSTALL_TEST_DIR)/pyngraph --junitxml=TEST-Pyngraph.xml --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_zoo_models.py --ignore=$(INSTALL_TEST_DIR)/pyngraph/tests/test_onnx/test_backend.py displayName: 'nGraph Python Bindings Tests' continueOnError: false + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: | export MO_ROOT=$(INSTALL_DIR)/tools/model_optimizer @@ -218,6 +232,7 @@ jobs: - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/tensorflow_tests --gtest_print_time=1 --gtest_output=xml:TEST-Tensorflow.xml displayName: 'Tensorflow Frontend UT' continueOnError: false + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') # . $(SETUPVARS) && python3 $(WORK_DIR)/gtest-parallel/gtest_parallel.py $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --workers=16 --dump_json_test_results=InferenceEngineUnitTests.json --gtest_filter=*smoke* -- --gtest_print_time=1 - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml @@ -235,6 +250,7 @@ jobs: - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml displayName: 'GNA UT' continueOnError: false + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml displayName: 'VPU UT' @@ -251,6 +267,7 @@ jobs: - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/templateFuncTests --gtest_filter=*smoke* --gtest_output=xml:TEST-templateFuncTests.xml displayName: 'TEMPLATE FuncTests' continueOnError: false + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml displayName: 'CPU FuncTests' @@ -270,6 +287,7 @@ jobs: . $(SETUPVARS) -pyver 3.8 && python3 -m pytest --junitxml=TEST-PythonAPI.xml displayName: 'Python API Tests' continueOnError: false + condition: eq(variables['CMAKE_BUILD_SHARED_LIBS'], 'ON') - script: | . $(SETUPVARS) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7b7f1fb86fa48..ef69fe8ed73730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,8 +85,8 @@ include(cmake/test_model_zoo.cmake) add_subdirectory(thirdparty) add_subdirectory(openvino) add_subdirectory(ngraph) -add_subdirectory(runtime) add_subdirectory(inference-engine) +add_subdirectory(runtime) # for Template plugin openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_backend interpreter_backend) diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake index 2bdb7e6123656c..5afa256f25def7 100644 --- a/cmake/developer_package/IEDevScriptsConfig.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -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) diff --git a/cmake/developer_package/plugins/create_plugins_hpp.cmake b/cmake/developer_package/plugins/create_plugins_hpp.cmake index c63f964660fb6b..4d73b0bca3bbc2 100644 --- a/cmake/developer_package/plugins/create_plugins_hpp.cmake +++ b/cmake/developer_package/plugins/create_plugins_hpp.cmake @@ -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) diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index 1d9277fff2d572..dd9ea3463018c4 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -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} diff --git a/cmake/extra_modules.cmake b/cmake/extra_modules.cmake index e9027e21f06502..8e2ba6b5cd3047 100644 --- a/cmake/extra_modules.cmake +++ b/cmake/extra_modules.cmake @@ -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) - -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_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in" - "${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig-version.cmake" - @ONLY) + # 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}) + + 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) 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") - - foreach(target IN LISTS ${openvino_export_components}) - if(target) - file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n") - endif() - endforeach() -endfunction() + file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n") + file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n") -generate_fake_dev_package() + foreach(target IN LISTS ${openvino_export_components}) + if(target) + file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n") + endif() + endforeach() + endfunction() -# 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") + generate_fake_dev_package() -# 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}/*") + # 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() -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) + + # 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() - 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}") + 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() - endif() -endforeach() + endforeach() endfunction() -register_extra_modules() \ No newline at end of file +register_extra_modules() diff --git a/cmake/features.cmake b/cmake/features.cmake index 846d486d922c53..d5c2303ced5964 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -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) diff --git a/cmake/templates/OpenVINOConfig.cmake.in b/cmake/templates/OpenVINOConfig.cmake.in index 818080a0ac8581..bb21d19b400d48 100644 --- a/cmake/templates/OpenVINOConfig.cmake.in +++ b/cmake/templates/OpenVINOConfig.cmake.in @@ -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") diff --git a/cmake/toolchains/ia32.linux.toolchain.cmake b/cmake/toolchains/ia32.linux.toolchain.cmake index 4526bc3ab9de81..f5c24fffb89fe2 100644 --- a/cmake/toolchains/ia32.linux.toolchain.cmake +++ b/cmake/toolchains/ia32.linux.toolchain.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) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 93d1feed4050d1..b2ccee1dcdd1fc 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -23,8 +23,8 @@ if(NOT ENABLE_DOCKER) add_subdirectory(template_extension) set(all_docs_targets - ie_docs_snippets - template_extension templatePlugin templateFuncTests) + ie_docs_snippets templateFuncTests + template_extension template_ov_extension templatePlugin) foreach(target_name IN LISTS all_docs_targets) if(TARGET ${target_name}) set_target_properties(${target_name} PROPERTIES FOLDER docs) @@ -36,8 +36,14 @@ if(NOT ENABLE_DOCKER) # install - install(TARGETS templatePlugin template_extension template_ov_extension - LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL) + foreach(target templatePlugin template_extension template_ov_extension) + if(TARGET ${target}) + install(TARGETS ${target} + LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} + COMPONENT tests + EXCLUDE_FROM_ALL) + endif() + endforeach() endif() set(OMZ_DOCS_DIR "" CACHE PATH "Path to open_model_zoo documentation") diff --git a/docs/template_plugin/src/CMakeLists.txt b/docs/template_plugin/src/CMakeLists.txt index a6411523780629..e22bb0a6dedfa3 100644 --- a/docs/template_plugin/src/CMakeLists.txt +++ b/docs/template_plugin/src/CMakeLists.txt @@ -40,13 +40,5 @@ set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_REL # POSSIBLE_PLUGINS ${TARGET_NAME}) # [cmake:plugin] -# ATTENTION: uncomment to install component -# install - -# set(component_name template) -# ie_cpack_add_component(${component_name} REQUIRED) - -# install(TARGETS ${TARGET_NAME} -# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} -# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} -# COMPONENT ${component_name}) +ov_install_static_lib(ngraph_backend ngraph) +ov_install_static_lib(interpreter_backend ngraph) diff --git a/inference-engine/cmake/ie_parallel.cmake b/inference-engine/cmake/ie_parallel.cmake index 6c87d9b4eb940d..4f724840d377d9 100644 --- a/inference-engine/cmake/ie_parallel.cmake +++ b/inference-engine/cmake/ie_parallel.cmake @@ -91,7 +91,10 @@ function(set_ie_threading_interface_for TARGET_NAME) if(TARGET ${library}) get_target_property(include_directories ${library} INTERFACE_INCLUDE_DIRECTORIES) if(include_directories) - target_include_directories(${TARGET_NAME} SYSTEM BEFORE ${LINK_TYPE} ${include_directories}) + foreach(include_directory IN LISTS include_directories) + target_include_directories(${TARGET_NAME} SYSTEM BEFORE + ${LINK_TYPE} $) + endforeach() endif() endif() endforeach() @@ -178,6 +181,6 @@ function(set_ie_threading_interface_for TARGET_NAME) if (NOT THREADING STREQUAL "SEQ") find_package(Threads REQUIRED) - ie_target_link_libraries(${TARGET_NAME} ${LINK_TYPE} ${CMAKE_THREAD_LIBS_INIT}) + ie_target_link_libraries(${TARGET_NAME} ${LINK_TYPE} Threads::Threads) endif() endfunction(set_ie_threading_interface_for) diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/inference-engine/ie_bridges/c/src/CMakeLists.txt index ecc8165ca349fa..4a60879bb52073 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -17,6 +17,10 @@ target_link_libraries(${TARGET_NAME} PRIVATE inference_engine) target_include_directories(${TARGET_NAME} PUBLIC $) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(${TARGET_NAME} PUBLIC OPENVINO_STATIC_LIBRARY) +endif() + add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) diff --git a/inference-engine/ie_bridges/c/tests/ie_c_api_test.cpp b/inference-engine/ie_bridges/c/tests/ie_c_api_test.cpp index 0a7ce006800c5a..d422448bc69907 100644 --- a/inference-engine/ie_bridges/c/tests/ie_c_api_test.cpp +++ b/inference-engine/ie_bridges/c/tests/ie_c_api_test.cpp @@ -145,6 +145,9 @@ TEST(ie_core_get_available_devices, getAvailableDevices) { ie_core_free(&core); } +// TODO: CVS-68982 +#ifndef OPENVINO_STATIC_LIBRARY + TEST(ie_core_register_plugin, registerPlugin) { ie_core_t *core = nullptr; IE_ASSERT_OK(ie_core_create("", &core)); @@ -213,6 +216,8 @@ TEST(ie_core_unregister_plugin, unregisterPlugin) { ie_core_free(&core); } +#endif // !OPENVINO_STATIC_LIBRARY + TEST(ie_core_set_config, setConfig) { ie_core_t *core = nullptr; IE_ASSERT_OK(ie_core_create("", &core)); diff --git a/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt index bc9115229e621c..72a69fb5904ad6 100644 --- a/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/offline_transformations/CMakeLists.txt @@ -29,10 +29,10 @@ if(COMMAND ie_add_vs_version_file) FILEDESCRIPTION "Offline Transformatoins Python library") endif() -if(TARGET offline_transformations) - list(APPEND link_libraries offline_transformations) -else() +if(InferenceEngineDeveloperPackage_FOUND) list(APPEND link_libraries IE::offline_transformations) +else() + list(APPEND link_libraries offline_transformations) endif() target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../inference_engine") diff --git a/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt b/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt index c6ae33c7951305..86dd25996b90ee 100644 --- a/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/src/openvino/test_utils/CMakeLists.txt @@ -29,10 +29,10 @@ if(COMMAND ie_add_vs_version_file) FILEDESCRIPTION "Test Utils Python library") endif() -if(TARGET commonTestUtils) - list(APPEND link_libraries commonTestUtils) -else() +if(InferenceEngineDeveloperPackage_FOUND) list(APPEND link_libraries IE::commonTestUtils) +else() + list(APPEND link_libraries commonTestUtils) endif() target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/inference-engine/src/CMakeLists.txt b/inference-engine/src/CMakeLists.txt index 57863449d3d67b..b74d4b2830b4a4 100644 --- a/inference-engine/src/CMakeLists.txt +++ b/inference-engine/src/CMakeLists.txt @@ -9,8 +9,6 @@ endif() add_subdirectory(transformations) -add_subdirectory(legacy_api) - add_subdirectory(low_precision_transformations) add_subdirectory(offline_transformations) @@ -43,6 +41,8 @@ endif() add_subdirectory(inference_engine) +add_subdirectory(legacy_api) + add_subdirectory(readers) add_subdirectory(preprocessing) diff --git a/inference-engine/src/gna_plugin/CMakeLists.txt b/inference-engine/src/gna_plugin/CMakeLists.txt index a476318dc03e89..3ec2d5b089c6c3 100644 --- a/inference-engine/src/gna_plugin/CMakeLists.txt +++ b/inference-engine/src/gna_plugin/CMakeLists.txt @@ -65,10 +65,13 @@ target_compile_definitions(${TARGET_NAME}_test_static INTEGER_LOW_P USE_STATIC_IE) -target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_preproc_s inference_engine_transformations libGNA::API) -target_include_directories(${TARGET_NAME}_test_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} - $ - PRIVATE $) +target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_s inference_engine_preproc_s inference_engine_transformations libGNA::API) +target_include_directories(${TARGET_NAME}_test_static + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + $ + PRIVATE + $) set_target_properties(${TARGET_NAME}_test_static PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_test_static) set_target_properties(${TARGET_NAME} ${TARGET_NAME}_test_static diff --git a/inference-engine/src/hetero_plugin/CMakeLists.txt b/inference-engine/src/hetero_plugin/CMakeLists.txt index c7fbe6eecf8b65..39aa7191bd3fd0 100644 --- a/inference-engine/src/hetero_plugin/CMakeLists.txt +++ b/inference-engine/src/hetero_plugin/CMakeLists.txt @@ -16,7 +16,7 @@ ie_faster_build(${TARGET_NAME} UNITY ) -target_link_libraries(${TARGET_NAME} PRIVATE pugixml inference_engine +target_link_libraries(${TARGET_NAME} PRIVATE pugixml::static inference_engine ngraph inference_engine_transformations) ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index 4dc8fe70d705bf..bff4002cbdcc20 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -6,8 +6,11 @@ set (TARGET_NAME "inference_engine") if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") find_package(TBBBIND_2_5 QUIET) - if (TBBBIND_2_5_FOUND) - message(STATUS "Static tbbbind_2_5 package was found") + if(TBBBIND_2_5_FOUND) + message(STATUS "Static tbbbind_2_5 package is found") + if(NOT BUILD_SHARED_LIBS) + set(install_tbbbind ON) + endif() endif() endif() @@ -101,10 +104,10 @@ source_group("include" FILES ${LIBRARY_HEADERS} ${PUBLIC_HEADERS}) add_library(${TARGET_NAME}_plugin_api INTERFACE) target_include_directories(${TARGET_NAME}_plugin_api INTERFACE - "${IE_MAIN_SOURCE_DIR}/src/plugin_api" $ - ${PUBLIC_HEADERS_DIR} - ${PUBLIC_HEADERS_DIR}/ie) + $ + $ + $) target_link_libraries(${TARGET_NAME}_plugin_api INTERFACE pugixml::static openvino::itt openvino::util) @@ -198,44 +201,34 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) # Static library used for unit tests which are always built -if(BUILD_SHARED_LIBS) - add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL - $ - $ - ${IE_STATIC_DEPENDENT_FILES}) - - set_ie_threading_interface_for(${TARGET_NAME}_s) - if (TBBBIND_2_5_FOUND) - target_compile_definitions(${TARGET_NAME}_s PRIVATE -DTBBBIND_2_5_AVAILABLE) - target_link_libraries(${TARGET_NAME}_s PRIVATE ${TBBBIND_2_5_IMPORTED_TARGETS}) - endif() +add_library(${TARGET_NAME}_s STATIC EXCLUDE_FROM_ALL + $ + $ + ${IE_STATIC_DEPENDENT_FILES}) - target_include_directories(${TARGET_NAME}_s PUBLIC - $ - "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${IE_MAIN_SOURCE_DIR}/src/legacy_api/src") +set_ie_threading_interface_for(${TARGET_NAME}_s) +if (TBBBIND_2_5_FOUND) + target_compile_definitions(${TARGET_NAME}_s PRIVATE -DTBBBIND_2_5_AVAILABLE) + target_link_libraries(${TARGET_NAME}_s PRIVATE ${TBBBIND_2_5_IMPORTED_TARGETS}) +endif() - if(WIN32) - set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s) - endif() +target_include_directories(${TARGET_NAME}_s PUBLIC + $ + $ + $) - target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ngraph - frontend_manager::static inference_engine_transformations pugixml::static) +if(WIN32) + set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s) +endif() - target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE) +target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ngraph + frontend_manager::static inference_engine_preproc_s inference_engine_transformations pugixml::static) - set_target_properties(${TARGET_NAME}_s PROPERTIES - EXCLUDE_FROM_ALL ON - INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) -else() - # for static OpenVINO build we can re-use inference_engine which is already static - add_library(${TARGET_NAME}_s ALIAS ${TARGET_NAME}) +target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE) - target_include_directories(${TARGET_NAME} PUBLIC - $ - "${CMAKE_CURRENT_SOURCE_DIR}/src" - "${IE_MAIN_SOURCE_DIR}/src/legacy_api/src") -endif() +set_target_properties(${TARGET_NAME}_s PROPERTIES + EXCLUDE_FROM_ALL ON + INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) # LTO @@ -263,6 +256,11 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$") list(APPEND PATH_VARS "IE_TBB_DIR") endif() +if(install_tbbbind) + set(IE_TBBBIND_DIR "${TBBBIND_2_5}") + list(APPEND PATH_VARS "IE_TBBBIND_DIR") +endif() + # install only downloaded TBB, system one is not installed if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND TBBROOT MATCHES ${TEMP}) ie_cpack_add_component(tbb REQUIRED) @@ -285,13 +283,26 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND TBBROOT MATCHES ${TEMP}) COMPONENT tbb) set(IE_TBB_DIR_INSTALL "3rdparty/tbb/cmake") - install(FILES "${TBB}/cmake/TBBConfig.cmake" "${TBB}/cmake/TBBConfigVersion.cmake" DESTINATION runtime/${IE_TBB_DIR_INSTALL} COMPONENT tbb) endif() +if(install_tbbbind) + install(DIRECTORY "${TBBBIND_2_5}/lib" + DESTINATION runtime/3rdparty/tbb_bind_2_5 + COMPONENT tbb) + install(FILES "${TBBBIND_2_5}/LICENSE" + DESTINATION runtime/3rdparty/tbb_bind_2_5 + COMPONENT tbb) + + set(IE_TBBBIND_DIR_INSTALL "3rdparty/tbb_bind_2_5/cmake") + install(FILES "${TBBBIND_2_5}/cmake/TBBBIND_2_5Config.cmake" + DESTINATION runtime/${IE_TBBBIND_DIR_INSTALL} + COMPONENT tbb) +endif() + # Install Inference Engine ie_cpack_add_component(core REQUIRED DEPENDS ${core_components}) @@ -309,28 +320,32 @@ install(TARGETS ${TARGET_NAME} EXPORT OpenVINOTargets # TODO: remove later once samples are updated runtime/include/ie) -install(FILES $/plugins.xml - DESTINATION ${IE_CPACK_RUNTIME_PATH} - COMPONENT core) - -# for InferenceEngineUnitTest -if(WIN32) - install(FILES $/plugins.xml - DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) -else() +if(BUILD_SHARED_LIBS) install(FILES $/plugins.xml - DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) + DESTINATION ${IE_CPACK_RUNTIME_PATH} + COMPONENT core) + + # for InferenceEngineUnitTest + if(WIN32) + install(FILES $/plugins.xml + DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL) + else() + install(FILES $/plugins.xml + DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) + endif() endif() +# Install static libraries for case BUILD_SHARED_LIBS=OFF + +ov_install_static_lib(${TARGET_NAME}_plugin_api core) + # Install cmake scripts -if(BUILD_SHARED_LIBS) - install(EXPORT OpenVINOTargets - FILE OpenVINOTargets.cmake - NAMESPACE openvino:: - DESTINATION runtime/cmake - COMPONENT core_dev) -endif() +install(EXPORT OpenVINOTargets + FILE OpenVINOTargets.cmake + NAMESPACE openvino:: + DESTINATION runtime/cmake + COMPONENT core_dev) set(IE_NGRAPH_DIR "${CMAKE_BINARY_DIR}/ngraph") set(IE_INCLUDE_DIR "${PUBLIC_HEADERS_DIR}/ie") @@ -349,6 +364,7 @@ configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOCo set(IE_INCLUDE_DIR "include/ie") set(IE_NGRAPH_DIR ".") set(IE_TBB_DIR "${IE_TBB_DIR_INSTALL}") +set(IE_TBBBIND_DIR "${IE_TBBBIND_DIR_INSTALL}") set(IE_PARALLEL_CMAKE "cmake/ie_parallel.cmake") configure_package_config_file("${OpenVINO_SOURCE_DIR}/cmake/templates/InferenceEngineConfig.cmake.in" diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt index 1bf44deb97cc55..d9158ef5ba139d 100644 --- a/inference-engine/src/legacy_api/CMakeLists.txt +++ b/inference-engine/src/legacy_api/CMakeLists.txt @@ -26,7 +26,7 @@ endif() file(TOUCH ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp) -add_library(${TARGET_NAME}_obj OBJECT +add_library(${TARGET_NAME}_obj OBJECT EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS}) @@ -53,7 +53,7 @@ add_cpplint_target(${TARGET_NAME}_obj_cpplint FOR_TARGETS ${TARGET_NAME}_obj) # Create library -add_library(${TARGET_NAME} +add_library(${TARGET_NAME} EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp $) @@ -64,7 +64,8 @@ target_link_libraries(${TARGET_NAME} PUBLIC inference_engine PRIVATE pugixml::static openvino::itt ngraph inference_engine_transformations) -target_include_directories(${TARGET_NAME} INTERFACE ${PUBLIC_HEADERS_DIR}) +target_include_directories(${TARGET_NAME} INTERFACE + $) ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) @@ -79,6 +80,10 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA # install -install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +if(BUILD_SHARED_LIBS) + install(TARGETS ${TARGET_NAME} + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +else() + ov_install_static_lib(${TARGET_NAME} core) +endif() diff --git a/inference-engine/src/low_precision_transformations/CMakeLists.txt b/inference-engine/src/low_precision_transformations/CMakeLists.txt index 10c7162ecb7003..4cbb9c1b33ca0f 100644 --- a/inference-engine/src/low_precision_transformations/CMakeLists.txt +++ b/inference-engine/src/low_precision_transformations/CMakeLists.txt @@ -17,13 +17,11 @@ source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -add_library(${TARGET_NAME} +add_library(${TARGET_NAME} EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS}) -ie_faster_build(${TARGET_NAME} - UNITY -) +ie_faster_build(${TARGET_NAME} UNITY) ie_add_vs_version_file(NAME ${TARGET_NAME} FILEDESCRIPTION "Inference Engine LP transformations library") @@ -31,7 +29,8 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} target_link_libraries(${TARGET_NAME} PUBLIC inference_engine_transformations PRIVATE openvino::itt) -target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR}) +target_include_directories(${TARGET_NAME} PUBLIC + $) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) @@ -47,6 +46,10 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA # install -install(TARGETS ${TARGET_NAME} - RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core - LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +if(BUILD_SHARED_LIBS) + install(TARGETS ${TARGET_NAME} + RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core + LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +else() + ov_install_static_lib(${TARGET_NAME} core) +endif() diff --git a/inference-engine/src/preprocessing/CMakeLists.txt b/inference-engine/src/preprocessing/CMakeLists.txt index e3c52c8236d21b..29e415e9ade136 100644 --- a/inference-engine/src/preprocessing/CMakeLists.txt +++ b/inference-engine/src/preprocessing/CMakeLists.txt @@ -139,8 +139,9 @@ else() target_link_libraries(inference_engine PRIVATE ${TARGET_NAME}) endif() -target_include_directories(${TARGET_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}" - $) +target_include_directories(${TARGET_NAME} INTERFACE + $ + $) # Workaround to avoid warnings caused with bug in the avx512intrin.h of GCC5 if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND @@ -185,5 +186,9 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA # install -install(TARGETS ${TARGET_NAME} - LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core) +if(BUILD_SHARED_LIBS) + install(TARGETS ${TARGET_NAME} + LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core) +else() + ov_install_static_lib(${TARGET_NAME} core) +endif() diff --git a/inference-engine/src/readers/CMakeLists.txt b/inference-engine/src/readers/CMakeLists.txt index 46028205d37932..29cd6e6c3277f2 100644 --- a/inference-engine/src/readers/CMakeLists.txt +++ b/inference-engine/src/readers/CMakeLists.txt @@ -8,9 +8,11 @@ set(TARGET_NAME inference_engine_reader_api) add_library(${TARGET_NAME} INTERFACE) target_include_directories(${TARGET_NAME} INTERFACE - "${CMAKE_CURRENT_SOURCE_DIR}/reader_api" + $ $) +ov_install_static_lib(${TARGET_NAME} core) + file(GLOB_RECURSE reader_api_hpp "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.hpp") add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${reader_api_hpp}) diff --git a/inference-engine/src/readers/ir_reader_v7/CMakeLists.txt b/inference-engine/src/readers/ir_reader_v7/CMakeLists.txt index 846b831825be81..d53fc13abc7d1e 100644 --- a/inference-engine/src/readers/ir_reader_v7/CMakeLists.txt +++ b/inference-engine/src/readers/ir_reader_v7/CMakeLists.txt @@ -55,6 +55,8 @@ endif() add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) +# Install rules + # for ieFuncTests install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL) @@ -67,3 +69,5 @@ else() install(TARGETS ${TARGET_NAME} LIBRARY DESTINATION tests/lib COMPONENT tests EXCLUDE_FROM_ALL) endif() + +ov_install_static_lib(${TARGET_NAME} core) diff --git a/inference-engine/src/snippets/CMakeLists.txt b/inference-engine/src/snippets/CMakeLists.txt index db2c8413083c4e..334c2b8fb312a6 100644 --- a/inference-engine/src/snippets/CMakeLists.txt +++ b/inference-engine/src/snippets/CMakeLists.txt @@ -17,7 +17,7 @@ source_group("include" FILES ${PUBLIC_HEADERS}) # Create library -add_library(${TARGET_NAME} +add_library(${TARGET_NAME} EXCLUDE_FROM_ALL ${LIBRARY_SRC} ${PUBLIC_HEADERS}) @@ -53,9 +53,13 @@ openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${TARGET_NA # install # TODO: uncomment once snippets are integrated into CPU plugin -# install(TARGETS ${TARGET_NAME} -# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core -# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +# if(BUILD_SHARED_LIBS) +# install(TARGETS ${TARGET_NAME} +# RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT core +# LIBRARY DESTINATION ${IE_CPACK_LIBRARY_PATH} COMPONENT core) +# else() +# ov_install_static_lib(${TARGET_NAME} core) +# endif() # TODO: remove once install commands above are commented out install(TARGETS ${TARGET_NAME} diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt index d8b55be48257e8..6b9800394cb2ad 100644 --- a/inference-engine/src/vpu/common/CMakeLists.txt +++ b/inference-engine/src/vpu/common/CMakeLists.txt @@ -33,7 +33,7 @@ function(add_common_target TARGET_NAME STATIC_IE) target_include_directories(${TARGET_NAME} PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include") + $) target_include_directories(${TARGET_NAME} SYSTEM PUBLIC $ @@ -58,6 +58,8 @@ function(add_common_target TARGET_NAME STATIC_IE) if(NOT STATIC_IE) target_link_libraries(${TARGET_NAME} PUBLIC inference_engine_legacy) endif() + + ov_install_static_lib(${TARGET_NAME} myriad) endfunction() add_common_target("vpu_common_lib" FALSE) diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt index 8fdae7418b4174..4bcf6c3295b269 100644 --- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt @@ -38,7 +38,7 @@ function(add_graph_transformer_target TARGET_NAME STATIC_IE) target_include_directories(${TARGET_NAME} PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include") + $) target_include_directories(${TARGET_NAME} PUBLIC @@ -67,6 +67,7 @@ function(add_graph_transformer_target TARGET_NAME STATIC_IE) if(NOT STATIC_IE) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME} CUSTOM_FILTERS "+runtime/explicit") openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) + ov_install_static_lib(${TARGET_NAME} myriad) endif() set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) diff --git a/inference-engine/tests/functional/inference_engine/core_threading.cpp b/inference-engine/tests/functional/inference_engine/core_threading.cpp index c59e3538bbce90..5540fc933dbfbe 100644 --- a/inference-engine/tests/functional/inference_engine/core_threading.cpp +++ b/inference-engine/tests/functional/inference_engine/core_threading.cpp @@ -87,6 +87,9 @@ TEST_F(CoreThreadingTests, RegisterPlugin) { }, 4000); } +// TODO: CVS-68982 +#ifndef OPENVINO_STATIC_LIBRARY + // tested function: RegisterPlugins TEST_F(CoreThreadingTests, RegisterPlugins) { InferenceEngine::Core ie; @@ -123,6 +126,8 @@ TEST_F(CoreThreadingTests, RegisterPlugins) { }, 1000); } +#endif // !OPENVINO_STATIC_LIBRARY + // tested function: GetAvailableDevices, UnregisterPlugin // TODO: some initialization (e.g. thread/dlopen) sporadically fails during such stress-test scenario TEST_F(CoreThreadingTests, DISABLED_GetAvailableDevices) { diff --git a/inference-engine/tests/functional/inference_engine/ov_shared_object_test.cpp b/inference-engine/tests/functional/inference_engine/ov_shared_object_test.cpp index 8ae3850c0ee54a..30d7a7f0c92153 100644 --- a/inference-engine/tests/functional/inference_engine/ov_shared_object_test.cpp +++ b/inference-engine/tests/functional/inference_engine/ov_shared_object_test.cpp @@ -14,7 +14,7 @@ using namespace std; class SharedObjectOVTests : public ::testing::Test { protected: std::string get_mock_engine_name() { - return FileUtils::makePluginLibraryName(InferenceEngine::getIELibraryPath(), + return FileUtils::makePluginLibraryName({}, std::string("mock_engine") + IE_BUILD_POSTFIX); } diff --git a/inference-engine/tests/functional/inference_engine/shared_object_loader_test.cpp b/inference-engine/tests/functional/inference_engine/shared_object_loader_test.cpp index 411d87b3036548..fb1ab852c27305 100644 --- a/inference-engine/tests/functional/inference_engine/shared_object_loader_test.cpp +++ b/inference-engine/tests/functional/inference_engine/shared_object_loader_test.cpp @@ -15,7 +15,7 @@ using namespace InferenceEngine::details; class SharedObjectLoaderTests: public ::testing::Test { protected: std::string get_mock_engine_name() { - return FileUtils::makePluginLibraryName(getIELibraryPath(), + return FileUtils::makePluginLibraryName({}, std::string("mock_engine") + IE_BUILD_POSTFIX); } diff --git a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt index 0a904626e1e63a..a1c7d795127784 100644 --- a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt +++ b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt @@ -51,6 +51,7 @@ addIeTarget( lptNgraphFunctions sharedTestClasses PRIVATE + inference_engine_legacy # CVS-55376 openvino::util inference_engine_transformations DEPENDENCIES diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp index 0de6b629da6142..1b1704b472c0ca 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/ov_plugin/core_integration.hpp @@ -10,13 +10,11 @@ #include "common_test_utils/file_utils.hpp" #include "common_test_utils/unicode_utils.hpp" -#ifdef OPENVINO_OPENVINO_ENABLE_UNICODE_PATH_SUPPORT +#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT # include # define GTEST_COUT std::cerr << "[ ] [ INFO ] " # include # include - - #endif namespace ov { @@ -114,6 +112,9 @@ TEST_P(OVClassBasicTestP, registerExistingPluginThrows) { ASSERT_THROW(ie.register_plugin(pluginName, deviceName), ov::Exception); } +// TODO: CVS-68982 +#ifndef OPENVINO_STATIC_LIBRARY + TEST_P(OVClassBasicTestP, registerNewPluginNoThrows) { ov::runtime::Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.register_plugin(pluginName, "NEW_DEVICE_NAME")); @@ -150,7 +151,7 @@ TEST(OVClassBasicTest, smoke_createMockEngineConfigThrows) { #endif -#ifdef OPENVINO_OPENVINO_ENABLE_UNICODE_PATH_SUPPORT +#ifdef OPENVINO_ENABLE_UNICODE_PATH_SUPPORT TEST_P(OVClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { std::string pluginXML{"mock_engine_valid.xml"}; @@ -196,7 +197,8 @@ TEST_P(OVClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { CommonTestUtils::removeFile(pluginXML); } -#endif // OPENVINO_OPENVINO_ENABLE_UNICODE_PATH_SUPPORT +#endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT +#endif // !OPENVINO_STATIC_LIBRARY // // GetVersions() diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp index e95d4572dbc4aa..7213021011c6a5 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/plugin/core_integration.hpp @@ -106,6 +106,9 @@ TEST(IEClassBasicTest, smoke_createDefault) { ASSERT_NO_THROW(InferenceEngine::Core ie); } +// TODO: CVS-68982 +#ifndef OPENVINO_STATIC_LIBRARY + TEST_P(IEClassBasicTestP, registerExistingPluginThrows) { InferenceEngine::Core ie = BehaviorTestsUtils::createIECoreWithTemplate(); ASSERT_THROW(ie.RegisterPlugin(pluginName, deviceName), InferenceEngine::Exception); @@ -193,6 +196,7 @@ TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { } #endif // OPENVINO_ENABLE_UNICODE_PATH_SUPPORT +#endif // !OPENVINO_STATIC_LIBRARY // // GetVersions() diff --git a/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt b/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt index e48b259815533c..b66da71d4bdab8 100644 --- a/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt @@ -18,6 +18,7 @@ target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/pl target_link_libraries(${TARGET_NAME} PUBLIC funcTestUtils + inference_engine_legacy ieTestHelpers ) diff --git a/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt b/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt index fcda30314227c1..d8a66f328305a9 100644 --- a/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/gna/CMakeLists.txt @@ -20,8 +20,7 @@ if(ENABLE_HETERO) endif() if(ENABLE_MKL_DNN) - list(APPEND DEPENDENCIES - MKLDNNPlugin) + list(APPEND DEPENDENCIES MKLDNNPlugin) endif() add_executable(${TARGET_NAME} ${TEST_SRC} ${TEST_INCLUDE}) diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt index 4aea987153459d..b2ee1c12f434a9 100644 --- a/inference-engine/thirdparty/CMakeLists.txt +++ b/inference-engine/thirdparty/CMakeLists.txt @@ -24,6 +24,7 @@ if (ENABLE_CLDNN) set(CLDNN__INCLUDE_TESTS OFF CACHE BOOL "" FORCE) endif() add_subdirectory(clDNN) + ov_install_static_lib(clDNN_lib gpu) endif() function(ie_add_mkldnn) @@ -53,6 +54,7 @@ function(ie_add_mkldnn) add_subdirectory(mkl-dnn EXCLUDE_FROM_ALL) add_library(mkldnn ALIAS dnnl) + ov_install_static_lib(dnnl cpu) endfunction() if(ENABLE_MKL_DNN) diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt b/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt index 6c47bcec69d0a5..eeebbe2d9c7b02 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt @@ -168,5 +168,6 @@ add_custom_command( TARGET "${CLDNN_BUILD__PROJ}" POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${__CLDNN_Directory__core}/cache/cache.json ${CLDNN_CACHE_PATH}/cache.json) +ov_install_static_lib("${CLDNN_BUILD__PROJ}" gpu) # ====================================================================================================== diff --git a/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt b/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt index 0367cf831ddedb..2239c99505108b 100644 --- a/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/runtime/CMakeLists.txt @@ -69,7 +69,9 @@ target_link_libraries("${CLDNN_BUILD__PROJ}" PRIVATE if(ENABLE_ONEDNN_FOR_GPU) add_dependencies("${CLDNN_BUILD__PROJ}" onednn_gpu_build) target_link_libraries("${CLDNN_BUILD__PROJ}" PUBLIC ${ONEDNN_LIBRARY}) - target_include_directories("${CLDNN_BUILD__PROJ}" PUBLIC ${ONEDNN_INCLUDE_DIRS}) + foreach(dir IN LISTS ONEDNN_INCLUDE_DIRS) + target_include_directories("${CLDNN_BUILD__PROJ}" PUBLIC $) + endforeach() target_compile_definitions("${CLDNN_BUILD__PROJ}" PUBLIC ENABLE_ONEDNN_FOR_GPU) endif() @@ -80,4 +82,7 @@ elseif((NOT ANDROID) AND (UNIX)) endif() target_link_libraries("${CLDNN_BUILD__PROJ}" PRIVATE inference_engine) + +ov_install_static_lib("${CLDNN_BUILD__PROJ}" gpu) + # ====================================================================================================== diff --git a/inference-engine/thirdparty/clDNN/src/CMakeLists.txt b/inference-engine/thirdparty/clDNN/src/CMakeLists.txt index c0b86111581102..f86a7a431d3937 100644 --- a/inference-engine/thirdparty/clDNN/src/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/src/CMakeLists.txt @@ -129,7 +129,9 @@ target_link_libraries("${CLDNN_BUILD__PROJ}" PRIVATE if(ENABLE_ONEDNN_FOR_GPU) target_link_libraries("${CLDNN_BUILD__PROJ}" PUBLIC ${ONEDNN_LIBRARY}) - target_include_directories("${CLDNN_BUILD__PROJ}" PUBLIC ${ONEDNN_INCLUDE_DIRS}) + foreach(dir IN LISTS ONEDNN_INCLUDE_DIRS) + target_include_directories("${CLDNN_BUILD__PROJ}" PUBLIC $) + endforeach() target_compile_definitions("${CLDNN_BUILD__PROJ}" PUBLIC ENABLE_ONEDNN_FOR_GPU) endif() diff --git a/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt b/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt index bf513666b7d6da..ca5bc6a001562b 100644 --- a/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt +++ b/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt @@ -19,11 +19,10 @@ if(NOT WIN32) ${LIBUSB_LIBRARY}) endif() -target_include_directories(${TARGET_NAME} - PUBLIC - ${XLINK_INCLUDE} - PRIVATE - ${XLINK_PLATFORM_INCLUDE}) +target_include_directories(${TARGET_NAME} PRIVATE ${XLINK_PLATFORM_INCLUDE}) +foreach(dir IN LISTS XLINK_INCLUDE) + target_include_directories(${TARGET_NAME} PUBLIC $) +endforeach() target_compile_definitions(${TARGET_NAME} PRIVATE @@ -42,3 +41,4 @@ endif() set_property(TARGET ${TARGET_NAME} PROPERTY C_STANDARD 99) openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) +ov_install_static_lib(${TARGET_NAME} myriad) diff --git a/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt b/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt index 94d461ab911799..f62a65ea8390c6 100644 --- a/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt +++ b/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt @@ -10,15 +10,14 @@ include(${XLINK_DIR}/XLink.cmake) file(GLOB_RECURSE MVNC_SOURCES "include/*" "src/*") -set(WATCHDOG_INCLUDE - ${CMAKE_CURRENT_SOURCE_DIR}/include/watchdog/) +set(WATCHDOG_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/watchdog/) add_library(${TARGET_NAME} STATIC ${MVNC_SOURCES}) target_include_directories(${TARGET_NAME} PUBLIC - "${CMAKE_CURRENT_SOURCE_DIR}/include" - ${WATCHDOG_INCLUDE} + $ + $ PRIVATE ${XLINK_INCLUDE} ${XLINK_PLATFORM_INCLUDE}) @@ -74,6 +73,7 @@ if(NOT WIN32) endif() openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) +ov_install_static_lib(${TARGET_NAME} myriad) if(ENABLE_TESTS AND ENABLE_MYRIAD_MVNC_TESTS) add_subdirectory(tests) diff --git a/ngraph/core/CMakeLists.txt b/ngraph/core/CMakeLists.txt index f93cdfd83bd065..2d382929019159 100644 --- a/ngraph/core/CMakeLists.txt +++ b/ngraph/core/CMakeLists.txt @@ -77,7 +77,7 @@ if(NOT BUILD_SHARED_LIBS) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - # ngraph is linked against ngraph_builders, ngraph_reference static libraries + # ngraph is linked against ngraph_builders, ngraph_reference, ov_shape_inference static libraries # which include ngraph headers with dllimport attribute. Linker complains about it # but no way to fix this: linking with no attribute defaults to dllexport and we have # multiple defitions for ngraph symbols. @@ -85,7 +85,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # The possible way is to use object libraries for ngraph_builders, ngraph_reference # but it's not convinient since these libraries are exported from build tree # and it's better to use them as static libraries in 3rd party projects - set_target_properties(ngraph PROPERTIES LINK_FLAGS "/IGNORE:4217,4286") + if(BUILD_SHARED_LIBS) + set(link_type PRIVATE) + else() + set(link_type PUBLIC) + endif() + + target_link_options(ngraph ${link_type} "/IGNORE:4217,4286") endif() # some sources are located in ngraph, while headers are in inference_engine_transformations diff --git a/ngraph/core/builder/CMakeLists.txt b/ngraph/core/builder/CMakeLists.txt index b5953a6f1709db..b6c2fb0c0cc45d 100644 --- a/ngraph/core/builder/CMakeLists.txt +++ b/ngraph/core/builder/CMakeLists.txt @@ -15,7 +15,7 @@ set(BUILDER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/) source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) -# Create shared library +# Create static library add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) if(COMMAND ie_faster_build) @@ -25,14 +25,21 @@ if(COMMAND ie_faster_build) ) endif() -# Defines macro in C++ to load backend plugin -target_include_directories(${TARGET_NAME} PUBLIC ${BUILDER_INCLUDE_DIR} ${NGRAPH_INCLUDE_PATH}) +target_include_directories(${TARGET_NAME} PUBLIC + $ + $) + +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(${TARGET_NAME} PUBLIC OPENVINO_STATIC_LIBRARY) +endif() add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) # Add an alias so that library can be used inside the build tree, e.g. when testing add_library(ngraph::builder ALIAS ${TARGET_NAME}) +ov_install_static_lib(ngraph_builders ngraph) + # developer package openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph::builder) diff --git a/ngraph/core/include/openvino/core/extension.hpp b/ngraph/core/include/openvino/core/extension.hpp index 9e997336ac985e..6b8860387706bc 100644 --- a/ngraph/core/include/openvino/core/extension.hpp +++ b/ngraph/core/include/openvino/core/extension.hpp @@ -16,8 +16,8 @@ # define OPENVINO_EXTENSION_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS # define OPENVINO_EXTENSION_API OPENVINO_CORE_EXPORTS #else -# define OPENVINO_EXTENSION_C_API OPENVINO_EXTERN_C OPENVINO_API -# define OPENVINO_EXTENSION_API OPENVINO_API +# define OPENVINO_EXTENSION_C_API OPENVINO_EXTERN_C OPENVINO_CORE_EXPORTS +# define OPENVINO_EXTENSION_API OPENVINO_CORE_EXPORTS #endif namespace ov { @@ -27,7 +27,7 @@ class Extension; /** * @brief The class provides the base interface for OpenVINO extensions */ -class OPENVINO_API Extension : public std::enable_shared_from_this { +class OPENVINO_API Extension { public: using Ptr = std::shared_ptr; diff --git a/ngraph/core/reference/CMakeLists.txt b/ngraph/core/reference/CMakeLists.txt index 99c82bf32bbb93..e7b1d1bb20bb3f 100644 --- a/ngraph/core/reference/CMakeLists.txt +++ b/ngraph/core/reference/CMakeLists.txt @@ -15,7 +15,7 @@ set(REF_IMPL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) -# Create shared library +# Create static library add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) if(COMMAND ie_faster_build) @@ -31,8 +31,13 @@ endif() target_compile_definitions(${TARGET_NAME} PRIVATE XBYAK_NO_OP_NAMES XBYAK64) -# Defines macro in C++ to load backend plugin -target_include_directories(${TARGET_NAME} PUBLIC ${REF_IMPL_INCLUDE_DIR} ${NGRAPH_INCLUDE_PATH}) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(${TARGET_NAME} PUBLIC OPENVINO_STATIC_LIBRARY) +endif() + +target_include_directories(${TARGET_NAME} PUBLIC + $ + $) link_system_libraries(${TARGET_NAME} PRIVATE xbyak) @@ -41,5 +46,7 @@ add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) # Add an alias so that library can be used inside the build tree, e.g. when testing add_library(ngraph::reference ALIAS ${TARGET_NAME}) +ov_install_static_lib(${TARGET_NAME} ngraph) + # developer package openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph::reference) diff --git a/ngraph/core/shape_inference/CMakeLists.txt b/ngraph/core/shape_inference/CMakeLists.txt index 23897095fce754..f769ae59d3ef76 100644 --- a/ngraph/core/shape_inference/CMakeLists.txt +++ b/ngraph/core/shape_inference/CMakeLists.txt @@ -15,11 +15,18 @@ set(SHAPE_INFER_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") source_group("src" FILES ${LIBRARY_SRC}) source_group("include" FILES ${PUBLIC_HEADERS}) -# Create shared library +# Create static library add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) -# Defines macro in C++ to load backend plugin -target_include_directories(${TARGET_NAME} PUBLIC ${SHAPE_INFER_INCLUDE_DIR} ${NGRAPH_INCLUDE_PATH}) +target_include_directories(${TARGET_NAME} PUBLIC + $ + $) + +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(${TARGET_NAME} PUBLIC OPENVINO_STATIC_LIBRARY) +endif() + +ov_install_static_lib(${TARGET_NAME} ngraph) # developer package openvino_developer_export_targets(COMPONENT ngraph TARGETS ${TARGET_NAME}) diff --git a/ngraph/frontend/frontend_manager/CMakeLists.txt b/ngraph/frontend/frontend_manager/CMakeLists.txt index 8ac00ebef8761a..ada2b275ea1aa6 100644 --- a/ngraph/frontend/frontend_manager/CMakeLists.txt +++ b/ngraph/frontend/frontend_manager/CMakeLists.txt @@ -27,9 +27,11 @@ source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS}) add_library(${TARGET_NAME}_static STATIC ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}) add_library(${TARGET_NAME}::static ALIAS ${TARGET_NAME}_static) target_link_libraries(${TARGET_NAME}_static PRIVATE ${CMAKE_DL_LIBS} openvino::util PUBLIC ngraph) -target_include_directories(${TARGET_NAME}_static PUBLIC ${FRONTEND_INCLUDE_DIR}) +target_include_directories(${TARGET_NAME}_static PUBLIC + $) target_include_directories(${TARGET_NAME}_static PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) target_compile_definitions(${TARGET_NAME}_static PUBLIC USE_STATIC_FRONTEND_MANAGER) +ov_install_static_lib(${TARGET_NAME}_static ngraph) # Shared library - need to recompile object files to export necessary symbols diff --git a/ngraph/test/engines_util/CMakeLists.txt b/ngraph/test/engines_util/CMakeLists.txt index 49639ae1662319..4f39565c210d23 100644 --- a/ngraph/test/engines_util/CMakeLists.txt +++ b/ngraph/test/engines_util/CMakeLists.txt @@ -11,7 +11,7 @@ if(COMMAND ie_faster_build) endif() target_include_directories(engines_test_util PRIVATE $) -target_link_libraries(engines_test_util PUBLIC ngraph ngraph_backend gtest gmock ngraph_test_util) +target_link_libraries(engines_test_util PUBLIC ngraph ngraph_backend inference_engine gtest gmock ngraph_test_util) target_include_directories(engines_test_util PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) add_clang_format_target(engines_test_util_clang FOR_SOURCES ${ENGINES_UTIL_SRC}) diff --git a/ngraph/test/extension.cpp b/ngraph/test/extension.cpp index 2fcc2be9be27ce..4dccb828a840f9 100644 --- a/ngraph/test/extension.cpp +++ b/ngraph/test/extension.cpp @@ -11,40 +11,8 @@ #include "openvino/util/file_util.hpp" #include "so_extension.hpp" -#ifdef _WIN32 -# ifndef NOMINMAX -# define NOMINMAX -# endif -# include -# if defined(WINAPI_FAMILY) && !WINAPI_PARTITION_DESKTOP -# error "Only WINAPI_PARTITION_DESKTOP is supported, because of LoadLibrary[A|W]" -# endif -#elif defined(__linux) || defined(__APPLE__) -# include -#endif - -static std::string find_my_pathname() { -#ifdef _WIN32 - HMODULE hModule = GetModuleHandleW(SHARED_LIB_PREFIX L"ngraph" SHARED_LIB_SUFFIX); - WCHAR wpath[MAX_PATH]; - GetModuleFileNameW(hModule, wpath, MAX_PATH); - std::wstring ws(wpath); - std::string path(ws.begin(), ws.end()); - replace(path.begin(), path.end(), '\\', '/'); - path = ov::util::get_directory(path); - path += "/"; - return path; -#elif defined(__linux) || defined(__APPLE__) - Dl_info dl_info; - dladdr(reinterpret_cast(ov::replace_output_update_name), &dl_info); - return ov::util::get_directory(dl_info.dli_fname); -#else -# error "Unsupported OS" -#endif -} -std::string get_extension_path() { - return ov::util::make_plugin_library_name(find_my_pathname(), - std::string("template_ov_extension") + IE_BUILD_POSTFIX); +inline std::string get_extension_path() { + return ov::util::make_plugin_library_name({}, std::string("template_ov_extension") + IE_BUILD_POSTFIX); } TEST(extension, load_extension) { @@ -52,9 +20,8 @@ TEST(extension, load_extension) { } TEST(extension, load_extension_and_cast) { - std::vector so_extensions; - EXPECT_NO_THROW(so_extensions = ov::detail::load_extensions(get_extension_path())); - EXPECT_EQ(1, so_extensions.size()); + std::vector so_extensions = ov::detail::load_extensions(get_extension_path()); + ASSERT_EQ(1, so_extensions.size()); std::vector extensions; std::vector> so; for (const auto& ext : so_extensions) { diff --git a/ngraph/test/frontend/shared/CMakeLists.txt b/ngraph/test/frontend/shared/CMakeLists.txt index c048c3bfb7c85c..1c7f2aa6fedef3 100644 --- a/ngraph/test/frontend/shared/CMakeLists.txt +++ b/ngraph/test/frontend/shared/CMakeLists.txt @@ -12,6 +12,6 @@ add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${LIBRARY_HEADERS}) target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../..) target_link_libraries(${TARGET_NAME} PUBLIC frontend_manager - ngraph::ngraph cnpy ie_backend ngraph_test_util engines_test_util commonTestUtils openvino::util) + ngraph cnpy commonTestUtils ie_backend ngraph_test_util engines_test_util openvino::util) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) diff --git a/ngraph/test/opset.cpp b/ngraph/test/opset.cpp index 90a106b1cbcf49..a4b16ac49aef87 100644 --- a/ngraph/test/opset.cpp +++ b/ngraph/test/opset.cpp @@ -196,17 +196,18 @@ TEST(opset, custom_opset) { ov::OpSet opset; #ifndef OPENVINO_STATIC_LIBRARY opset.insert(); - opset.insert(); - opset.insert(); #endif + opset.insert(); + opset.insert(); opset.insert(); #ifdef OPENVINO_STATIC_LIBRARY - ASSERT_EQ(opset.get_types_info().size(), 1); + EXPECT_EQ(opset.get_types_info().size(), 2); #else - ASSERT_EQ(opset.get_types_info().size(), 3); + EXPECT_EQ(opset.get_types_info().size(), 3); + EXPECT_TRUE(opset.contains_type("MyOpOld")); + // TODO: why is it not registered? + EXPECT_TRUE(opset.contains_type("MyOpNewFromOld")); #endif - ASSERT_TRUE(opset.contains_type("MyOpNew")); - ASSERT_TRUE(opset.contains_type("MyOpOld")); - ASSERT_TRUE(opset.contains_type("MyOpNewFromOld")); - ASSERT_FALSE(opset.contains_type("MyOpIncorrect")); + EXPECT_TRUE(opset.contains_type("MyOpNew")); + EXPECT_FALSE(opset.contains_type("MyOpIncorrect")); } diff --git a/ngraph/test/runtime/CMakeLists.txt b/ngraph/test/runtime/CMakeLists.txt index 3b562478e706bc..de6a433df1a9c1 100644 --- a/ngraph/test/runtime/CMakeLists.txt +++ b/ngraph/test/runtime/CMakeLists.txt @@ -44,7 +44,8 @@ target_link_libraries(ngraph_backend PUBLIC ngraph if (NOT WIN32) target_link_libraries(ngraph_backend PRIVATE ${CMAKE_DL_LIBS}) endif() -target_include_directories(ngraph_backend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(ngraph_backend PUBLIC + $) install(TARGETS ngraph_backend RUNTIME DESTINATION ${IE_CPACK_RUNTIME_PATH} COMPONENT tests EXCLUDE_FROM_ALL diff --git a/openvino/conditional_compilation/CMakeLists.txt b/openvino/conditional_compilation/CMakeLists.txt index 6c786d401a28a7..70fb4484e7692f 100644 --- a/openvino/conditional_compilation/CMakeLists.txt +++ b/openvino/conditional_compilation/CMakeLists.txt @@ -10,7 +10,8 @@ add_library(openvino::conditional_compilation ALIAS ${TARGET_NAME}) target_link_libraries(${TARGET_NAME} INTERFACE openvino::itt) -target_include_directories(${TARGET_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(${TARGET_NAME} INTERFACE + $) if(SELECTIVE_BUILD STREQUAL "COLLECT") target_compile_definitions(${TARGET_NAME} INTERFACE SELECTIVE_BUILD_ANALYZER) @@ -45,5 +46,7 @@ elseif(SELECTIVE_BUILD STREQUAL "ON") ov_force_include(${TARGET_NAME} INTERFACE ${GENERATED_HEADER}) endif() +ov_install_static_lib(${TARGET_NAME} ngraph) + file(GLOB_RECURSE hdrs ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp) add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${hdrs}) diff --git a/openvino/itt/CMakeLists.txt b/openvino/itt/CMakeLists.txt index d45b9857ada43a..9be020f86cc7e0 100644 --- a/openvino/itt/CMakeLists.txt +++ b/openvino/itt/CMakeLists.txt @@ -30,6 +30,9 @@ if (CMAKE_COMPILER_IS_GNUCXX) target_compile_options(${TARGET_NAME} PRIVATE -Wall) endif() -target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(${TARGET_NAME} PUBLIC + $) + +ov_install_static_lib(${TARGET_NAME} ngraph) add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME}) diff --git a/openvino/pp/CMakeLists.txt b/openvino/pp/CMakeLists.txt index 9583171dcbce60..e2060db6b3fae3 100644 --- a/openvino/pp/CMakeLists.txt +++ b/openvino/pp/CMakeLists.txt @@ -8,4 +8,7 @@ add_library(${TARGET_NAME} INTERFACE) add_library(openvino::pp ALIAS ${TARGET_NAME}) -target_include_directories(${TARGET_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) +target_include_directories(${TARGET_NAME} INTERFACE + $) + +ov_install_static_lib(${TARGET_NAME} ngraph) diff --git a/openvino/util/CMakeLists.txt b/openvino/util/CMakeLists.txt index 54c9082810c67e..547e77783ec59e 100644 --- a/openvino/util/CMakeLists.txt +++ b/openvino/util/CMakeLists.txt @@ -33,7 +33,10 @@ add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS}) add_library(openvino::util ALIAS ${TARGET_NAME}) target_link_libraries(${TARGET_NAME} PRIVATE ${CMAKE_DL_LIBS}) -target_include_directories(${TARGET_NAME} PUBLIC ${UTIL_INCLUDE_DIR}) +target_include_directories(${TARGET_NAME} PUBLIC + $) + +ov_install_static_lib(${TARGET_NAME} ngraph) add_clang_format_target(${TARGET_NAME}_clang FOR_TARGETS ${TARGET_NAME}) ov_ncc_naming_style(FOR_TARGET ${TARGET_NAME} diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 781e75a34ece54..9b06ee3edf8723 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -20,6 +20,7 @@ endif() add_subdirectory(xbyak EXCLUDE_FROM_ALL) openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak) +ov_install_static_lib(xbyak openvino_common) # # Pugixml @@ -35,6 +36,7 @@ else() add_subdirectory(pugixml EXCLUDE_FROM_ALL) set_property(TARGET pugixml-static PROPERTY EXPORT_NAME pugixml) openvino_developer_export_targets(COMPONENT openvino_common TARGETS pugixml::static) + ov_install_static_lib(pugixml-static openvino_common) endfunction() ie_build_pugixml() @@ -52,6 +54,9 @@ add_subdirectory(fluid/modules/gapi EXCLUDE_FROM_ALL) set_target_properties(ade fluid PROPERTIES FOLDER thirdparty) openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade fluid) +ov_install_static_lib(ade openvino_common) +ov_install_static_lib(fluid openvino_common) + # # Gflags # diff --git a/thirdparty/ittapi/CMakeLists.txt b/thirdparty/ittapi/CMakeLists.txt index c50ff92fa272b3..e595c9dddd40a5 100644 --- a/thirdparty/ittapi/CMakeLists.txt +++ b/thirdparty/ittapi/CMakeLists.txt @@ -18,6 +18,12 @@ if(ENABLE_PROFILING_ITT) target_compile_options(ittnotify PRIVATE -Wno-undef) endif() + # override INTERFACE_INCLUDE_DIRECTORIES + set_property(TARGET ittnotify PROPERTY INTERFACE_INCLUDE_DIRECTORIES + $ + $) + openvino_developer_export_targets(COMPONENT openvino_common TARGETS ittnotify) + ov_install_static_lib(ittnotify openvino_common) endif() endif() diff --git a/thirdparty/ocl/CMakeLists.txt b/thirdparty/ocl/CMakeLists.txt index a0648080ea13a6..3a2faa64624073 100644 --- a/thirdparty/ocl/CMakeLists.txt +++ b/thirdparty/ocl/CMakeLists.txt @@ -43,10 +43,17 @@ set(CMAKE_C_FLAGS "") set(CMAKE_CXX_FLAGS "") set(CMAKE_C_FLAGS_RELEASE "") set(CMAKE_CXX_FLAGS_RELEASE "") +# OpenCL has absolute paths to include directories +set(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION OFF) add_subdirectory(icd_loader) -target_include_directories(OpenCL SYSTEM PUBLIC ${OPENCL_HEADERS_DIR}) +# override INTERFACE_INCLUDE_DIRECTORIES +set_property(TARGET OpenCL PROPERTY INTERFACE_INCLUDE_DIRECTORIES + $) +foreach(dir IN LISTS OPENCL_HEADERS_DIR) + target_include_directories(OpenCL SYSTEM PUBLIC $) +endforeach() # The following varables are needed to make find_package(OpenCL) work set(OPENCL_VERSION_2_2 ON CACHE BOOL "" FORCE) @@ -58,3 +65,5 @@ get_lib_path("${OUTPUT_ROOT}/${BIN_FOLDER}" OPENCL_LIB_DIR) get_lib_name("OpenCL" OPENCL_LIB_NAME) set(OpenCL_LIBRARY "${OPENCL_LIB_DIR}/${OPENCL_LIB_NAME}" CACHE PATH "" FORCE) + +ov_install_static_lib(OpenCL gpu)