From 1740df388dabf1614169c7933d4920856861f588 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Thu, 17 Dec 2020 21:18:15 +0300 Subject: [PATCH] Final fixes --- .../developer_package/IEDevScriptsConfig.cmake | 18 +++++++++++------- .../developer_package/coverage/coverage.cmake | 2 +- cmake/developer_package/options.cmake | 5 ++++- .../shellcheck/shellcheck.cmake | 2 +- cmake/developer_package/version.cmake | 10 ++++++++-- ...erenceEngineDeveloperPackageConfig.cmake.in | 9 +++++---- 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/cmake/developer_package/IEDevScriptsConfig.cmake b/cmake/developer_package/IEDevScriptsConfig.cmake index 818aef5880c9a0..5acc212aab001b 100644 --- a/cmake/developer_package/IEDevScriptsConfig.cmake +++ b/cmake/developer_package/IEDevScriptsConfig.cmake @@ -11,6 +11,14 @@ endif() set(OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) list(APPEND 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) # @@ -104,6 +112,9 @@ 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() @@ -200,13 +211,6 @@ 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) diff --git a/cmake/developer_package/coverage/coverage.cmake b/cmake/developer_package/coverage/coverage.cmake index e2fa3b57edee79..71c24fcd9ddab3 100644 --- a/cmake/developer_package/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/developer_package/options.cmake b/cmake/developer_package/options.cmake index b4bb86b1d6e23f..cedbd099962029 100644 --- a/cmake/developer_package/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/shellcheck/shellcheck.cmake b/cmake/developer_package/shellcheck/shellcheck.cmake index c2e1186d1b122b..df7a310792ba37 100644 --- a/cmake/developer_package/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/developer_package/version.cmake b/cmake/developer_package/version.cmake index db0fe2bb79da7e..9dd1ecbc923780 100644 --- a/cmake/developer_package/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/inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in b/inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in index 2d86e31bc09d19..c3713143e393a1 100644 --- a/inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in +++ b/inference-engine/cmake/templates/InferenceEngineDeveloperPackageConfig.cmake.in @@ -2,10 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 # -# Variables to export in plugin's projects +# 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 -set(OpenVINO_MAIN_SOURCE_DIR "@OpenVINO_MAIN_SOURCE_DIR@") -set(IE_MAIN_SOURCE_DIR "@IE_MAIN_SOURCE_DIR@") +# 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) @@ -40,7 +41,7 @@ set(InferenceEngine_LIBRARIES IE::inference_engine) # 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 + "@OpenVINO_MAIN_SOURCE_DIR@/cmake/developer_package/download" # KMB, HDDL "@IE_MAIN_SOURCE_DIR@/cmake") # HDDL # generic stuff from developer package