From 80dfb26c48e2b64f99781ce566da0cc3e7e0d837 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Tue, 22 Dec 2020 18:44:59 +0300 Subject: [PATCH] Introduce IEDevScripts package (#3661) * Refactored developer package * Added fuzzing for CMAKE_MODULE_LINKER_FLAGS as well * Added options for developer package * More improvements * Further improvements * Removed global CMAKE_MODULE_PATH population * Fixes * Final fixes * Fixed python build * Fix for TBB * Fixed Find TBB * Fixed install * Fixes for OV features * Split developer targets per component * Fixed IE build tree config * Fixed ITT * Fixed review comments * Clean export dependencies * Fixed export of pugixml * Added IEDevScripts_DIR for Android * Fixed Android #2 * Fixed Android #3 * Fixed python cc * Disabled Core threading tests on GNA --- .ci/azure/linux_ngraph_onnx.yml | 2 +- .ci/openvino-onnx/Dockerfile | 2 - CMakeLists.txt | 50 +++-- cmake/check_features.cmake | 35 ---- cmake/dependencies.cmake | 2 - .../developer_package}/FindTBB.cmake | 5 +- .../IEDevScriptsConfig.cmake} | 174 +++++++----------- .../developer_package}/add_ie_target.cmake | 10 +- .../api_validator/api_validator.cmake | 2 +- .../api_validator/api_validator_run.cmake | 0 .../clang_format/clang_format.cmake | 8 +- .../clang_format/clang_format_check.cmake | 0 .../clang_format/clang_format_fix.cmake | 0 .../compile_flags}/os_flags.cmake | 0 .../compile_flags}/sanitizer.cmake | 0 .../compile_flags}/sdl.cmake | 0 .../coverage/coverage.cmake | 2 +- .../coverage/coverage_clean.cmake | 0 .../coverage/coverage_merge.cmake | 0 .../cpplint/cpplint.cmake | 76 +------- .../cpplint/cpplint.py | 0 .../cpplint/cpplint_html.cmake | 0 .../cpplint/cpplint_merge.cmake | 0 .../cpplint/cpplint_run.cmake | 0 .../cpplint/cpplint_to_cppcheck_xml.cmake | 0 .../cross_compiled_disp_gen.cmake | 0 .../cross_compiled_disp_gen_options.in | 0 .../cross_compile/cross_compiled_func.cmake | 0 cmake/{ => developer_package}/debug.cmake | 0 .../download/dependency_solver.cmake | 2 +- .../download/download.cmake | 4 +- .../download/download_and_apply.cmake | 0 .../download/download_and_check.cmake | 0 .../download/download_and_extract.cmake | 4 +- .../download/extract.cmake | 0 .../faster_build.cmake | 0 cmake/developer_package/features.cmake | 74 ++++++++ cmake/{ => developer_package}/fuzzing.cmake | 3 +- .../developer_package}/linux_name.cmake | 5 +- .../developer_package}/models.cmake | 0 cmake/{ => developer_package}/options.cmake | 5 +- cmake/developer_package/packaging.cmake | 58 ++++++ .../plugins/create_plugin_file.cmake | 0 .../developer_package}/plugins/plugins.cmake | 6 +- .../plugins/register_plugin_cmake.cmake | 0 .../plugins/unregister_plugin_cmake.cmake | 0 .../shellcheck/shellcheck.cmake | 2 +- .../shellcheck/shellcheck_process.cmake | 0 .../target_flags.cmake | 0 .../tbb/lnx/TBBConfig.cmake | 0 .../tbb/mac/TBBConfig.cmake | 0 .../tbb/win/TBBConfig.cmake | 0 cmake/{ => developer_package}/version.cmake | 10 +- .../vs_version/vs_version.cmake | 2 +- .../vs_version/vs_version.rc.in | 0 .../whole_archive.cmake | 0 cmake/features.cmake | 52 +----- .../onecoreuap.toolchain.cmake | 0 cmake/{ => toolchains}/uwp.toolchain.cmake | 0 docs/CMakeLists.txt | 1 + inference-engine/CMakeLists.txt | 67 ++----- .../cmake/check_features_ie.cmake | 39 ---- .../{coverage_ie.cmake => coverage.cmake} | 0 inference-engine/cmake/dependencies.cmake | 29 +-- .../cmake/developer_package_ie.cmake | 8 - .../{features_ie.cmake => features.cmake} | 48 ++++- .../{FindlibGNA.cmake => libGNAConfig.cmake} | 0 .../InferenceEngineConfig-build.cmake.in} | 2 +- .../InferenceEngineConfig-version.cmake.in | 0 .../InferenceEngineConfig.cmake.in | 0 ...enceEngineDeveloperPackageConfig.cmake.in} | 34 ++-- inference-engine/cmake/vpu_dependencies.cmake | 11 +- .../ie_bridges/c/src/CMakeLists.txt | 3 +- .../ie_bridges/python/CMakeLists.txt | 5 +- .../{FindCython.cmake => CythonConfig.cmake} | 0 .../ie_bridges/python/cmake/UseCython.cmake | 5 +- .../src/gna_plugin/CMakeLists.txt | 4 +- .../src/inference_engine/CMakeLists.txt | 44 +++-- .../src/legacy_api/CMakeLists.txt | 4 - .../mkldnn_plugin/nodes/mkldnn_split_node.cpp | 2 +- .../src/vpu/common/CMakeLists.txt | 2 +- .../src/vpu/graph_transformer/CMakeLists.txt | 2 +- inference-engine/tests/CMakeLists.txt | 3 - .../behavior/core_threading_tests.cpp | 2 +- .../functional/plugin/shared/CMakeLists.txt | 1 + .../shared_test_classes/CMakeLists.txt | 1 + .../common_test_utils/CMakeLists.txt | 17 +- .../functional_test_utils/CMakeLists.txt | 7 +- .../unit_test_utils/CMakeLists.txt | 1 + .../lpt_ngraph_functions/CMakeLists.txt | 5 +- .../ngraph_functions/CMakeLists.txt | 9 +- .../behavior/shared_tests/CMakeLists.txt | 2 +- .../functional/ie_tests/CMakeLists.txt | 3 +- .../functional/shared_tests/CMakeLists.txt | 2 +- .../functional/vpu/CMakeLists.txt | 9 +- inference-engine/thirdparty/CMakeLists.txt | 6 +- ngraph/CMakeLists.txt | 8 +- ngraph/core/builder/CMakeLists.txt | 4 +- ngraph/core/reference/CMakeLists.txt | 2 +- openvino/CMakeLists.txt | 2 +- openvino/itt/CMakeLists.txt | 8 +- .../cmake/{FindITT.cmake => ITTConfig.cmake} | 0 tests/fuzz/CMakeLists.txt | 4 +- 103 files changed, 466 insertions(+), 535 deletions(-) delete mode 100644 cmake/check_features.cmake rename {inference-engine/cmake => cmake/developer_package}/FindTBB.cmake (93%) rename cmake/{developer_package.cmake => developer_package/IEDevScriptsConfig.cmake} (64%) rename {inference-engine/cmake => cmake/developer_package}/add_ie_target.cmake (96%) rename cmake/{ => developer_package}/api_validator/api_validator.cmake (97%) rename cmake/{ => developer_package}/api_validator/api_validator_run.cmake (100%) rename cmake/{ => developer_package}/clang_format/clang_format.cmake (92%) rename cmake/{ => developer_package}/clang_format/clang_format_check.cmake (100%) rename cmake/{ => developer_package}/clang_format/clang_format_fix.cmake (100%) rename cmake/{ => developer_package/compile_flags}/os_flags.cmake (100%) rename cmake/{ => developer_package/compile_flags}/sanitizer.cmake (100%) rename cmake/{ => developer_package/compile_flags}/sdl.cmake (100%) rename cmake/{ => developer_package}/coverage/coverage.cmake (99%) rename cmake/{ => developer_package}/coverage/coverage_clean.cmake (100%) rename cmake/{ => developer_package}/coverage/coverage_merge.cmake (100%) rename cmake/{ => developer_package}/cpplint/cpplint.cmake (52%) rename cmake/{ => developer_package}/cpplint/cpplint.py (100%) rename cmake/{ => developer_package}/cpplint/cpplint_html.cmake (100%) rename cmake/{ => developer_package}/cpplint/cpplint_merge.cmake (100%) rename cmake/{ => developer_package}/cpplint/cpplint_run.cmake (100%) rename cmake/{ => developer_package}/cpplint/cpplint_to_cppcheck_xml.cmake (100%) rename cmake/{ => developer_package}/cross_compile/cross_compiled_disp_gen.cmake (100%) rename cmake/{ => developer_package}/cross_compile/cross_compiled_disp_gen_options.in (100%) rename cmake/{ => developer_package}/cross_compile/cross_compiled_func.cmake (100%) rename cmake/{ => developer_package}/debug.cmake (100%) rename cmake/{ => developer_package}/download/dependency_solver.cmake (99%) rename cmake/{ => developer_package}/download/download.cmake (87%) rename cmake/{ => developer_package}/download/download_and_apply.cmake (100%) rename cmake/{ => developer_package}/download/download_and_check.cmake (100%) rename cmake/{ => developer_package}/download/download_and_extract.cmake (99%) rename cmake/{ => developer_package}/download/extract.cmake (100%) rename cmake/{ => developer_package}/faster_build.cmake (100%) create mode 100644 cmake/developer_package/features.cmake rename cmake/{ => developer_package}/fuzzing.cmake (89%) rename {inference-engine/cmake => cmake/developer_package}/linux_name.cmake (93%) rename {inference-engine/cmake => cmake/developer_package}/models.cmake (100%) rename cmake/{ => developer_package}/options.cmake (92%) create mode 100644 cmake/developer_package/packaging.cmake rename {inference-engine/cmake => cmake/developer_package}/plugins/create_plugin_file.cmake (100%) rename {inference-engine/cmake => cmake/developer_package}/plugins/plugins.cmake (96%) rename {inference-engine/cmake => cmake/developer_package}/plugins/register_plugin_cmake.cmake (100%) rename {inference-engine/cmake => cmake/developer_package}/plugins/unregister_plugin_cmake.cmake (100%) rename cmake/{ => developer_package}/shellcheck/shellcheck.cmake (94%) rename cmake/{ => developer_package}/shellcheck/shellcheck_process.cmake (100%) rename cmake/{ => developer_package}/target_flags.cmake (100%) rename {inference-engine/cmake => cmake/developer_package}/tbb/lnx/TBBConfig.cmake (100%) rename {inference-engine/cmake => cmake/developer_package}/tbb/mac/TBBConfig.cmake (100%) rename {inference-engine/cmake => cmake/developer_package}/tbb/win/TBBConfig.cmake (100%) rename cmake/{ => developer_package}/version.cmake (80%) rename cmake/{ => developer_package}/vs_version/vs_version.cmake (96%) rename cmake/{ => developer_package}/vs_version/vs_version.rc.in (100%) rename cmake/{ => developer_package}/whole_archive.cmake (100%) rename cmake/{ => toolchains}/onecoreuap.toolchain.cmake (100%) rename cmake/{ => toolchains}/uwp.toolchain.cmake (100%) delete mode 100644 inference-engine/cmake/check_features_ie.cmake rename inference-engine/cmake/{coverage_ie.cmake => coverage.cmake} (100%) delete mode 100644 inference-engine/cmake/developer_package_ie.cmake rename inference-engine/cmake/{features_ie.cmake => features.cmake} (83%) rename inference-engine/cmake/{FindlibGNA.cmake => libGNAConfig.cmake} (100%) rename inference-engine/cmake/{config.cmake.in => templates/InferenceEngineConfig-build.cmake.in} (96%) rename inference-engine/cmake/{share => templates}/InferenceEngineConfig-version.cmake.in (100%) rename inference-engine/cmake/{share => templates}/InferenceEngineConfig.cmake.in (100%) rename inference-engine/cmake/{developer_package_config.cmake.in => templates/InferenceEngineDeveloperPackageConfig.cmake.in} (59%) rename inference-engine/ie_bridges/python/cmake/{FindCython.cmake => CythonConfig.cmake} (100%) rename openvino/itt/cmake/{FindITT.cmake => ITTConfig.cmake} (100%) diff --git a/.ci/azure/linux_ngraph_onnx.yml b/.ci/azure/linux_ngraph_onnx.yml index f993670f98c95b..c6e363d7c99f19 100644 --- a/.ci/azure/linux_ngraph_onnx.yml +++ b/.ci/azure/linux_ngraph_onnx.yml @@ -64,7 +64,7 @@ jobs: - task: CMake@1 inputs: # CMake must get Python 3.x version by default - cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_VPU=OFF -DENABLE_GNA=OFF -DENABLE_OPENCV=OFF -DENABLE_CPPLINT=OFF -DENABLE_TESTS=OFF -DENABLE_BEH_TESTS=OFF -DENABLE_FUNCTIONAL_TESTS=OFF -DENABLE_MKL_DNN=ON -DENABLE_CLDNN=OFF -DENABLE_PROFILING_ITT=OFF -DENABLE_SAMPLES=OFF -DENABLE_SPEECH_DEMO=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DNGRAPH_ONNX_IMPORT_ENABLE=ON -DNGRAPH_INTERPRETER_ENABLE=ON -DNGRAPH_DEBUG_ENABLE=OFF -DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) $(REPO_DIR) + cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_VPU=OFF -DENABLE_GNA=OFF -DENABLE_OPENCV=OFF -DENABLE_CPPLINT=OFF -DENABLE_TESTS=OFF -DENABLE_MKL_DNN=ON -DENABLE_CLDNN=OFF -DENABLE_PROFILING_ITT=OFF -DENABLE_SAMPLES=OFF -DENABLE_SPEECH_DEMO=OFF -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DNGRAPH_ONNX_IMPORT_ENABLE=ON -DNGRAPH_INTERPRETER_ENABLE=ON -DNGRAPH_DEBUG_ENABLE=OFF -DNGRAPH_DYNAMIC_COMPONENTS_ENABLE=ON -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) $(REPO_DIR) workingDirectory: $(BUILD_DIR) enabled: false diff --git a/.ci/openvino-onnx/Dockerfile b/.ci/openvino-onnx/Dockerfile index 954b1634ed2a23..5fe36e46219061 100644 --- a/.ci/openvino-onnx/Dockerfile +++ b/.ci/openvino-onnx/Dockerfile @@ -57,8 +57,6 @@ RUN cmake .. \ -DENABLE_OPENCV=OFF \ -DENABLE_CPPLINT=OFF \ -DENABLE_TESTS=OFF \ - -DENABLE_BEH_TESTS=OFF \ - -DENABLE_FUNCTIONAL_TESTS=OFF \ -DENABLE_MKL_DNN=ON \ -DENABLE_CLDNN=OFF \ -DENABLE_PROFILING_ITT=OFF \ diff --git a/CMakeLists.txt b/CMakeLists.txt index ff0a58f05c21d2..80249ccccedfdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,17 +8,17 @@ project(OpenVINO) set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(IE_MAIN_SOURCE_DIR ${OpenVINO_MAIN_SOURCE_DIR}/inference-engine) -list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake") -include(CTest) -include(features) +find_package(IEDevScripts REQUIRED + PATHS "${OpenVINO_MAIN_SOURCE_DIR}/cmake/developer_package" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) -# include developer package -include(developer_package) +include(CTest) +include(cmake/features.cmake) # These options are shared with 3rdparty plugins by means of developer package -include(check_features) -include(dependencies) +include(cmake/dependencies.cmake) # resolving dependencies for the project message (STATUS "PROJECT ............................... " ${PROJECT_NAME}) @@ -30,8 +30,11 @@ message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE}) # remove file with exported developer targets to force its regeneration -file(REMOVE "${CMAKE_BINARY_DIR}/targets_developer.cmake") -file(REMOVE "${CMAKE_BINARY_DIR}/targets.cmake") +file(REMOVE "${CMAKE_BINARY_DIR}/inference_engine_targets.cmake") +foreach(component IN LISTS openvino_export_components) + file(REMOVE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake") + unset(${component} CACHE) +endforeach() # # Build @@ -45,7 +48,6 @@ function(build_ngraph) endfunction() set(NGRAPH_BUILD_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} CACHE STRING "" FORCE) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OpenVINO_MAIN_SOURCE_DIR}/ngraph/cmake/Modules/") if (ENABLE_SANITIZER) ngraph_set(NGRAPH_ADDRESS_SANITIZER TRUE) @@ -119,28 +121,36 @@ function(build_ngraph) set(NGRAPH_LIBRARIES ngraph PARENT_SCOPE) endfunction() -file(REMOVE "${CMAKE_BINARY_DIR}/openvino_targets_developer.cmake") -unset(OpenVINODeveloperPackageTargets CACHE) - function(openvino_developer_export_targets) - set(OpenVINODeveloperPackageTargets "${OpenVINODeveloperPackageTargets};${ARGV}") + cmake_parse_arguments(EXPORT "" "COMPONENT" "TARGETS" ${ARGN}) + + if(EXPORT_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "openvino_developer_export_targets has unparsed arguments: ${EXPORT_UNPARSED_ARGUMENTS}") + endif() + + set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}};${EXPORT_TARGETS}") # to allow exporting of aliased targets with the original names - foreach(target_name ${OpenVINODeveloperPackageTargets}) + foreach(target_name IN LISTS ${EXPORT_COMPONENT}) if(TARGET "${target_name}") get_target_property(original_name ${target_name} ALIASED_TARGET) if(TARGET "${original_name}") message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. " "It will be exported to the InferenceEngineDeveloperPackage with the original name.") - list(REMOVE_ITEM OpenVINODeveloperPackageTargets ${target_name}) - list(APPEND OpenVINODeveloperPackageTargets ${original_name}) + list(REMOVE_ITEM ${EXPORT_COMPONENT} ${target_name}) + list(APPEND ${EXPORT_COMPONENT} ${original_name}) endif() endif() endforeach() - list(REMOVE_DUPLICATES OpenVINODeveloperPackageTargets) - set(OpenVINODeveloperPackageTargets "${OpenVINODeveloperPackageTargets}" CACHE INTERNAL - "Paths to extra Inference Engine plugins" FORCE) + list(REMOVE_DUPLICATES ${EXPORT_COMPONENT}) + set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}}" CACHE INTERNAL + "A list of OpenVINO ${EXPORT_COMPONENT} exported targets" FORCE) + + list(APPEND openvino_export_components ${EXPORT_COMPONENT}) + list(REMOVE_DUPLICATES openvino_export_components) + set(openvino_export_components "${openvino_export_components}" CACHE INTERNAL + "A list of OpenVINO exported components" FORCE) endfunction() add_subdirectory(openvino) diff --git a/cmake/check_features.cmake b/cmake/check_features.cmake deleted file mode 100644 index 693227097eaa52..00000000000000 --- a/cmake/check_features.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2018-2020 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -if (VERBOSE_BUILD) - set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "" FORCE) -endif() - -#64 bits platform -if (CMAKE_SIZEOF_VOID_P EQUAL 8) - message(STATUS "Detected 64 bit architecture") - SET(ARCH_64 ON) -else() - message(STATUS "Detected 32 bit architecture") - SET(ARCH_64 OFF) -endif() - -if(ENABLE_AVX512F) - if ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") AND (MSVC_VERSION VERSION_LESS 1920)) - # 1920 version of MSVC 2019. In MSVC 2017 AVX512F not work - set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) - endif() - if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)) - set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) - endif() - if ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)) - # TBD: clarify which AppleClang version supports avx512 - set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) - endif() - if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)) - set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) - endif() -endif() - -print_enabled_features() diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 56f935789c0491..aed76147342d02 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -4,8 +4,6 @@ set_temp_directory(TEMP "${IE_MAIN_SOURCE_DIR}") -include(dependency_solver) - if(CMAKE_CROSSCOMPILING AND CMAKE_HOST_SYSTEM_NAME MATCHES Linux AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(protoc_version "3.7.1") diff --git a/inference-engine/cmake/FindTBB.cmake b/cmake/developer_package/FindTBB.cmake similarity index 93% rename from inference-engine/cmake/FindTBB.cmake rename to cmake/developer_package/FindTBB.cmake index 688e6fb46dc3ca..765b12e69eb3bb 100644 --- a/inference-engine/cmake/FindTBB.cmake +++ b/cmake/developer_package/FindTBB.cmake @@ -25,8 +25,9 @@ endif() find_package(TBB CONFIG - NO_DEFAULT_PATH PATHS ${TBBROOT}/cmake - ${CMAKE_CURRENT_LIST_DIR}/${IE_OWN_TBB_CONFIG} + ${IEDevScripts_DIR}/${IE_OWN_TBB_CONFIG} + NO_DEFAULT_PATH ) + find_package_handle_standard_args(TBB CONFIG_MODE) diff --git a/cmake/developer_package.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake similarity index 64% rename from cmake/developer_package.cmake rename to cmake/developer_package/IEDevScriptsConfig.cmake index b9ea3e3d3b78fd..df40b2a984d597 100644 --- a/cmake/developer_package.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -4,7 +4,27 @@ cmake_minimum_required(VERSION 3.13) +if(NOT DEFINED IEDevScripts_DIR) + message(FATAL_ERROR "IEDevScripts_DIR is not defined") +endif() + +set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +set(CMAKE_MODULE_PATH "${IEDevScripts_DIR}") + +function(set_ci_build_number) + set(repo_root "${CMAKE_SOURCE_DIR}") + include(version) + set(CI_BUILD_NUMBER "${CI_BUILD_NUMBER}" PARENT_SCOPE) +endfunction() + +set_ci_build_number() + +include(features) + +# # Detect target +# + include(target_flags) string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH_FOLDER) @@ -18,84 +38,10 @@ elseif(MSVC AND AARCH64) set(ARCH_FOLDER arm64) endif() -list(APPEND CMAKE_MODULE_PATH - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/download" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cross_compile") - -# -# CPack -# - -include(CPackComponent) -unset(IE_CPACK_COMPONENTS_ALL CACHE) - -set(IE_CPACK_IE_DIR deployment_tools/inference_engine) - -# Search packages for the host system instead of packages for the target system -# in case of cross compilation these macros should be defined by the toolchain file -if(NOT COMMAND find_host_package) - macro(find_host_package) - find_package(${ARGN}) - endmacro() -endif() -if(NOT COMMAND find_host_program) - macro(find_host_program) - find_program(${ARGN}) - endmacro() -endif() - -# -# ie_cpack_set_library_dir() # -# Set library directory for cpack +# Prepare temporary folder # -function(ie_cpack_set_library_dir) - if(WIN32) - set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) - set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) - set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) - else() - set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE) - set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE) - set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE) - endif() -endfunction() - -ie_cpack_set_library_dir() -# -# ie_cpack_add_component(NAME ...) -# -# Wraps original `cpack_add_component` and adds component to internal IE list -# -macro(ie_cpack_add_component NAME) - list(APPEND IE_CPACK_COMPONENTS_ALL ${NAME}) - set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE) - cpack_add_component(${NAME} ${ARGN}) -endmacro() - -macro(ie_cpack) - set(CPACK_GENERATOR "TGZ") - string(REPLACE "/" "_" CPACK_PACKAGE_VERSION "${CI_BUILD_NUMBER}") - if(WIN32) - set(CPACK_PACKAGE_NAME inference-engine_${CMAKE_BUILD_TYPE}) - else() - set(CPACK_PACKAGE_NAME inference-engine) - endif() - set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) - set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) - set(CPACK_PACKAGE_VENDOR "Intel") - set(CPACK_COMPONENTS_ALL ${ARGN}) - set(CPACK_STRIP_FILES ON) - - if(OS_FOLDER) - set(CPACK_SYSTEM_NAME "${OS_FOLDER}") - endif() - - include(CPack) -endmacro() - -# prepare temporary folder function(set_temp_directory temp_variable source_tree_dir) if (DEFINED ENV{DL_SDK_TEMP} AND NOT $ENV{DL_SDK_TEMP} STREQUAL "") message(STATUS "DL_SDK_TEMP environment is set : $ENV{DL_SDK_TEMP}") @@ -119,22 +65,37 @@ function(set_temp_directory temp_variable source_tree_dir) endif() endfunction() +# +# For cross-compilation +# + +# Search packages for the host system instead of packages for the target system +# in case of cross compilation these macros should be defined by the toolchain file +if(NOT COMMAND find_host_package) + macro(find_host_package) + find_package(${ARGN}) + endmacro() +endif() +if(NOT COMMAND find_host_program) + macro(find_host_program) + find_program(${ARGN}) + endmacro() +endif() + # # Common scripts # +include(packaging) include(coverage/coverage) include(shellcheck/shellcheck) -# External dependencies -find_package(Threads) - # printing debug messages include(debug) if(OS_FOLDER) message ("**** OS FOLDER IS: [${OS_FOLDER}]") - if("${OS_FOLDER}" STREQUAL "ON") + if(OS_FOLDER STREQUAL "ON") message ("**** USING OS FOLDER: [${CMAKE_SYSTEM_NAME}]") set(BIN_FOLDER "bin/${CMAKE_SYSTEM_NAME}/${ARCH_FOLDER}") else() @@ -144,13 +105,16 @@ else() set(BIN_FOLDER "bin/${ARCH_FOLDER}") endif() -if("${CMAKE_BUILD_TYPE}" STREQUAL "") - debug_message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") +if(NOT DEFINED CMAKE_BUILD_TYPE) + message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") set(CMAKE_BUILD_TYPE "Release") endif() # allow to override default OUTPUT_ROOT root if(NOT DEFINED OUTPUT_ROOT) + if(NOT DEFINED OpenVINO_MAIN_SOURCE_DIR) + message(FATAL_ERROR "OpenVINO_MAIN_SOURCE_DIR is not defined") + endif() set(OUTPUT_ROOT ${OpenVINO_MAIN_SOURCE_DIR}) endif() @@ -176,16 +140,17 @@ endif() set(CMAKE_DEBUG_POSTFIX ${IE_DEBUG_POSTFIX}) set(CMAKE_RELEASE_POSTFIX ${IE_RELEASE_POSTFIX}) -if (WIN32 OR CMAKE_GENERATOR STREQUAL "Xcode") +if (MSVC OR CMAKE_GENERATOR STREQUAL "Xcode") # Support CMake multiconfiguration for Visual Studio or Xcode build set(IE_BUILD_POSTFIX $<$:${IE_DEBUG_POSTFIX}>$<$:${IE_RELEASE_POSTFIX}>) else () - if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" ) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" ) set(IE_BUILD_POSTFIX ${IE_DEBUG_POSTFIX}) else() set(IE_BUILD_POSTFIX ${IE_RELEASE_POSTFIX}) endif() endif() + message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") add_definitions(-DIE_BUILD_POSTFIX=\"${IE_BUILD_POSTFIX}\") @@ -205,11 +170,11 @@ else() endif() if(APPLE) + set(CMAKE_MACOSX_RPATH ON) # WA for Xcode generator + object libraries issue: # https://gitlab.kitware.com/cmake/cmake/issues/20260 # http://cmake.3232098.n2.nabble.com/XCODE-DEPEND-HELPER-make-Deletes-Targets-Before-and-While-They-re-Built-td7598277.html set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY ON) - set(CMAKE_MACOSX_RPATH ON) endif() # Use solution folders @@ -219,38 +184,41 @@ set(CMAKE_POLICY_DEFAULT_CMP0054 NEW) # LTO -set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) -include(CheckIPOSupported) +if(ENABLE_LTO) + set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) + include(CheckIPOSupported) -check_ipo_supported(RESULT IPO_SUPPORTED - OUTPUT OUTPUT_MESSAGE - LANGUAGES C CXX) + check_ipo_supported(RESULT IPO_SUPPORTED + OUTPUT OUTPUT_MESSAGE + LANGUAGES C CXX) -if(NOT IPO_SUPPORTED) - set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optmization" FORCE) - message(WARNING "IPO / LTO is not supported: ${OUTPUT_MESSAGE}") + if(NOT IPO_SUPPORTED) + set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optmization" FORCE) + message(WARNING "IPO / LTO is not supported: ${OUTPUT_MESSAGE}") + endif() endif() # General flags -include(sdl) -include(os_flags) -include(sanitizer) -include(cross_compiled_func) +include(compile_flags/sdl) +include(compile_flags/os_flags) +include(compile_flags/sanitizer) +include(download/dependency_solver) +include(cross_compile/cross_compiled_func) include(faster_build) include(whole_archive) +include(linux_name) +include(models) include(api_validator/api_validator) -function(set_ci_build_number) - set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_SOURCE_DIR}") - include(version) - set(CI_BUILD_NUMBER "${CI_BUILD_NUMBER}" PARENT_SCOPE) -endfunction() -set_ci_build_number() - include(vs_version/vs_version) +include(plugins/plugins) +include(add_ie_target) # Code style utils include(cpplint/cpplint) include(clang_format/clang_format) + +# Restore state +set(CMAKE_MODULE_PATH ${OLD_CMAKE_MODULE_PATH}) diff --git a/inference-engine/cmake/add_ie_target.cmake b/cmake/developer_package/add_ie_target.cmake similarity index 96% rename from inference-engine/cmake/add_ie_target.cmake rename to cmake/developer_package/add_ie_target.cmake index f6d4dd19ca6a5f..b081a69459da1d 100644 --- a/inference-engine/cmake/add_ie_target.cmake +++ b/cmake/developer_package/add_ie_target.cmake @@ -8,7 +8,7 @@ Example: addIeTarget( NAME core_lib ADD_CPPLINT - DEVELOPER_PACKAGE + DEVELOPER_PACKAGE TYPE ROOT ${CMAKE_CURRENT_SOURCE_DIR} ADDITIONAL_SOURCE_DIRS @@ -31,7 +31,6 @@ addIeTarget( function(addIeTarget) set(options ADD_CPPLINT # Enables code style checks for the target - DEVELOPER_PACKAGE # Enables exporting of the target through the developer package ) set(oneValueRequiredArgs TYPE # type of target, SHARED|STATIC|EXECUTABLE. SHARED and STATIC correspond to add_library, EXECUTABLE to add_executable @@ -39,6 +38,7 @@ function(addIeTarget) ROOT # root directory to be used for recursive search of source files ) set(oneValueOptionalArgs + DEVELOPER_PACKAGE # Enables exporting of the target through the developer package ) set(multiValueArgs INCLUDES # Extra include directories @@ -121,10 +121,8 @@ function(addIeTarget) endif() if (ARG_DEVELOPER_PACKAGE) # developer package - ie_developer_export_targets(${ARG_NAME}) - if (ARG_EXPORT_DEPENDENCIES) - ie_developer_export_targets(${ARG_NAME} ${ARG_EXPORT_DEPENDENCIES}) - endif() + openvino_developer_export_targets(COMPONENT ${ARG_DEVELOPER_PACKAGE} + TARGETS ${ARG_NAME} ${ARG_EXPORT_DEPENDENCIES}) endif() if(WIN32) # Provide default compile pdb name equal to target name diff --git a/cmake/api_validator/api_validator.cmake b/cmake/developer_package/api_validator/api_validator.cmake similarity index 97% rename from cmake/api_validator/api_validator.cmake rename to cmake/developer_package/api_validator/api_validator.cmake index d165256d3e4183..6b0222a03d1f0d 100644 --- a/cmake/api_validator/api_validator.cmake +++ b/cmake/developer_package/api_validator/api_validator.cmake @@ -108,7 +108,7 @@ function(_ie_add_api_validator_post_build_step) -D UWP_API_VALIDATOR_EXCLUSION=${UWP_API_VALIDATOR_EXCLUSION} -D UWP_API_VALIDATOR_OUTPUT=${output_file} -D CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/api_validator/api_validator_run.cmake" + -P "${IEDevScripts_DIR}/api_validator/api_validator_run.cmake" BYPRODUCTS ${output_file} COMMENT "[apiValidator] Check ${target_name} for OneCore compliance" VERBATIM) diff --git a/cmake/api_validator/api_validator_run.cmake b/cmake/developer_package/api_validator/api_validator_run.cmake similarity index 100% rename from cmake/api_validator/api_validator_run.cmake rename to cmake/developer_package/api_validator/api_validator_run.cmake diff --git a/cmake/clang_format/clang_format.cmake b/cmake/developer_package/clang_format/clang_format.cmake similarity index 92% rename from cmake/clang_format/clang_format.cmake rename to cmake/developer_package/clang_format/clang_format.cmake index ae37ae134e3f4f..6e35f387c72c10 100644 --- a/cmake/clang_format/clang_format.cmake +++ b/cmake/developer_package/clang_format/clang_format.cmake @@ -76,10 +76,10 @@ function(add_clang_format_target TARGET_NAME) -D "CLANG_FORMAT=${CLANG_FORMAT}" -D "INPUT_FILE=${source_file}" -D "OUTPUT_FILE=${output_file}" - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/clang_format/clang_format_check.cmake" + -P "${IEDevScripts_DIR}/clang_format/clang_format_check.cmake" DEPENDS "${source_file}" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/clang_format/clang_format_check.cmake" + "${IEDevScripts_DIR}/clang_format/clang_format_check.cmake" COMMENT "[clang-format] ${source_file}" VERBATIM) @@ -102,10 +102,10 @@ function(add_clang_format_target TARGET_NAME) -D "CLANG_FORMAT=${CLANG_FORMAT}" -D "INPUT_FILES=${CLANG_FORMAT_FOR_SOURCES}" -D "EXCLUDE_PATTERNS=${CLANG_FORMAT_EXCLUDE_PATTERNS}" - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/clang_format/clang_format_fix.cmake" + -P "${IEDevScripts_DIR}/clang_format/clang_format_fix.cmake" DEPENDS "${CLANG_FORMAT_FOR_SOURCES}" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/clang_format/clang_format_fix.cmake" + "${IEDevScripts_DIR}/clang_format/clang_format_fix.cmake" COMMENT "[clang-format] ${TARGET_NAME}_fix" VERBATIM) diff --git a/cmake/clang_format/clang_format_check.cmake b/cmake/developer_package/clang_format/clang_format_check.cmake similarity index 100% rename from cmake/clang_format/clang_format_check.cmake rename to cmake/developer_package/clang_format/clang_format_check.cmake diff --git a/cmake/clang_format/clang_format_fix.cmake b/cmake/developer_package/clang_format/clang_format_fix.cmake similarity index 100% rename from cmake/clang_format/clang_format_fix.cmake rename to cmake/developer_package/clang_format/clang_format_fix.cmake diff --git a/cmake/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake similarity index 100% rename from cmake/os_flags.cmake rename to cmake/developer_package/compile_flags/os_flags.cmake diff --git a/cmake/sanitizer.cmake b/cmake/developer_package/compile_flags/sanitizer.cmake similarity index 100% rename from cmake/sanitizer.cmake rename to cmake/developer_package/compile_flags/sanitizer.cmake diff --git a/cmake/sdl.cmake b/cmake/developer_package/compile_flags/sdl.cmake similarity index 100% rename from cmake/sdl.cmake rename to cmake/developer_package/compile_flags/sdl.cmake diff --git a/cmake/coverage/coverage.cmake b/cmake/developer_package/coverage/coverage.cmake similarity index 99% rename from cmake/coverage/coverage.cmake rename to cmake/developer_package/coverage/coverage.cmake index e2fa3b57edee79..71c24fcd9ddab3 100644 --- a/cmake/coverage/coverage.cmake +++ b/cmake/developer_package/coverage/coverage.cmake @@ -18,7 +18,7 @@ if(NOT TARGET ie_coverage) endif() set(IE_COVERAGE_REPORTS "${CMAKE_BINARY_DIR}/coverage") -set(IE_COVERAGE_SCRIPT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake/coverage") +set(IE_COVERAGE_SCRIPT_DIR "${IEDevScripts_DIR}/coverage") include(CMakeParseArguments) diff --git a/cmake/coverage/coverage_clean.cmake b/cmake/developer_package/coverage/coverage_clean.cmake similarity index 100% rename from cmake/coverage/coverage_clean.cmake rename to cmake/developer_package/coverage/coverage_clean.cmake diff --git a/cmake/coverage/coverage_merge.cmake b/cmake/developer_package/coverage/coverage_merge.cmake similarity index 100% rename from cmake/coverage/coverage_merge.cmake rename to cmake/developer_package/coverage/coverage_merge.cmake diff --git a/cmake/cpplint/cpplint.cmake b/cmake/developer_package/cpplint/cpplint.cmake similarity index 52% rename from cmake/cpplint/cpplint.cmake rename to cmake/developer_package/cpplint/cpplint.cmake index 23e022d6a514ad..ccd97f8df8c8bd 100644 --- a/cmake/cpplint/cpplint.cmake +++ b/cmake/developer_package/cpplint/cpplint.cmake @@ -68,17 +68,17 @@ function(add_cpplint_target TARGET_NAME) "${output_file}" COMMAND "${CMAKE_COMMAND}" - -D "CPPLINT_SCRIPT=${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint.py" + -D "CPPLINT_SCRIPT=${IEDevScripts_DIR}/cpplint/cpplint.py" -D "INPUT_FILE=${source_file}" -D "OUTPUT_FILE=${output_file}" -D "WORKING_DIRECTORY=${CMAKE_CURRENT_SOURCE_DIR}" -D "SKIP_RETURN_CODE=${ENABLE_CPPLINT_REPORT}" -D "CUSTOM_FILTER=${custom_filter}" - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_run.cmake" + -P "${IEDevScripts_DIR}/cpplint/cpplint_run.cmake" DEPENDS "${source_file}" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint.py" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_run.cmake" + "${IEDevScripts_DIR}/cpplint/cpplint.py" + "${IEDevScripts_DIR}/cpplint/cpplint_run.cmake" COMMENT "[cpplint] ${source_file}" VERBATIM) @@ -104,71 +104,3 @@ function(add_cpplint_target TARGET_NAME) add_dependencies(cpplint_all ${TARGET_NAME}) endfunction() - -function(add_cpplint_report_target) - if(NOT ENABLE_CPPLINT OR NOT ENABLE_CPPLINT_REPORT) - return() - endif() - - set(cpplint_output_file "${CMAKE_BINARY_DIR}/cpplint/final_output.cpplint") - add_custom_command( - OUTPUT - "${cpplint_output_file}" - COMMAND - "${CMAKE_COMMAND}" - -D "FINAL_OUTPUT_FILE=${cpplint_output_file}" - -D "OUTPUT_FILES=${CPPLINT_ALL_OUTPUT_FILES}" - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_merge.cmake" - DEPENDS - ${CPPLINT_ALL_OUTPUT_FILES} - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_merge.cmake" - COMMENT - "[cpplint] Merge all output files" - VERBATIM) - - set(cppcheck_output_file "${CMAKE_BINARY_DIR}/cpplint/cpplint-cppcheck-result.xml") - add_custom_command( - OUTPUT - "${cppcheck_output_file}" - COMMAND - "${CMAKE_COMMAND}" - -D "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}" - -D "CONVERT_SCRIPT=${OpenVINO_MAIN_SOURCE_DIR}/scripts/cpplint_to_cppcheckxml.py" - -D "INPUT_FILE=${cpplint_output_file}" - -D "OUTPUT_FILE=${cppcheck_output_file}" - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_to_cppcheck_xml.cmake" - DEPENDS - "${cpplint_output_file}" - "${OpenVINO_MAIN_SOURCE_DIR}/scripts/cpplint_to_cppcheckxml.py" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_to_cppcheck_xml.cmake" - COMMENT - "[cpplint] Convert to cppcheck XML format" - VERBATIM) - - set(report_dir "${OpenVINO_MAIN_SOURCE_DIR}/report/cpplint") - set(html_output_file "${report_dir}/index.html") - add_custom_command( - OUTPUT - "${html_output_file}" - COMMAND - "${CMAKE_COMMAND}" - -D "PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}" - -D "CONVERT_SCRIPT=${OpenVINO_MAIN_SOURCE_DIR}/scripts/cppcheck-htmlreport.py" - -D "INPUT_FILE=${cppcheck_output_file}" - -D "REPORT_DIR=${report_dir}" - -D "SOURCE_DIR=${OpenVINO_MAIN_SOURCE_DIR}" - -D "TITLE=${CMAKE_PROJECT_NAME}" - -P "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_html.cmake" - DEPENDS - "${cppcheck_output_file}" - "${OpenVINO_MAIN_SOURCE_DIR}/scripts/cppcheck-htmlreport.py" - "${OpenVINO_MAIN_SOURCE_DIR}/cmake/cpplint/cpplint_html.cmake" - COMMENT - "[cpplint] Generate HTML report" - VERBATIM) - - add_custom_target(cpplint_report - DEPENDS "${html_output_file}" - COMMENT "[cpplint] Generate report") - set_target_properties(cpplint_report PROPERTIES FOLDER cpplint) -endfunction() diff --git a/cmake/cpplint/cpplint.py b/cmake/developer_package/cpplint/cpplint.py similarity index 100% rename from cmake/cpplint/cpplint.py rename to cmake/developer_package/cpplint/cpplint.py diff --git a/cmake/cpplint/cpplint_html.cmake b/cmake/developer_package/cpplint/cpplint_html.cmake similarity index 100% rename from cmake/cpplint/cpplint_html.cmake rename to cmake/developer_package/cpplint/cpplint_html.cmake diff --git a/cmake/cpplint/cpplint_merge.cmake b/cmake/developer_package/cpplint/cpplint_merge.cmake similarity index 100% rename from cmake/cpplint/cpplint_merge.cmake rename to cmake/developer_package/cpplint/cpplint_merge.cmake diff --git a/cmake/cpplint/cpplint_run.cmake b/cmake/developer_package/cpplint/cpplint_run.cmake similarity index 100% rename from cmake/cpplint/cpplint_run.cmake rename to cmake/developer_package/cpplint/cpplint_run.cmake diff --git a/cmake/cpplint/cpplint_to_cppcheck_xml.cmake b/cmake/developer_package/cpplint/cpplint_to_cppcheck_xml.cmake similarity index 100% rename from cmake/cpplint/cpplint_to_cppcheck_xml.cmake rename to cmake/developer_package/cpplint/cpplint_to_cppcheck_xml.cmake diff --git a/cmake/cross_compile/cross_compiled_disp_gen.cmake b/cmake/developer_package/cross_compile/cross_compiled_disp_gen.cmake similarity index 100% rename from cmake/cross_compile/cross_compiled_disp_gen.cmake rename to cmake/developer_package/cross_compile/cross_compiled_disp_gen.cmake diff --git a/cmake/cross_compile/cross_compiled_disp_gen_options.in b/cmake/developer_package/cross_compile/cross_compiled_disp_gen_options.in similarity index 100% rename from cmake/cross_compile/cross_compiled_disp_gen_options.in rename to cmake/developer_package/cross_compile/cross_compiled_disp_gen_options.in diff --git a/cmake/cross_compile/cross_compiled_func.cmake b/cmake/developer_package/cross_compile/cross_compiled_func.cmake similarity index 100% rename from cmake/cross_compile/cross_compiled_func.cmake rename to cmake/developer_package/cross_compile/cross_compiled_func.cmake diff --git a/cmake/debug.cmake b/cmake/developer_package/debug.cmake similarity index 100% rename from cmake/debug.cmake rename to cmake/developer_package/debug.cmake diff --git a/cmake/download/dependency_solver.cmake b/cmake/developer_package/download/dependency_solver.cmake similarity index 99% rename from cmake/download/dependency_solver.cmake rename to cmake/developer_package/download/dependency_solver.cmake index a089fd80b626bd..3d181a45b21a29 100644 --- a/cmake/download/dependency_solver.cmake +++ b/cmake/developer_package/download/dependency_solver.cmake @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -include ("download") +include (download/download) function (resolve_archive_dependency VAR COMPONENT ARCHIVE ARCHIVE_UNIFIED ARCHIVE_WIN ARCHIVE_LIN ARCHIVE_MAC ARCHIVE_ANDROID TARGET_PATH FOLDER ENVIRONMENT SHA256) if (ENVIRONMENT AND (DEFINED ${ENVIRONMENT} OR DEFINED ENV{${ENVIRONMENT}})) diff --git a/cmake/download/download.cmake b/cmake/developer_package/download/download.cmake similarity index 87% rename from cmake/download/download.cmake rename to cmake/developer_package/download/download.cmake index 80d3d24f05b571..566109cb6fa93e 100644 --- a/cmake/download/download.cmake +++ b/cmake/developer_package/download/download.cmake @@ -21,5 +21,5 @@ function (Download from to fatal result output sha256) endfunction(Download) -include ("download_and_apply") -include ("download_and_extract") +include(download/download_and_apply) +include(download/download_and_extract) diff --git a/cmake/download/download_and_apply.cmake b/cmake/developer_package/download/download_and_apply.cmake similarity index 100% rename from cmake/download/download_and_apply.cmake rename to cmake/developer_package/download/download_and_apply.cmake diff --git a/cmake/download/download_and_check.cmake b/cmake/developer_package/download/download_and_check.cmake similarity index 100% rename from cmake/download/download_and_check.cmake rename to cmake/developer_package/download/download_and_check.cmake diff --git a/cmake/download/download_and_extract.cmake b/cmake/developer_package/download/download_and_extract.cmake similarity index 99% rename from cmake/download/download_and_extract.cmake rename to cmake/developer_package/download/download_and_extract.cmake index cd51c9b263d01b..cf4da01b743fa2 100644 --- a/cmake/download/download_and_extract.cmake +++ b/cmake/developer_package/download/download_and_extract.cmake @@ -2,8 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # -include ("extract") -include ("download_and_check") +include(download/extract) +include(download/download_and_check) function (GetNameAndUrlToDownload name url archive_name_unified archive_name_win archive_name_lin archive_name_mac archive_name_android) if (archive_name_unified) diff --git a/cmake/download/extract.cmake b/cmake/developer_package/download/extract.cmake similarity index 100% rename from cmake/download/extract.cmake rename to cmake/developer_package/download/extract.cmake diff --git a/cmake/faster_build.cmake b/cmake/developer_package/faster_build.cmake similarity index 100% rename from cmake/faster_build.cmake rename to cmake/developer_package/faster_build.cmake diff --git a/cmake/developer_package/features.cmake b/cmake/developer_package/features.cmake new file mode 100644 index 00000000000000..a5400b33c00d2a --- /dev/null +++ b/cmake/developer_package/features.cmake @@ -0,0 +1,74 @@ +# Copyright (C) 2018-2020 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +include(options) +include(target_flags) + +# FIXME: there are compiler failures with LTO and Cross-Compile toolchains. Disabling for now, but +# this must be addressed in a proper way +ie_dependent_option (ENABLE_LTO "Enable Link Time Optimization" OFF "LINUX;NOT CMAKE_CROSSCOMPILING; CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9" OFF) + +ie_option (OS_FOLDER "create OS dedicated folder in output" OFF) + +# FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow +ie_dependent_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "X86 OR X86_64" OFF) + +ie_option (ENABLE_INTEGRITYCHECK "build DLLs with /INTEGRITYCHECK flag" OFF) + +ie_option (ENABLE_SANITIZER "enable checking memory errors via AddressSanitizer" OFF) + +ie_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitizer" OFF) + +ie_dependent_option (COVERAGE "enable code coverage" OFF "CMAKE_CXX_COMPILER_ID STREQUAL GNU" OFF) + +# Defines CPU capabilities + +ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR X86" OFF) + +ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR X86" OFF) + +ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR X86" OFF) + +# Type of build, we add this as an explicit option to default it to ON +# FIXME: Ah this moment setting this to OFF will only build ngraph a static library +ie_option (BUILD_SHARED_LIBS "Build as a shared library" ON) + +ie_dependent_option (ENABLE_FASTER_BUILD "Enable build features (PCH, UNITY) to speed up build time" OFF "CMAKE_VERSION VERSION_GREATER_EQUAL 3.16" OFF) + +ie_dependent_option (ENABLE_CPPLINT "Enable cpplint checks during the build" ON "UNIX;NOT ANDROID" OFF) + +ie_dependent_option (ENABLE_CPPLINT_REPORT "Build cpplint report instead of failing the build" OFF "ENABLE_CPPLINT" OFF) + +ie_option (ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON) + +ie_option (VERBOSE_BUILD "shows extra information about build" OFF) + +ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF) + +ie_option (ENABLE_ALTERNATIVE_TEMP "in case of dependency conflict, to avoid modification in master, use local copy of dependency" ON) + +# +# Check features +# + +if(ENABLE_AVX512F) + if ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") AND (MSVC_VERSION VERSION_LESS 1920)) + # 1920 version of MSVC 2019. In MSVC 2017 AVX512F not work + set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) + endif() + if ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)) + set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) + endif() + if ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)) + # TBD: clarify which AppleClang version supports avx512 + set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) + endif() + if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)) + set(ENABLE_AVX512F OFF CACHE BOOL "" FORCE) + endif() +endif() + +if (VERBOSE_BUILD) + set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "" FORCE) +endif() diff --git a/cmake/fuzzing.cmake b/cmake/developer_package/fuzzing.cmake similarity index 89% rename from cmake/fuzzing.cmake rename to cmake/developer_package/fuzzing.cmake index 4e62429f9a604a..50ca1c1b6ae478 100644 --- a/cmake/fuzzing.cmake +++ b/cmake/developer_package/fuzzing.cmake @@ -15,7 +15,8 @@ function(enable_fuzzing) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FUZZING_COMPILER_FLAGS}" PARENT_SCOPE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUZZING_COMPILER_FLAGS}" PARENT_SCOPE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}" PARENT_SCOPE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}" PARENT_SCOPE) + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}" PARENT_SCOPE) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FUZZING_LINKER_FLAGS}") endif() endfunction(enable_fuzzing) diff --git a/inference-engine/cmake/linux_name.cmake b/cmake/developer_package/linux_name.cmake similarity index 93% rename from inference-engine/cmake/linux_name.cmake rename to cmake/developer_package/linux_name.cmake index e87a61ba1dd53b..28afd53746a454 100644 --- a/inference-engine/cmake/linux_name.cmake +++ b/cmake/developer_package/linux_name.cmake @@ -2,6 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # +include(target_flags) + if (LINUX) function(get_linux_name res_var) if (NOT EXISTS "/etc/lsb-release") @@ -11,7 +13,7 @@ if (LINUX) set(name_regex "NAME=\"([^ \"\n]*).*\"\n") set(version_regex "VERSION=\"([0-9]+(\\.[0-9]+)?)[^\n]*\"") else () - #linux version detection using cat /etc/lsb-release + # linux version detection using cat /etc/lsb-release file(READ "/etc/lsb-release" release_data) set(name_regex "DISTRIB_ID=([^ \n]*)\n") set(version_regex "DISTRIB_RELEASE=([0-9]+(\\.[0-9]+)?)") @@ -28,6 +30,5 @@ if (LINUX) else () set(${res_var} NOTFOUND PARENT_SCOPE) endif () - endfunction() endif () diff --git a/inference-engine/cmake/models.cmake b/cmake/developer_package/models.cmake similarity index 100% rename from inference-engine/cmake/models.cmake rename to cmake/developer_package/models.cmake diff --git a/cmake/options.cmake b/cmake/developer_package/options.cmake similarity index 92% rename from cmake/options.cmake rename to cmake/developer_package/options.cmake index b4bb86b1d6e23f..cedbd099962029 100644 --- a/cmake/options.cmake +++ b/cmake/developer_package/options.cmake @@ -4,7 +4,6 @@ # Usage: ie_option( "description" [IF ]) include (CMakeDependentOption) -include (version) macro (ie_option variable description value) option(${variable} "${description}" ${value}) @@ -32,6 +31,10 @@ macro (ie_option_enum variable description value) endmacro() function (print_enabled_features) + if(NOT COMMAND set_ci_build_number) + message(FATAL_ERROR "CI_BUILD_NUMBER is not set yet") + endif() + message(STATUS "Inference Engine enabled features: ") message(STATUS "") message(STATUS " CI_BUILD_NUMBER: ${CI_BUILD_NUMBER}") diff --git a/cmake/developer_package/packaging.cmake b/cmake/developer_package/packaging.cmake new file mode 100644 index 00000000000000..b846bf732dcb1a --- /dev/null +++ b/cmake/developer_package/packaging.cmake @@ -0,0 +1,58 @@ +# Copyright (C) 2018-2020 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +include(CPackComponent) +unset(IE_CPACK_COMPONENTS_ALL CACHE) + +set(IE_CPACK_IE_DIR deployment_tools/inference_engine) + +# +# ie_cpack_set_library_dir() +# +# Set library directory for cpack +# +function(ie_cpack_set_library_dir) + if(WIN32) + set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) + set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/bin/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) + set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER}/${CMAKE_BUILD_TYPE} PARENT_SCOPE) + else() + set(IE_CPACK_LIBRARY_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE) + set(IE_CPACK_RUNTIME_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE) + set(IE_CPACK_ARCHIVE_PATH ${IE_CPACK_IE_DIR}/lib/${ARCH_FOLDER} PARENT_SCOPE) + endif() +endfunction() + +ie_cpack_set_library_dir() + +# +# ie_cpack_add_component(NAME ...) +# +# Wraps original `cpack_add_component` and adds component to internal IE list +# +macro(ie_cpack_add_component NAME) + list(APPEND IE_CPACK_COMPONENTS_ALL ${NAME}) + set(IE_CPACK_COMPONENTS_ALL "${IE_CPACK_COMPONENTS_ALL}" CACHE STRING "" FORCE) + cpack_add_component(${NAME} ${ARGN}) +endmacro() + +macro(ie_cpack) + set(CPACK_GENERATOR "TGZ") + string(REPLACE "/" "_" CPACK_PACKAGE_VERSION "${CI_BUILD_NUMBER}") + if(WIN32) + set(CPACK_PACKAGE_NAME inference-engine_${CMAKE_BUILD_TYPE}) + else() + set(CPACK_PACKAGE_NAME inference-engine) + endif() + set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) + set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) + set(CPACK_PACKAGE_VENDOR "Intel") + set(CPACK_COMPONENTS_ALL ${ARGN}) + set(CPACK_STRIP_FILES ON) + + if(OS_FOLDER) + set(CPACK_SYSTEM_NAME "${OS_FOLDER}") + endif() + + include(CPack) +endmacro() diff --git a/inference-engine/cmake/plugins/create_plugin_file.cmake b/cmake/developer_package/plugins/create_plugin_file.cmake similarity index 100% rename from inference-engine/cmake/plugins/create_plugin_file.cmake rename to cmake/developer_package/plugins/create_plugin_file.cmake diff --git a/inference-engine/cmake/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake similarity index 96% rename from inference-engine/cmake/plugins/plugins.cmake rename to cmake/developer_package/plugins/plugins.cmake index 683f02ff0a8fe4..0a59797475f7e4 100644 --- a/inference-engine/cmake/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -135,7 +135,7 @@ macro(ie_register_plugins) -D "IE_CONFIG_OUTPUT_FILE=${config_output_file}" -D "IE_PLUGIN_NAME=${plugin}" -D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins" - -P "${IE_MAIN_SOURCE_DIR}/cmake/plugins/unregister_plugin_cmake.cmake" + -P "${IEDevScripts_DIR}/plugins/unregister_plugin_cmake.cmake" COMMENT "Remove ${plugin} from the plugins.xml file" VERBATIM) @@ -160,7 +160,7 @@ macro(ie_register_plugins) -D "IE_CONFIG_OUTPUT_FILE=${config_file_name}" -D "IE_DEVICE_NAME=${device_name}" -D "IE_PLUGIN_LIBRARY_NAME=${library_name}" - -P "${IE_MAIN_SOURCE_DIR}/cmake/plugins/create_plugin_file.cmake" + -P "${IEDevScripts_DIR}/plugins/create_plugin_file.cmake" COMMENT "Register ${name} plugin" VERBATIM) @@ -173,7 +173,7 @@ macro(ie_register_plugins) -D "CMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}" -D "IE_CONFIG_OUTPUT_FILE=${config_output_file}" -D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins" - -P "${IE_MAIN_SOURCE_DIR}/cmake/plugins/register_plugin_cmake.cmake" + -P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake" COMMENT "Registering plugins to plugins.xml config file" VERBATIM) diff --git a/inference-engine/cmake/plugins/register_plugin_cmake.cmake b/cmake/developer_package/plugins/register_plugin_cmake.cmake similarity index 100% rename from inference-engine/cmake/plugins/register_plugin_cmake.cmake rename to cmake/developer_package/plugins/register_plugin_cmake.cmake diff --git a/inference-engine/cmake/plugins/unregister_plugin_cmake.cmake b/cmake/developer_package/plugins/unregister_plugin_cmake.cmake similarity index 100% rename from inference-engine/cmake/plugins/unregister_plugin_cmake.cmake rename to cmake/developer_package/plugins/unregister_plugin_cmake.cmake diff --git a/cmake/shellcheck/shellcheck.cmake b/cmake/developer_package/shellcheck/shellcheck.cmake similarity index 94% rename from cmake/shellcheck/shellcheck.cmake rename to cmake/developer_package/shellcheck/shellcheck.cmake index c2e1186d1b122b..df7a310792ba37 100644 --- a/cmake/shellcheck/shellcheck.cmake +++ b/cmake/developer_package/shellcheck/shellcheck.cmake @@ -14,7 +14,7 @@ function(ie_shellcheck_process) cmake_parse_arguments(IE_SHELLCHECK "" "DIRECTORY" "SKIP" ${ARGN}) - set(IE_SHELLCHECK_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/shellcheck/shellcheck_process.cmake") + set(IE_SHELLCHECK_SCRIPT "${IEDevScripts_DIR}/shellcheck/shellcheck_process.cmake") file(GLOB_RECURSE scripts "${IE_SHELLCHECK_DIRECTORY}/*.sh") foreach(script IN LISTS scripts) # check if we need to skip scripts diff --git a/cmake/shellcheck/shellcheck_process.cmake b/cmake/developer_package/shellcheck/shellcheck_process.cmake similarity index 100% rename from cmake/shellcheck/shellcheck_process.cmake rename to cmake/developer_package/shellcheck/shellcheck_process.cmake diff --git a/cmake/target_flags.cmake b/cmake/developer_package/target_flags.cmake similarity index 100% rename from cmake/target_flags.cmake rename to cmake/developer_package/target_flags.cmake diff --git a/inference-engine/cmake/tbb/lnx/TBBConfig.cmake b/cmake/developer_package/tbb/lnx/TBBConfig.cmake similarity index 100% rename from inference-engine/cmake/tbb/lnx/TBBConfig.cmake rename to cmake/developer_package/tbb/lnx/TBBConfig.cmake diff --git a/inference-engine/cmake/tbb/mac/TBBConfig.cmake b/cmake/developer_package/tbb/mac/TBBConfig.cmake similarity index 100% rename from inference-engine/cmake/tbb/mac/TBBConfig.cmake rename to cmake/developer_package/tbb/mac/TBBConfig.cmake diff --git a/inference-engine/cmake/tbb/win/TBBConfig.cmake b/cmake/developer_package/tbb/win/TBBConfig.cmake similarity index 100% rename from inference-engine/cmake/tbb/win/TBBConfig.cmake rename to cmake/developer_package/tbb/win/TBBConfig.cmake diff --git a/cmake/version.cmake b/cmake/developer_package/version.cmake similarity index 80% rename from cmake/version.cmake rename to cmake/developer_package/version.cmake index db0fe2bb79da7e..9dd1ecbc923780 100644 --- a/cmake/version.cmake +++ b/cmake/developer_package/version.cmake @@ -3,18 +3,24 @@ # function (branchName VAR) + if(NOT DEFINED repo_root) + message(FATAL_ERROR "repo_root is not defined") + endif() execute_process( COMMAND git rev-parse --abbrev-ref HEAD - WORKING_DIRECTORY ${OpenVINO_MAIN_SOURCE_DIR} + WORKING_DIRECTORY ${repo_root} OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE) set (${VAR} ${GIT_BRANCH} PARENT_SCOPE) endfunction() function (commitHash VAR) + if(NOT DEFINED repo_root) + message(FATAL_ERROR "repo_root is not defined") + endif() execute_process( COMMAND git rev-parse HEAD - WORKING_DIRECTORY ${OpenVINO_MAIN_SOURCE_DIR} + WORKING_DIRECTORY ${repo_root} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) set (${VAR} ${GIT_COMMIT_HASH} PARENT_SCOPE) diff --git a/cmake/vs_version/vs_version.cmake b/cmake/developer_package/vs_version/vs_version.cmake similarity index 96% rename from cmake/vs_version/vs_version.cmake rename to cmake/developer_package/vs_version/vs_version.cmake index d857e2e4bcc4db..9972fdce1338d3 100644 --- a/cmake/vs_version/vs_version.cmake +++ b/cmake/developer_package/vs_version/vs_version.cmake @@ -80,7 +80,7 @@ function(ie_add_vs_version_file) set(IE_VS_VER_INTERNALNAME_STR ${VS_VER_NAME}) set(vs_version_output "${CMAKE_CURRENT_BINARY_DIR}/vs_version.rc") - configure_file("${OpenVINO_MAIN_SOURCE_DIR}/cmake/vs_version/vs_version.rc.in" "${vs_version_output}" @ONLY) + configure_file("${IEDevScripts_DIR}/vs_version/vs_version.rc.in" "${vs_version_output}" @ONLY) source_group("src" FILES ${vs_version_output}) target_sources(${VS_VER_NAME} PRIVATE ${vs_version_output}) diff --git a/cmake/vs_version/vs_version.rc.in b/cmake/developer_package/vs_version/vs_version.rc.in similarity index 100% rename from cmake/vs_version/vs_version.rc.in rename to cmake/developer_package/vs_version/vs_version.rc.in diff --git a/cmake/whole_archive.cmake b/cmake/developer_package/whole_archive.cmake similarity index 100% rename from cmake/whole_archive.cmake rename to cmake/developer_package/whole_archive.cmake diff --git a/cmake/features.cmake b/cmake/features.cmake index e0a8d7ee40f7f6..8c63bd77b72408 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -2,69 +2,31 @@ # SPDX-License-Identifier: Apache-2.0 # -include (target_flags) -include (options) - -# these options are aimed to optimize build time on development system - if(X86_64) set(ENABLE_MKL_DNN_DEFAULT ON) else() set(ENABLE_MKL_DNN_DEFAULT OFF) endif() -ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF) - ie_option (ENABLE_MKL_DNN "MKL-DNN plugin for inference engine" ${ENABLE_MKL_DNN_DEFAULT}) -ie_dependent_option (ENABLE_CLDNN "clDnn based plugin for inference engine" ON "X86_64;NOT APPLE;NOT MINGW;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF) - -# FIXME: there are compiler failures with LTO and Cross-Compile toolchains. Disabling for now, but -# this must be addressed in a proper way -ie_dependent_option (ENABLE_LTO "Enable Link Time Optimization" OFF "LINUX;NOT CMAKE_CROSSCOMPILING; CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9" OFF) - -ie_option (OS_FOLDER "create OS dedicated folder in output" OFF) - -# FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow -ie_dependent_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "X86 OR X86_64" OFF) - -ie_option (ENABLE_INTEGRITYCHECK "build DLLs with /INTEGRITYCHECK flag" OFF) - -ie_option (ENABLE_SANITIZER "enable checking memory errors via AddressSanitizer" OFF) - -ie_option (ENABLE_THREAD_SANITIZER "enable checking data races via ThreadSanitizer" OFF) - -ie_dependent_option (COVERAGE "enable code coverage" OFF "CMAKE_CXX_COMPILER_ID STREQUAL GNU" OFF) - -# Define CPU capabilities - -ie_dependent_option (ENABLE_SSE42 "Enable SSE4.2 optimizations" ON "X86_64 OR X86" OFF) - -ie_dependent_option (ENABLE_AVX2 "Enable AVX2 optimizations" ON "X86_64 OR X86" OFF) +ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF) -ie_dependent_option (ENABLE_AVX512F "Enable AVX512 optimizations" ON "X86_64 OR X86" OFF) +ie_dependent_option (ENABLE_CLDNN "clDnn based plugin for inference engine" ON "X86_64;NOT APPLE;NOT MINGW;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF) ie_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF) ie_option (ENABLE_DOCS "Build docs using Doxygen" OFF) -ie_dependent_option (ENABLE_FASTER_BUILD "Enable build features (PCH, UNITY) to speed up build time" OFF "CMAKE_VERSION VERSION_GREATER_EQUAL 3.16" OFF) - -# Type of build, we add this as an explicit option to default it to ON -# FIXME: Ah this moment setting this to OFF will only build ngraph a static library -ie_option (BUILD_SHARED_LIBS "Build as a shared library" ON) - -ie_dependent_option(ENABLE_CPPLINT "Enable cpplint checks during the build" ON "UNIX;NOT ANDROID" OFF) - -ie_dependent_option(ENABLE_CPPLINT_REPORT "Build cpplint report instead of failing the build" OFF "ENABLE_CPPLINT" OFF) - ie_option(ENABLE_TEMPLATE_PLUGIN "Register template plugin into plugins.xml" OFF) -ie_option(ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON) - ie_option_enum(SELECTIVE_BUILD "Enable OpenVINO conditional compilation or statistics collection. \ In case SELECTIVE_BUILD is enabled, the SELECTIVE_BUILD_STAT variable should contain the path to the collected InelSEAPI statistics. \ Usage: -DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=/path/*.csv" OFF ALLOWED_VALUES ON OFF COLLECT) -set(LINKCHECKER_PY "" CACHE FILEPATH "Path to linkchecker.py for documentation check") +# +# Process options +# + +print_enabled_features() diff --git a/cmake/onecoreuap.toolchain.cmake b/cmake/toolchains/onecoreuap.toolchain.cmake similarity index 100% rename from cmake/onecoreuap.toolchain.cmake rename to cmake/toolchains/onecoreuap.toolchain.cmake diff --git a/cmake/uwp.toolchain.cmake b/cmake/toolchains/uwp.toolchain.cmake similarity index 100% rename from cmake/uwp.toolchain.cmake rename to cmake/toolchains/uwp.toolchain.cmake diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index be94c8c9185b4a..0ac309e1c426ca 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -40,6 +40,7 @@ if(NOT ENABLE_DOCKER) endforeach() endif() +set(LINKCHECKER_PY "" CACHE FILEPATH "Path to linkchecker.py for documentation check") set(OMZ_DOCS_DIR "" CACHE PATH "Path to open_model_zoo documentation") set(WORKBENCH_DOCS_DIR "" CACHE PATH "Path to workbench documentation") set(POT_DOCS_DIR "" CACHE PATH "Path to post-training-compression-tool documentation") diff --git a/inference-engine/CMakeLists.txt b/inference-engine/CMakeLists.txt index e8b50063529944..3f44e176cf88e9 100644 --- a/inference-engine/CMakeLists.txt +++ b/inference-engine/CMakeLists.txt @@ -3,21 +3,10 @@ # project(InferenceEngine) -set(CMAKE_MODULE_PATH "${IE_MAIN_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) - -include(features_ie) - -# include developer package -include(developer_package_ie) - -# These options are shared with 3rdparty plugins by means of developer package -include(check_features_ie) +include(cmake/features.cmake) # resolving dependencies for the project -include(dependencies) - -# Fuzz tests also building without ENABLE_FUZZING -include(fuzzing) +include(cmake/dependencies.cmake) if (ENABLE_FUZZING) enable_fuzzing() @@ -25,38 +14,20 @@ endif() find_package(Threads REQUIRED) -unset(IEDeveloperPackageTargets CACHE) function(ie_developer_export_targets) - set(IEDeveloperPackageTargets "${IEDeveloperPackageTargets};${ARGV}") - - # to allow exporting of aliased targets with the original names - foreach(target_name ${IEDeveloperPackageTargets}) - if(TARGET "${target_name}") - get_target_property(original_name ${target_name} ALIASED_TARGET) - if(TARGET "${original_name}") - message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. " - "It will be exported to the InferenceEngineDeveloperPackage with the original name.") - list(REMOVE_ITEM IEDeveloperPackageTargets ${target_name}) - list(APPEND IEDeveloperPackageTargets ${original_name}) - endif() - endif() - endforeach() - - list(REMOVE_DUPLICATES IEDeveloperPackageTargets) - set(IEDeveloperPackageTargets "${IEDeveloperPackageTargets}" CACHE INTERNAL - "Paths to extra Inference Engine plugins" FORCE) + openvino_developer_export_targets(COMPONENT inference_engine TARGETS ${ARGN}) endfunction() function(ie_developer_export) - export(TARGETS ${OpenVINODeveloperPackageTargets} NAMESPACE IE:: - APPEND FILE "${CMAKE_BINARY_DIR}/targets_developer.cmake") - - export(TARGETS ${IEDeveloperPackageTargets} NAMESPACE IE:: - APPEND FILE "${CMAKE_BINARY_DIR}/targets_developer.cmake") + set(all_dev_targets gflags inference_engine_ir_reader inference_engine_ir_v7_reader) + 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() # Custom target to build only Inference Engine Developer Package targets - add_custom_target(ie_dev_targets ALL DEPENDS ${OpenVINODeveloperPackageTargets} ${IEDeveloperPackageTargets} gflags - inference_engine_ir_reader inference_engine_ir_v7_reader) + add_custom_target(ie_dev_targets ALL DEPENDS ${all_dev_targets}) endfunction() add_subdirectory(thirdparty) @@ -81,7 +52,7 @@ function(ie_build_samples) MINGW64 CMAKE_BUILD_TYPE CMAKE_MACOSX_RPATH) unset(${var}) endforeach() - include(sanitizer) + include("${IEDevScripts_DIR}/compile_flags/sanitizer.cmake") add_subdirectory(samples) endfunction() @@ -95,8 +66,6 @@ endif() add_subdirectory(ie_bridges/c) -add_cpplint_report_target() - # # Install # @@ -169,23 +138,23 @@ endif() # Developer package # -ie_developer_export_targets(format_reader) -ie_developer_export_targets(${NGRAPH_LIBRARIES}) +openvino_developer_export_targets(COMPONENT openvino_common TARGETS format_reader) +openvino_developer_export_targets(COMPONENT ngraph TARGETS ${NGRAPH_LIBRARIES}) # for Template plugin if(NGRAPH_INTERPRETER_ENABLE) - ie_developer_export_targets(ngraph_backend interpreter_backend) + openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph_backend interpreter_backend) endif() ie_developer_export() configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/developer_package_config.cmake.in" + "${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in" "${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig.cmake" @ONLY) configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/share/InferenceEngineConfig-version.cmake.in" + "${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/InferenceEngineDeveloperPackageConfig-version.cmake" COPYONLY) @@ -194,7 +163,7 @@ configure_file( # if(ENABLE_COVERAGE) - include(coverage_ie) + include(cmake/coverage.cmake) endif() # @@ -211,7 +180,7 @@ function(register_extra_modules) file(WRITE "${iedevconfig_file}" "\# !! AUTOGENERATED: DON'T EDIT !!\n\n") file(APPEND "${iedevconfig_file}" "ie_deprecated_no_errors()\n") - foreach(target IN LISTS OpenVINODeveloperPackageTargets IEDeveloperPackageTargets) + foreach(target IN LISTS ${openvino_export_components}) if(target) file(APPEND "${iedevconfig_file}" "add_library(IE::${target} ALIAS ${target})\n") endif() diff --git a/inference-engine/cmake/check_features_ie.cmake b/inference-engine/cmake/check_features_ie.cmake deleted file mode 100644 index 9eccd8518f534e..00000000000000 --- a/inference-engine/cmake/check_features_ie.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (C) 2018-2020 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -#next section set defines to be accesible in c++/c code for certain feature -if (ENABLE_PROFILING_RAW) - add_definitions(-DENABLE_PROFILING_RAW=1) -endif() - -if (ENABLE_MYRIAD) - add_definitions(-DENABLE_MYRIAD=1) -endif() - -if (ENABLE_MYRIAD_NO_BOOT AND ENABLE_MYRIAD ) - add_definitions(-DENABLE_MYRIAD_NO_BOOT=1) -endif() - -if (ENABLE_CLDNN) - add_definitions(-DENABLE_CLDNN=1) -endif() - -if (ENABLE_MKL_DNN) - add_definitions(-DENABLE_MKL_DNN=1) -endif() - -if (ENABLE_GNA) - add_definitions(-DENABLE_GNA) - - if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4) - message(WARNING "${GNA_LIBRARY_VERSION} is not supported on GCC version ${CMAKE_CXX_COMPILER_VERSION}. Fallback to GNA1") - set(GNA_LIBRARY_VERSION GNA1) - endif() -endif() - -if (ENABLE_SPEECH_DEMO) - add_definitions(-DENABLE_SPEECH_DEMO) -endif() - -print_enabled_features() diff --git a/inference-engine/cmake/coverage_ie.cmake b/inference-engine/cmake/coverage.cmake similarity index 100% rename from inference-engine/cmake/coverage_ie.cmake rename to inference-engine/cmake/coverage.cmake diff --git a/inference-engine/cmake/dependencies.cmake b/inference-engine/cmake/dependencies.cmake index 86822bbbfd2946..988b158eaf3525 100644 --- a/inference-engine/cmake/dependencies.cmake +++ b/inference-engine/cmake/dependencies.cmake @@ -4,10 +4,7 @@ cmake_policy(SET CMP0054 NEW) -include(models) - -#we have number of dependencies stored on ftp -include(dependency_solver) +# we have number of dependencies stored on ftp if (CMAKE_CROSSCOMPILING) set(CMAKE_STAGING_PREFIX "${TEMP}") @@ -32,7 +29,6 @@ message(STATUS "MODELS_PATH=" ${MODELS_PATH}) fetch_models_and_validation_set() -include(linux_name) if(COMMAND get_linux_name) get_linux_name(LINUX_OS_NAME) endif() @@ -40,7 +36,7 @@ endif() include(CMakeParseArguments) if (ENABLE_MYRIAD) - include(vpu_dependencies) + include(cmake/vpu_dependencies.cmake) endif() ## enable cblas_gemm from OpenBLAS package @@ -286,9 +282,13 @@ if (ENABLE_OPENCV) log_rpath_from_dir(OPENCV "${OpenCV_DIR}/../lib") endif() debug_message(STATUS "opencv=" ${OPENCV}) +else() + reset_deps_cache(OpenCV_DIR) endif() -include(ie_parallel) +# TODO: remove global CMAKE_MODULE_PATH +list(APPEND CMAKE_MODULE_PATH "${IEDevScripts_DIR}") +include(cmake/ie_parallel.cmake) if (ENABLE_GNA) reset_deps_cache( @@ -363,18 +363,3 @@ if (ENABLE_SPEECH_DEMO) endif() update_deps_cache(SPEECH_LIBS_AND_DEMOS "${SPEECH_LIBS_AND_DEMOS}" "Path to SPEECH_LIBS_AND_DEMOS root folder") endif() - -configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/share/InferenceEngineConfig.cmake.in" - "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake" - @ONLY) - -configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/share/InferenceEngineConfig-version.cmake.in" - "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig-version.cmake" - COPYONLY) - -configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/ie_parallel.cmake" - "${CMAKE_BINARY_DIR}/share/ie_parallel.cmake" - COPYONLY) diff --git a/inference-engine/cmake/developer_package_ie.cmake b/inference-engine/cmake/developer_package_ie.cmake deleted file mode 100644 index 86e9b111774b3c..00000000000000 --- a/inference-engine/cmake/developer_package_ie.cmake +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2018-2020 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 -# - -set(TBB_FIND_RELEASE_ONLY ${ENABLE_TBB_RELEASE_ONLY}) - -include(plugins/plugins) -include(add_ie_target) diff --git a/inference-engine/cmake/features_ie.cmake b/inference-engine/cmake/features.cmake similarity index 83% rename from inference-engine/cmake/features_ie.cmake rename to inference-engine/cmake/features.cmake index 1f65b910867f9f..1c8c26339c922a 100644 --- a/inference-engine/cmake/features_ie.cmake +++ b/inference-engine/cmake/features.cmake @@ -2,9 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 # -include (target_flags) -include (options) - #these options are aimed to optimize build time on development system ie_dependent_option (ENABLE_GNA "GNA support for inference engine" ON "NOT APPLE;NOT ANDROID;X86 OR X86_64" OFF) @@ -86,12 +83,6 @@ ie_dependent_option (ENABLE_SPEECH_DEMO "enable speech demo integration" ON "NOT ie_option (ENABLE_FUZZING "instrument build for fuzzing" OFF) -ie_option (VERBOSE_BUILD "shows extra information about build" OFF) - -ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF) - -ie_option (ENABLE_ALTERNATIVE_TEMP "in case of dependency conflict, to avoid modification in master, use local copy of dependency" ON) - ie_option (ENABLE_OPENCV "enables OpenCV" ON) ie_option (ENABLE_PYTHON "enables ie python bridge build" OFF) @@ -103,3 +94,42 @@ 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 (USE_SYSTEM_PUGIXML "use the system copy of pugixml" OFF) + +# +# Process featues +# + +if (ENABLE_PROFILING_RAW) + add_definitions(-DENABLE_PROFILING_RAW=1) +endif() + +if (ENABLE_MYRIAD) + add_definitions(-DENABLE_MYRIAD=1) +endif() + +if (ENABLE_MYRIAD_NO_BOOT AND ENABLE_MYRIAD ) + add_definitions(-DENABLE_MYRIAD_NO_BOOT=1) +endif() + +if (ENABLE_CLDNN) + add_definitions(-DENABLE_CLDNN=1) +endif() + +if (ENABLE_MKL_DNN) + add_definitions(-DENABLE_MKL_DNN=1) +endif() + +if (ENABLE_GNA) + add_definitions(-DENABLE_GNA) + + if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.4) + message(WARNING "${GNA_LIBRARY_VERSION} is not supported on GCC version ${CMAKE_CXX_COMPILER_VERSION}. Fallback to GNA1") + set(GNA_LIBRARY_VERSION GNA1) + endif() +endif() + +if (ENABLE_SPEECH_DEMO) + add_definitions(-DENABLE_SPEECH_DEMO) +endif() + +print_enabled_features() diff --git a/inference-engine/cmake/FindlibGNA.cmake b/inference-engine/cmake/libGNAConfig.cmake similarity index 100% rename from inference-engine/cmake/FindlibGNA.cmake rename to inference-engine/cmake/libGNAConfig.cmake diff --git a/inference-engine/cmake/config.cmake.in b/inference-engine/cmake/templates/InferenceEngineConfig-build.cmake.in similarity index 96% rename from inference-engine/cmake/config.cmake.in rename to inference-engine/cmake/templates/InferenceEngineConfig-build.cmake.in index fd015955e34e56..723d6f8cf85114 100644 --- a/inference-engine/cmake/config.cmake.in +++ b/inference-engine/cmake/templates/InferenceEngineConfig-build.cmake.in @@ -11,7 +11,7 @@ if(DEFINED IE_MAIN_SOURCE_DIR AND TARGET inference_engine) add_library(IE::inference_engine_c_api ALIAS inference_engine_c_api) endif() else() - include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake") + include("${CMAKE_CURRENT_LIST_DIR}/inference_engine_targets.cmake") if(NOT MSVC) set_target_properties(IE::inference_engine PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-error=deprecated-declarations") endif() diff --git a/inference-engine/cmake/share/InferenceEngineConfig-version.cmake.in b/inference-engine/cmake/templates/InferenceEngineConfig-version.cmake.in similarity index 100% rename from inference-engine/cmake/share/InferenceEngineConfig-version.cmake.in rename to inference-engine/cmake/templates/InferenceEngineConfig-version.cmake.in diff --git a/inference-engine/cmake/share/InferenceEngineConfig.cmake.in b/inference-engine/cmake/templates/InferenceEngineConfig.cmake.in similarity index 100% rename from inference-engine/cmake/share/InferenceEngineConfig.cmake.in rename to inference-engine/cmake/templates/InferenceEngineConfig.cmake.in diff --git a/inference-engine/cmake/developer_package_config.cmake.in b/inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in similarity index 59% rename from inference-engine/cmake/developer_package_config.cmake.in rename to inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 4f7bfbb317a3fb..4772b299d0a131 100644 --- a/inference-engine/cmake/developer_package_config.cmake.in +++ b/inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -2,14 +2,14 @@ # SPDX-License-Identifier: Apache-2.0 # -set(OpenVINO_MAIN_SOURCE_DIR "@OpenVINO_SOURCE_DIR@") -set(IE_MAIN_SOURCE_DIR "@InferenceEngine_SOURCE_DIR@") - -file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path) +# TODO: remove after changing [private plugins] +set(OpenVINO_MAIN_SOURCE_DIR "@OpenVINO_MAIN_SOURCE_DIR@") # KMB, HDDL +set(IE_MAIN_SOURCE_DIR "@IE_MAIN_SOURCE_DIR@") # KMB, HDDL # Variables to export in plugin's projects set(ie_options "@IE_OPTIONS@;CMAKE_BUILD_TYPE;CMAKE_SKIP_RPATH") +file(TO_CMAKE_PATH "${CMAKE_CURRENT_LIST_DIR}" cache_path) foreach(option IN LISTS ie_options) if(NOT DEFINED "${option}") @@ -25,15 +25,20 @@ endforeach() message("") set(gflags_DIR "@gflags_BINARY_DIR@") + # GNA lib dir set(GNA "@GNA@") # Targets -include("${CMAKE_CURRENT_LIST_DIR}/targets_developer.cmake") +if(USE_SYSTEM_PUGIXML) + find_package(PugiXML REQUIRED) + set_property(TARGET pugixml PROPERTY IMPORTED_GLOBAL TRUE) +endif() -# to allow too create ALIAS for IE::inference_engine in 3rd-party projects -set_property(TARGET IE::inference_engine PROPERTY IMPORTED_GLOBAL TRUE) +foreach(component @openvino_export_components@) + include("${CMAKE_CURRENT_LIST_DIR}/${component}_dev_targets.cmake") +endforeach() get_target_property(InferenceEngine_INCLUDE_DIRS IE::inference_engine INTERFACE_INCLUDE_DIRECTORIES) set(InferenceEngine_LIBRARIES IE::inference_engine) @@ -42,12 +47,17 @@ set(InferenceEngine_LIBRARIES IE::inference_engine) # Common cmake includes # -list(APPEND CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake") -list(APPEND CMAKE_MODULE_PATH "${IE_MAIN_SOURCE_DIR}/cmake") +# TODO: remove after private plugin change +list(APPEND CMAKE_MODULE_PATH "@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_package" # KMB + "@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_package/download" # KMB, HDDL + "@IE_MAIN_SOURCE_DIR@/cmake") # HDDL + +# Inference Engine Developer Scripts package -# generic stuff from developer package -include(developer_package NO_POLICY_SCOPE) -include(developer_package_ie) +find_package(IEDevScripts REQUIRED + PATHS "@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_package" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) # Don't threat deprecated API warnings as errors in 3rd party apps ie_deprecated_no_errors() diff --git a/inference-engine/cmake/vpu_dependencies.cmake b/inference-engine/cmake/vpu_dependencies.cmake index 39f0b630bf608c..ee718952dd9ab6 100644 --- a/inference-engine/cmake/vpu_dependencies.cmake +++ b/inference-engine/cmake/vpu_dependencies.cmake @@ -2,16 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # -if(CMAKE_VERSION VERSION_GREATER 3.9.6) - include_guard(GLOBAL) -else() - if(__CURRENT_FILE_VAR__) - return() - endif() - set(__CURRENT_FILE_VAR__ TRUE) -endif() - -include(dependency_solver) +include_guard(GLOBAL) set(VPU_SUPPORTED_FIRMWARES usb-ma2x8x pcie-ma2x8x) set(VPU_SUPPORTED_FIRMWARES_HASH diff --git a/inference-engine/ie_bridges/c/src/CMakeLists.txt b/inference-engine/ie_bridges/c/src/CMakeLists.txt index 223b635a72dd43..586f3e216772a8 100644 --- a/inference-engine/ie_bridges/c/src/CMakeLists.txt +++ b/inference-engine/ie_bridges/c/src/CMakeLists.txt @@ -24,7 +24,8 @@ ie_add_vs_version_file(NAME ${TARGET_NAME} # export -export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/targets.cmake") +export(TARGETS ${TARGET_NAME} NAMESPACE IE:: + APPEND FILE "${CMAKE_BINARY_DIR}/inference_engine_targets.cmake") # install diff --git a/inference-engine/ie_bridges/python/CMakeLists.txt b/inference-engine/ie_bridges/python/CMakeLists.txt index 8e70e5ac2941e4..c56af0abde0051 100644 --- a/inference-engine/ie_bridges/python/CMakeLists.txt +++ b/inference-engine/ie_bridges/python/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required (VERSION 3.13) # Set the project name project (ie_python_api) -set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake") option(ENABLE_CONDA_FOLDER "Create output folder with conda python bindings" OFF) @@ -30,7 +29,7 @@ if(UNIX) set(CMAKE_C_VISIBILITY_PRESET default) endif() -include (UseCython) +include (cmake/UseCython.cmake) if(PYTHONINTERP_FOUND) set(PYTHON_VERSION python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) @@ -56,7 +55,7 @@ set (PYTHON_BRIDGE_SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory (src/openvino/inference_engine) # Check Cython version -if("${CYTHON_VERSION}" VERSION_LESS "0.29") +if(CYTHON_VERSION VERSION_LESS "0.29") message(FATAL_ERROR "OpenVINO Python API needs at least Cython version 0.29, found version ${CYTHON_VERSION}") else() message(STATUS "Found Cython version ${CYTHON_VERSION}") diff --git a/inference-engine/ie_bridges/python/cmake/FindCython.cmake b/inference-engine/ie_bridges/python/cmake/CythonConfig.cmake similarity index 100% rename from inference-engine/ie_bridges/python/cmake/FindCython.cmake rename to inference-engine/ie_bridges/python/cmake/CythonConfig.cmake diff --git a/inference-engine/ie_bridges/python/cmake/UseCython.cmake b/inference-engine/ie_bridges/python/cmake/UseCython.cmake index 04dfaf6c034151..a71e38d136a07c 100644 --- a/inference-engine/ie_bridges/python/cmake/UseCython.cmake +++ b/inference-engine/ie_bridges/python/cmake/UseCython.cmake @@ -88,7 +88,10 @@ set( CYTHON_FLAGS "" CACHE STRING "Extra flags to the cython compiler." ) mark_as_advanced( CYTHON_ANNOTATE CYTHON_NO_DOCSTRINGS CYTHON_FLAGS ) -find_package( Cython REQUIRED ) +find_package( Cython REQUIRED + PATHS "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH ) find_package( PythonLibs REQUIRED ) set( CYTHON_CXX_EXTENSION "cxx" ) diff --git a/inference-engine/src/gna_plugin/CMakeLists.txt b/inference-engine/src/gna_plugin/CMakeLists.txt index 17f6201caaec90..49d96301b28c72 100644 --- a/inference-engine/src/gna_plugin/CMakeLists.txt +++ b/inference-engine/src/gna_plugin/CMakeLists.txt @@ -12,7 +12,9 @@ file(GLOB_RECURSE HEADERS addVersionDefines(gna_plugin_entry_points.cpp CI_BUILD_NUMBER) -find_package(libGNA) +find_package(libGNA REQUIRED + PATHS "${IE_MAIN_SOURCE_DIR}/cmake" + NO_DEFAULT_PATH) if(GNA_LIBRARY_VERSION STREQUAL "GNA2") set(GNA_LIBRARY_VERSION_NUMBER 2) diff --git a/inference-engine/src/inference_engine/CMakeLists.txt b/inference-engine/src/inference_engine/CMakeLists.txt index c877a7e86d806d..52b087dcdabb8c 100644 --- a/inference-engine/src/inference_engine/CMakeLists.txt +++ b/inference-engine/src/inference_engine/CMakeLists.txt @@ -174,8 +174,7 @@ if(WIN32) endif() target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt openvino::conditional_compilation ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES} - inference_engine_transformations - PUBLIC pugixml) + inference_engine_transformations pugixml) target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE) @@ -186,28 +185,41 @@ set_target_properties(${TARGET_NAME}_s PROPERTIES EXCLUDE_FROM_ALL ON) set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj ${TARGET_NAME}_s PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) -# export targets +# InferenceEngineConfig.cmake for install tree -export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/targets.cmake") +configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig.cmake.in" + "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig.cmake" @ONLY) -configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/config.cmake.in" - "${CMAKE_BINARY_DIR}/InferenceEngineConfig.cmake" - COPYONLY) +configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in" + "${CMAKE_BINARY_DIR}/share/InferenceEngineConfig-version.cmake" + COPYONLY) -configure_file( - "${IE_MAIN_SOURCE_DIR}/cmake/share/InferenceEngineConfig-version.cmake.in" - "${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" - COPYONLY) +configure_file("${IE_MAIN_SOURCE_DIR}/cmake/ie_parallel.cmake" + "${CMAKE_BINARY_DIR}/share/ie_parallel.cmake" + COPYONLY) -# developer package +# Export Inference Engine targets + +export(TARGETS ${TARGET_NAME} NAMESPACE IE:: + APPEND FILE "${CMAKE_BINARY_DIR}/inference_engine_targets.cmake") + +configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-build.cmake.in" + "${CMAKE_BINARY_DIR}/InferenceEngineConfig.cmake" + COPYONLY) + +configure_file("${IE_MAIN_SOURCE_DIR}/cmake/templates/InferenceEngineConfig-version.cmake.in" + "${CMAKE_BINARY_DIR}/InferenceEngineConfig-version.cmake" + COPYONLY) + +# Export for developer package add_library(xbyak INTERFACE) target_include_directories(xbyak INTERFACE ${IE_MAIN_SOURCE_DIR}/thirdparty/mkl-dnn/src/cpu/xbyak) -ie_developer_export_targets(${TARGET_NAME} ${TARGET_NAME}_plugin_api xbyak) +openvino_developer_export_targets(COMPONENT openvino_common TARGETS xbyak) +ie_developer_export_targets(${TARGET_NAME} ${TARGET_NAME}_plugin_api) -# install +# install TBB list(APPEND core_components ngraph) @@ -235,6 +247,8 @@ if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND TBBROOT MATCH COMPONENT tbb) endif() +# Install Inference Engine + ie_cpack_add_component(core REQUIRED DEPENDS ${core_components}) install(DIRECTORY "${IE_MAIN_SOURCE_DIR}/include" DESTINATION ${IE_CPACK_IE_DIR} diff --git a/inference-engine/src/legacy_api/CMakeLists.txt b/inference-engine/src/legacy_api/CMakeLists.txt index 0b40fd9e71d373..fb41567217acf3 100644 --- a/inference-engine/src/legacy_api/CMakeLists.txt +++ b/inference-engine/src/legacy_api/CMakeLists.txt @@ -75,10 +75,6 @@ ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME}) set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) -# export targets - -export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/targets.cmake") - # developer package ie_developer_export_targets(${TARGET_NAME}) diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_split_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_split_node.cpp index bac3366f98dd19..671223e813ba03 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_split_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_split_node.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #define THROW_ERROR THROW_IE_EXCEPTION << "Split layer with name '" << getName() <<"' " diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt index 5b8267bbb87609..ad900610d16f74 100644 --- a/inference-engine/src/vpu/common/CMakeLists.txt +++ b/inference-engine/src/vpu/common/CMakeLists.txt @@ -49,7 +49,7 @@ function(add_common_target TARGET_NAME STATIC_IE) set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) - ie_developer_export_targets(${TARGET_NAME}) + openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) target_link_libraries(${TARGET_NAME} PUBLIC ${NGRAPH_LIBRARIES} inference_engine_transformations PRIVATE openvino::itt) diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt index ec799a6ac54694..8bcdad0d6048dd 100644 --- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt @@ -54,7 +54,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") - ie_developer_export_targets(${TARGET_NAME}) + openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) endif() set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO}) diff --git a/inference-engine/tests/CMakeLists.txt b/inference-engine/tests/CMakeLists.txt index 6b63763c2f45d7..132f4083351507 100644 --- a/inference-engine/tests/CMakeLists.txt +++ b/inference-engine/tests/CMakeLists.txt @@ -11,8 +11,5 @@ add_subdirectory(unit) if(ENABLE_FUNCTIONAL_TESTS) add_subdirectory(ie_test_utils) -endif() - -if (ENABLE_FUNCTIONAL_TESTS) add_subdirectory(functional) endif() \ No newline at end of file diff --git a/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/core_threading_tests.cpp b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/core_threading_tests.cpp index 1a6bd93d8293ec..1adbd58045b832 100644 --- a/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/core_threading_tests.cpp +++ b/inference-engine/tests/functional/plugin/gna/shared_tests_instances/behavior/core_threading_tests.cpp @@ -16,7 +16,7 @@ std::vector< std::tuple > paramsWithIterations{ params[0], param INSTANTIATE_TEST_CASE_P(GNA, CoreThreadingTests, testing::ValuesIn(params), CoreThreadingTests::getTestCaseName); -INSTANTIATE_TEST_CASE_P(GNA, CoreThreadingTestsWithIterations, +INSTANTIATE_TEST_CASE_P(DISABLED_GNA, CoreThreadingTestsWithIterations, testing::Combine(testing::ValuesIn(paramsWithIterations), testing::Values(3), testing::Values(4), diff --git a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt index d80bb2ba6e7eee..05fa0e4d2e32d6 100644 --- a/inference-engine/tests/functional/plugin/shared/CMakeLists.txt +++ b/inference-engine/tests/functional/plugin/shared/CMakeLists.txt @@ -22,6 +22,7 @@ addIeTarget( ${CMAKE_CURRENT_SOURCE_DIR}/src ADD_CPPLINT DEVELOPER_PACKAGE + inference_engine_tests INCLUDES PUBLIC ${PUBLIC_HEADERS_DIR} diff --git a/inference-engine/tests/functional/shared_test_classes/CMakeLists.txt b/inference-engine/tests/functional/shared_test_classes/CMakeLists.txt index b0a95b09709e18..092cb2b440827e 100644 --- a/inference-engine/tests/functional/shared_test_classes/CMakeLists.txt +++ b/inference-engine/tests/functional/shared_test_classes/CMakeLists.txt @@ -15,6 +15,7 @@ addIeTarget( ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include" ADD_CPPLINT DEVELOPER_PACKAGE + inference_engine_tests INCLUDES PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" diff --git a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt index 6dee3f11890b38..4b19b4190ed256 100644 --- a/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt +++ b/inference-engine/tests/ie_test_utils/common_test_utils/CMakeLists.txt @@ -52,8 +52,6 @@ else () endif () list(APPEND EXPORT_DEPENDENCIES - ${PUGI} - ${NGRAPH_LIBRARIES} gtest gtest_main ) @@ -70,8 +68,13 @@ function(add_common_utils ADD_TARGET_NAME) ${CMAKE_CURRENT_SOURCE_DIR}/gtest ADD_CPPLINT DEVELOPER_PACKAGE + inference_engine_tests EXPORT_DEPENDENCIES ${EXPORT_DEPENDENCIES} + LINK_LIBRARIES + PUBLIC + ${PUGI} + ${NGRAPH_LIBRARIES} ) ie_faster_build(${ADD_TARGET_NAME} @@ -96,21 +99,21 @@ function(add_common_utils ADD_TARGET_NAME) endif () target_include_directories(${ADD_TARGET_NAME} - PUBLIC + PUBLIC ${IE_TESTS_ROOT}/ie_test_utils $ $ $ - PRIVATE + PRIVATE $ - ) + ) target_compile_definitions(${ADD_TARGET_NAME} PUBLIC ${ARGN}) target_link_libraries(${ADD_TARGET_NAME} - PUBLIC + PUBLIC ${EXPORT_DEPENDENCIES} - ) + ) endfunction() add_common_utils(${TARGET_NAME}) diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/CMakeLists.txt b/inference-engine/tests/ie_test_utils/functional_test_utils/CMakeLists.txt index 623648e691d29a..d7e8862c9b4190 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/CMakeLists.txt +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/CMakeLists.txt @@ -5,10 +5,7 @@ set(TARGET_NAME funcTestUtils) list(APPEND EXPORT_DEPENDENCIES - inference_engine_lp_transformations commonTestUtils - inference_engine - inference_engine_legacy ) addIeTarget( @@ -17,6 +14,7 @@ addIeTarget( ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include" ADD_CPPLINT DEVELOPER_PACKAGE + inference_engine_tests INCLUDES PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" @@ -26,6 +24,9 @@ addIeTarget( PUBLIC ${EXPORT_DEPENDENCIES} inference_engine_transformations + inference_engine_lp_transformations + inference_engine + inference_engine_legacy INCLUDES PUBLIC $ diff --git a/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt b/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt index 5413d1389522b1..ab956218aabd08 100644 --- a/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt +++ b/inference-engine/tests/ie_test_utils/unit_test_utils/CMakeLists.txt @@ -17,6 +17,7 @@ addIeTarget( ROOT ${CMAKE_CURRENT_SOURCE_DIR} ADD_CPPLINT DEVELOPER_PACKAGE + inference_engine_tests EXPORT_DEPENDENCIES ${EXPORT_DEPENDENCIES} ) diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/CMakeLists.txt b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/CMakeLists.txt index 32a0f871ff0854..9b9f82ae56ece3 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/CMakeLists.txt +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/CMakeLists.txt @@ -6,8 +6,6 @@ set(TARGET_NAME lptNgraphFunctions) list(APPEND EXPORT_DEPENDENCIES ngraphFunctions - inference_engine_lp_transformations - inference_engine_legacy ) set(PUBLIC_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") @@ -24,10 +22,13 @@ addIeTarget( LINK_LIBRARIES PRIVATE ${EXPORT_DEPENDENCIES} + inference_engine_lp_transformations + inference_engine_legacy ADD_CPPLINT DEPENDENCIES ngraphFunctions DEVELOPER_PACKAGE + inference_engine_tests EXPORT_DEPENDENCIES ${EXPORT_DEPENDENCIES} ) diff --git a/inference-engine/tests/ngraph_helpers/ngraph_functions/CMakeLists.txt b/inference-engine/tests/ngraph_helpers/ngraph_functions/CMakeLists.txt index a7514816390cc4..260aaa213bfdd3 100644 --- a/inference-engine/tests/ngraph_helpers/ngraph_functions/CMakeLists.txt +++ b/inference-engine/tests/ngraph_helpers/ngraph_functions/CMakeLists.txt @@ -22,12 +22,13 @@ addIeTarget( ADDITIONAL_SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src LINK_LIBRARIES - PUBLIC - ${EXPORT_DEPENDENCIES} + PUBLIC + ${NGRAPH_LIBRARIES} + ngraph_backend + interpreter_backend ADD_CPPLINT DEVELOPER_PACKAGE - EXPORT_DEPENDENCIES - ${EXPORT_DEPENDENCIES} + inference_engine_tests ) ie_faster_build(${TARGET_NAME} diff --git a/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt b/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt index ac558570ef058a..d18283e4b25b06 100644 --- a/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/behavior/shared_tests/CMakeLists.txt @@ -33,4 +33,4 @@ target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/plugin_tests) # developer package -ie_developer_export_targets(${TARGET_NAME}) +openvino_developer_export_targets(COMPONENT inference_engine_tests TARGETS ${TARGET_NAME}) diff --git a/inference-engine/tests_deprecated/functional/ie_tests/CMakeLists.txt b/inference-engine/tests_deprecated/functional/ie_tests/CMakeLists.txt index 697411c550c9dc..c3ba343e659abb 100644 --- a/inference-engine/tests_deprecated/functional/ie_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/ie_tests/CMakeLists.txt @@ -32,4 +32,5 @@ target_link_libraries(${TARGET_NAME} PUBLIC # developer package -ie_developer_export_targets(${TARGET_NAME} ${EXPORT_DEPENDENCIES} ieTestHelpers_s) +openvino_developer_export_targets(COMPONENT inference_engine_tests + TARGETS ${TARGET_NAME} ${EXPORT_DEPENDENCIES} ieTestHelpers_s) diff --git a/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt b/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt index c426ac28298ab5..65289c7c788c7e 100644 --- a/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/shared_tests/CMakeLists.txt @@ -62,4 +62,4 @@ add_dependencies(${TARGET_NAME} HeteroPlugin) # developer package -ie_developer_export_targets(${TARGET_NAME}) +openvino_developer_export_targets(COMPONENT inference_engine_tests TARGETS ${TARGET_NAME}) diff --git a/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt b/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt index d9007d5994c862..1ee7e078f4f114 100644 --- a/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt +++ b/inference-engine/tests_deprecated/functional/vpu/CMakeLists.txt @@ -14,7 +14,7 @@ endif() addIeTarget( NAME myriadTestData - DEVELOPER_PACKAGE + DEVELOPER_PACKAGE inference_engine_tests TYPE STATIC ROOT ${CMAKE_CURRENT_SOURCE_DIR}/test_data LINK_LIBRARIES @@ -27,7 +27,7 @@ addIeTarget( addIeTarget( NAME VPUCommonTests - DEVELOPER_PACKAGE + DEVELOPER_PACKAGE inference_engine_tests TYPE STATIC ROOT ${CMAKE_CURRENT_SOURCE_DIR}/common ADDITIONAL_SOURCE_DIRS @@ -40,8 +40,6 @@ addIeTarget( IESharedTests vpu_graph_transformer vpu_custom_kernels - EXPORT_DEPENDENCIES - vpu_custom_kernels ) target_include_directories(VPUCommonTests INTERFACE @@ -50,7 +48,8 @@ target_include_directories(VPUCommonTests INTERFACE $ ) -ie_developer_export_targets(vpu_custom_kernels) +openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS vpu_custom_kernels) + addIeTargetTest( NAME MyriadFunctionalTests ROOT ${CMAKE_CURRENT_SOURCE_DIR}/myriad_tests diff --git a/inference-engine/thirdparty/CMakeLists.txt b/inference-engine/thirdparty/CMakeLists.txt index cd35228121fd1d..283bbbabb8f4a1 100644 --- a/inference-engine/thirdparty/CMakeLists.txt +++ b/inference-engine/thirdparty/CMakeLists.txt @@ -70,13 +70,13 @@ set_target_properties(ade fluid stb_image PROPERTIES FOLDER thirdparty) # developer package -ie_developer_export_targets(ade fluid) +openvino_developer_export_targets(COMPONENT openvino_common TARGETS ade fluid) if (NOT USE_SYSTEM_PUGIXML) set_target_properties(pugixml PROPERTIES FOLDER thirdparty) - ie_developer_export_targets(pugixml) + openvino_developer_export_targets(COMPONENT openvino_common TARGETS pugixml) if(TARGET pugixml_mt) - ie_developer_export_targets(pugixml_mt) + openvino_developer_export_targets(COMPONENT openvino_common TARGETS pugixml_mt) set_target_properties(pugixml_mt PROPERTIES FOLDER thirdparty) endif() endif() diff --git a/ngraph/CMakeLists.txt b/ngraph/CMakeLists.txt index 587cffdf019b99..e9db9d565bc295 100644 --- a/ngraph/CMakeLists.txt +++ b/ngraph/CMakeLists.txt @@ -15,11 +15,7 @@ # ****************************************************************************** # set directory where the custom finders live -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") - -if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - message(FATAL_ERROR "In-source builds are not allowed.") -endif() +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") if (CMAKE_BUILD_TYPE) set(RELEASE_TYPES Debug Release RelWithDebInfo MinSizeRel) @@ -415,7 +411,7 @@ if(NGRAPH_DEPRECATED_ENABLE) add_definitions(-DNGRAPH_DEPRECATED_ENABLE) endif() -add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_SOURCE_DIR}") +add_definitions(-DPROJECT_ROOT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") #----------------------------------------------------------------------------------------------- # Print Global Options diff --git a/ngraph/core/builder/CMakeLists.txt b/ngraph/core/builder/CMakeLists.txt index 4c5a4766d84fb7..9cf04ceca0d256 100644 --- a/ngraph/core/builder/CMakeLists.txt +++ b/ngraph/core/builder/CMakeLists.txt @@ -43,9 +43,9 @@ target_include_directories(${TARGET_NAME} PRIVATE ${NGRAPH_INCLUDE_PATH} ${BUILDER_INCLUDE_DIR}/ngraph/ ${BUILDER_INCLUDE_DIR}/ngraph/builder) -#Add an alias so that library can be used inside the build tree, e.g. when testing +# Add an alias so that library can be used inside the build tree, e.g. when testing add_library(ngraph::builder ALIAS ${TARGET_NAME}) # developer package -openvino_developer_export_targets(ngraph::builder) +openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph::builder) diff --git a/ngraph/core/reference/CMakeLists.txt b/ngraph/core/reference/CMakeLists.txt index 2fa49195b34022..5b0705f9baf4a0 100644 --- a/ngraph/core/reference/CMakeLists.txt +++ b/ngraph/core/reference/CMakeLists.txt @@ -47,4 +47,4 @@ add_library(ngraph::reference ALIAS ${TARGET_NAME}) # developer package -openvino_developer_export_targets(ngraph::reference) +openvino_developer_export_targets(COMPONENT ngraph TARGETS ngraph::reference) diff --git a/openvino/CMakeLists.txt b/openvino/CMakeLists.txt index 2d6ebf915f2933..cf548389b360a3 100644 --- a/openvino/CMakeLists.txt +++ b/openvino/CMakeLists.txt @@ -17,4 +17,4 @@ add_subdirectory(itt) add_subdirectory(conditional_compilation) -openvino_developer_export_targets(openvino::itt openvino::conditional_compilation) +openvino_developer_export_targets(COMPONENT openvino_common TARGETS openvino::itt openvino::conditional_compilation) diff --git a/openvino/itt/CMakeLists.txt b/openvino/itt/CMakeLists.txt index c67a68d53cc509..22b287164fb552 100644 --- a/openvino/itt/CMakeLists.txt +++ b/openvino/itt/CMakeLists.txt @@ -16,13 +16,13 @@ set(TARGET_NAME itt) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.hpp") if(ENABLE_PROFILING_ITT) if(DEFINED INTEL_VTUNE_DIR OR DEFINED ENV{INTEL_VTUNE_DIR}) - find_package(ITT) + find_package(ITT + PATHS "${CMAKE_CURRENT_SOURCE_DIR}/cmake" + NO_DEFAULT_PATH) if(NOT ITT_FOUND) message(WARNING "Profiling option enabled, but no ITT library was found under INTEL_VTUNE_DIR") endif() @@ -45,7 +45,7 @@ if(ENABLE_PROFILING_ITT) target_compile_options(ittnotify PRIVATE -Wno-undef) endif() - openvino_developer_export_targets(ittnotify) + openvino_developer_export_targets(COMPONENT openvino_common TARGETS ittnotify) endif() endif() diff --git a/openvino/itt/cmake/FindITT.cmake b/openvino/itt/cmake/ITTConfig.cmake similarity index 100% rename from openvino/itt/cmake/FindITT.cmake rename to openvino/itt/cmake/ITTConfig.cmake diff --git a/tests/fuzz/CMakeLists.txt b/tests/fuzz/CMakeLists.txt index f5946e24e52813..285d813fd8d6b7 100644 --- a/tests/fuzz/CMakeLists.txt +++ b/tests/fuzz/CMakeLists.txt @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.13 FATAL_ERROR) set(OpenVINO_MAIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) -set(CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) +set(CMAKE_MODULE_PATH "${OpenVINO_MAIN_SOURCE_DIR}/cmake/developer_package" ${CMAKE_MODULE_PATH}) if (CMAKE_BUILD_TYPE STREQUAL "") message(STATUS "CMAKE_BUILD_TYPE not defined, 'Release' will be used") @@ -16,7 +16,7 @@ if (NOT TARGET IE::inference_engine) find_package(InferenceEngineDeveloperPackage REQUIRED) endif() -include(sanitizer) +include(compile_flags/sanitizer) include(fuzzing) if (NOT ENABLE_FUZZING)