From ab2ba77cb3fc6eaf66f5de2f65a63286bb5ba7f9 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 24 Jun 2024 18:36:55 +0400 Subject: [PATCH] Ability to disable ApiVdalidator search (#25069) ### Details: - In some cases API validator search is not robust ### Tickets: - Closes https://github.com/microsoft/vcpkg/issues/38221 --- .../api_validator/api_validator.cmake | 14 +++++++++++--- cmake/features.cmake | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cmake/developer_package/api_validator/api_validator.cmake b/cmake/developer_package/api_validator/api_validator.cmake index 0fd1f2c03a3343..68e6d1fccb5e7d 100644 --- a/cmake/developer_package/api_validator/api_validator.cmake +++ b/cmake/developer_package/api_validator/api_validator.cmake @@ -2,7 +2,11 @@ # SPDX-License-Identifier: Apache-2.0 # -if(WIN32) +function(ov_search_api_validator) + if(NOT ENABLE_API_VALIDATOR) + return() + endif() + # CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION is only set when # Visual Studio generators are used, but we need it # when we use Ninja as well @@ -11,8 +15,10 @@ if(WIN32) string(REPLACE "\\" "" WINDOWS_SDK_VERSION $ENV{WindowsSDKVersion}) set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION ${WINDOWS_SDK_VERSION}) message(STATUS "Use ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} Windows SDK version") + # set to parent scope as well for later usage in '_ov_add_api_validator_post_build_step' + set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION ${WINDOWS_SDK_VERSION} PARENT_SCOPE) else() - message(FATAL_ERROR "WindowsSDKVersion environment variable is not set,\ + message(FATAL_ERROR "WindowsSDKVersion environment variable is not set,\ can't find Windows SDK version. Try to use vcvarsall.bat script") endif() endif() @@ -41,7 +47,9 @@ can't find Windows SDK version. Try to use vcvarsall.bat script") message(STATUS "Found apivalidator: ${ONECORE_API_VALIDATOR}") endif() endif() -endif() +endfunction() + +ov_search_api_validator() function(_ov_add_api_validator_post_build_step_recursive) cmake_parse_arguments(API_VALIDATOR "" "TARGET" "" ${ARGN}) diff --git a/cmake/features.cmake b/cmake/features.cmake index bfa3a05481d77f..7b0c9249dcca89 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -192,6 +192,8 @@ ov_dependent_option(ENABLE_JS "Enables JS API building" ON "NOT ANDROID;NOT EMSC ov_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OFF) +ov_dependent_option (ENABLE_API_VALIDATOR "Enables API Validator usage" ON "WIN32" OFF) + if(NOT BUILD_SHARED_LIBS AND ENABLE_OV_TF_FRONTEND) set(FORCE_FRONTENDS_USE_PROTOBUF ON) else()