--- /dev/null
+# Copyright (C) 2020 Intel Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+
+if(WIN32)
+ set(PROGRAMFILES_ENV "ProgramFiles(X86)")
+ file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)
+ set(UWP_SDK_PATH "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64")
+
+ message(STATUS "Trying to find apivalidator in: ${UWP_SDK_PATH}")
+ find_host_program(UWP_API_VALIDATOR
+ NAMES apivalidator
+ PATHS "${UWP_SDK_PATH}"
+ DOC "ApiValidator for UWP compliance")
+
+ if(UWP_API_VALIDATOR)
+ message(STATUS "Found apivalidator: ${UWP_API_VALIDATOR}")
+ endif()
+endif()
+
+function(_ie_add_api_validator_post_build_step_recursive)
+ cmake_parse_arguments(API_VALIDATOR "" "TARGET" "" ${ARGN})
+
+ list(APPEND API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGET})
+ set(API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGETS} PARENT_SCOPE)
+
+ get_target_property(IS_IMPORTED ${API_VALIDATOR_TARGET} IMPORTED)
+ if(IS_IMPORTED)
+ return()
+ endif()
+
+ get_target_property(LIBRARY_TYPE ${API_VALIDATOR_TARGET} TYPE)
+ if(LIBRARY_TYPE STREQUAL "EXECUTABLE" OR LIBRARY_TYPE STREQUAL "SHARED_LIBRARY")
+ get_target_property(LINKED_LIBRARIES ${API_VALIDATOR_TARGET} LINK_LIBRARIES)
+ if(LINKED_LIBRARIES)
+ foreach(ITEM IN LISTS LINKED_LIBRARIES)
+ if(NOT TARGET ${ITEM})
+ continue()
+ endif()
+ get_target_property(LIBRARY_TYPE_DEPENDENCY ${ITEM} TYPE)
+ if(LIBRARY_TYPE_DEPENDENCY STREQUAL "SHARED_LIBRARY")
+ _ie_add_api_validator_post_build_step_recursive(TARGET ${ITEM})
+ endif()
+ endforeach()
+ endif()
+ endif()
+
+ set(API_VALIDATOR_TARGETS ${API_VALIDATOR_TARGETS} PARENT_SCOPE)
+endfunction()
+
+set(VALIDATED_LIBRARIES "" CACHE INTERNAL "")
+
+function(_ie_add_api_validator_post_build_step)
+ set(UWP_API_VALIDATOR_APIS "${PROGRAMFILES}/Windows Kits/10/build/universalDDIs/x64/UniversalDDIs.xml")
+ set(UWP_API_VALIDATOR_EXCLUSION "${UWP_SDK_PATH}/BinaryExclusionlist.xml")
+
+ if(NOT UWP_API_VALIDATOR OR (WINDOWS_STORE OR WINDOWS_PHONE) OR
+ NOT EXISTS UWP_API_VALIDATOR_APIS OR NOT EXISTS UWP_API_VALIDATOR_EXCLUSION)
+ return()
+ endif()
+
+ cmake_parse_arguments(API_VALIDATOR "" "TARGET" "" ${ARGN})
+
+ if(NOT API_VALIDATOR_TARGET)
+ message(FATAL_ERROR "RunApiValidator requires TARGET to validate!")
+ endif()
+
+ if(NOT TARGET ${API_VALIDATOR_TARGET})
+ message(FATAL_ERROR "${API_VALIDATOR_TARGET} is not a TARGET in the project tree.")
+ endif()
+
+ # collect targets
+
+ _ie_add_api_validator_post_build_step_recursive(TARGET ${API_VALIDATOR_TARGET})
+
+ # remove targets which were tested before
+
+ foreach(item IN LISTS VALIDATED_LIBRARIES)
+ list(REMOVE_ITEM API_VALIDATOR_TARGETS ${item})
+ endforeach()
+
+ list(REMOVE_DUPLICATES API_VALIDATOR_TARGETS)
+
+ if(NOT API_VALIDATOR_TARGETS)
+ return()
+ endif()
+
+ # generate rules
+
+ foreach(target IN LISTS API_VALIDATOR_TARGETS)
+ list(APPEND commands
+ COMMAND "${UWP_API_VALIDATOR}"
+ -SupportedApiXmlFiles:${UWP_API_VALIDATOR_APIS}
+ -BinaryExclusionListXmlFile:${UWP_API_VALIDATOR_EXCLUSION}
+ -StrictCompliance:TRUE
+ -DriverPackagePath:$<TARGET_FILE:${target}>)
+ endforeach()
+
+ # apply rules
+
+ add_custom_command(TARGET ${API_VALIDATOR_TARGET} POST_BUILD
+ ${commands}
+ COMMENT "[apiValidator] Check ${API_VALIDATOR_TARGET} and its dependencies for WCOS compatibility"
+ VERBATIM)
+
+ # update list of validated libraries
+
+ list(APPEND VALIDATED_LIBRARIES ${API_VALIDATOR_TARGETS})
+ set(VALIDATED_LIBRARIES "${VALIDATED_LIBRARIES}" CACHE INTERNAL "" FORCE)
+endfunction()
+
+#
+# ie_add_api_validator_post_build_step(TARGET <name>)
+#
+macro(ie_add_api_validator_post_build_step)
+ _ie_add_api_validator_post_build_step(${ARGV})
+endmacro()
include(sanitizer)
include(cross_compiled_func)
include(faster_build)
+include(api_validator)
function(set_ci_build_number)
set(OpenVINO_MAIN_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
set(CMAKE_SYSTEM_NAME WindowsStore)
-if (NOT DEFINED CMAKE_SYSTEM_VERSION)
+if(NOT DEFINED CMAKE_SYSTEM_VERSION)
set(CMAKE_SYSTEM_VERSION 10.0)
endif()
-if (NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
+if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
add_subdirectory(vpu)
endif()
-if (ENABLE_GNA)
+if(ENABLE_GNA)
add_subdirectory(gna_plugin)
endif()
find_package(libGNA)
-ie_add_plugin(NAME ${TARGET_NAME}
- DEVICE_NAME "GNA"
- SOURCES ${SOURCES} ${HEADERS})
-
if(GNA_LIBRARY_VERSION STREQUAL "GNA2")
- SET(GNA_LIBRARY_VERSION_NUMBER 2)
+ set(GNA_LIBRARY_VERSION_NUMBER 2)
else()
- SET(GNA_LIBRARY_VERSION_NUMBER 1)
+ set(GNA_LIBRARY_VERSION_NUMBER 1)
endif()
-#saving rpath to GNA shared library be used by CI
+#
+# Shared plugin library
+#
+
+ie_add_plugin(NAME ${TARGET_NAME}
+ DEVICE_NAME "GNA"
+ SOURCES ${SOURCES} ${HEADERS})
+
+# saving rpath to GNA shared library be used by CI
log_rpath_from_dir(GNA ${libGNA_LIBRARIES_BASE_PATH})
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine Threads::Threads libGNA)
target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+
target_compile_definitions(${TARGET_NAME}
PRIVATE
_NO_MKL_
PUBLIC
GNA_LIB_VER=${GNA_LIBRARY_VERSION_NUMBER})
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
+#
+# Static version for tests
+#
add_library(${TARGET_NAME}_test_static STATIC ${SOURCES} ${HEADERS})
+
target_compile_definitions(${TARGET_NAME}_test_static
PRIVATE
_NO_MKL_
GNA_LIB_VER=${GNA_LIBRARY_VERSION_NUMBER}
INTEGER_LOW_P
USE_STATIC_IE)
+
target_link_libraries(${TARGET_NAME}_test_static PUBLIC inference_engine_preproc_s inference_engine_lp_transformations libGNA::API)
target_include_directories(${TARGET_NAME}_test_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${TARGET_NAME}_test_static PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_test_static)
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine ade pugixml ${NGRAPH_LIBRARIES} inference_engine_transformations)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
ie_register_plugins(MAIN_TARGET ${TARGET_NAME}
POSSIBLE_PLUGINS MultiDevicePlugin HeteroPlugin clDNNPlugin GNAPlugin MKLDNNPlugin myriadPlugin)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# Static library used for unit tests which are always built
add_library(${TARGET_NAME}_s STATIC
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# LTO
set_target_properties(${TARGET_NAME} ${TARGET_NAME}_obj
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# LTO
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
NAMESPACE InferenceEngine::Extensions::Cpu::XARCH
)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# add test object library
add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS})
set_ie_threading_interface_for(${TARGET_NAME})
-set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
\ No newline at end of file
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
+set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# Static library used for unit tests which are always built
add_library(${TARGET_NAME}_s STATIC
pugixml
openvino::itt)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
# code style
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_reader_api inference_engine_plugin_api
inference_engine pugixml openvino::itt)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
# code style
target_link_libraries(${TARGET_NAME} PRIVATE inference_engine_reader_api onnx_importer inference_engine)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
# code style
add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# LTO
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION ${ENABLE_LTO})
)
endif()
+if(COMMAND ie_add_api_validator_post_build_step)
+ ie_add_api_validator_post_build_step(TARGET ngraph)
+endif()
+
set_target_properties(ngraph PROPERTIES
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden