-D UWP_API_VALIDATOR_APIS=${UWP_API_VALIDATOR_APIS}
-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"
BYPRODUCTS ${output_file}
COMMENT "[apiValidator] Check ${target_name} for OneCore compliance"
foreach(var UWP_API_VALIDATOR UWP_API_VALIDATOR_TARGET
UWP_API_VALIDATOR_APIS UWP_API_VALIDATOR_EXCLUSION
- UWP_API_VALIDATOR_OUTPUT)
+ UWP_API_VALIDATOR_OUTPUT CMAKE_TOOLCHAIN_FILE)
if(NOT DEFINED ${var})
message(FATAL_ERROR "Variable ${var} is not defined")
endif()
get_filename_component(name "${UWP_API_VALIDATOR_TARGET}" NAME)
if(NOT UWP_HAS_BINARY_EXCLUSION)
- set(exclusion_dlls "msvcp140.dll" "vcruntime140.dll")
+ if(CMAKE_TOOLCHAIN_FILE MATCHES "onecoreuap.toolchain.cmake$")
+ # empty since we compile with static MSVC runtime
+ else()
+ set(exclusion_dlls "msvcp140.dll" "vcruntime140.dll")
+ endif()
# remove exclusions from error_message
--- /dev/null
+# Copyright (C) 2018-2020 Intel Corporation
+# SPDX-License-Identifier: Apache-2.0
+#
+
+#
+# Define CMAKE_SYSTEM_VERSION if not defined
+#
+
+if(NOT DEFINED CMAKE_SYSTEM_VERSION)
+ # Sometimes CMAKE_HOST_SYSTEM_VERSION has form 10.x.y while we need
+ # form 10.x.y.z Adding .0 at the end fixes the issue
+ if(CMAKE_HOST_SYSTEM_VERSION MATCHES "^10\.0\.[0-9]+$")
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}.0")
+ else()
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ endif()
+endif()
+
+if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
+endif()
+
+message(STATUS "Building for Windows OneCore compliance (using OneCoreUap.lib, ${CMAKE_SYSTEM_VERSION})")
+
+#
+# OneCore flags
+#
+
+set(_onecoreuap_arch "x64")
+if(CMAKE_GENERATOR_PLATFORM)
+ set(_onecoreuap_arch ${CMAKE_GENERATOR_PLATFORM})
+endif()
+
+if(_onecoreuap_arch STREQUAL "x64")
+ # Forcefull make VS search for C++ libreries in these folders prior to other c++ standard libraries localizations.
+ add_link_options("/LIBPATH:\"\$\(VC_LibraryPath_VC_x64_OneCore\)\"")
+
+ set(CMAKE_C_STANDARD_LIBRARIES "\$\(UCRTContentRoot\)lib/\$\(TargetUniversalCRTVersion\)/um/\$\(Platform\)/OneCoreUap.lib" CACHE STRING "" FORCE)
+ set(CMAKE_CXX_STANDARD_LIBRARIES "\$\(UCRTContentRoot\)lib/\$\(TargetUniversalCRTVersion\)/um/\$\(Platform\)/OneCoreUap.lib" CACHE STRING "" FORCE)
+elseif(_onecoreuap_arch STREQUAL "X86")
+ add_link_options("/LIBPATH:\"\$\(VCInstallDir\)lib/onecore\"")
+ add_link_options("/LIBPATH:\"\$\(VC_LibraryPath_VC_x86_OneCore\)\"")
+
+ set(CMAKE_C_STANDARD_LIBRARIES "\$\(UCRTContentRoot\)lib/\$\(TargetUniversalCRTVersion\)/um/x86/OneCoreUap.lib" CACHE STRING "" FORCE)
+ set(CMAKE_CXX_STANDARD_LIBRARIES "\$\(UCRTContentRoot\)lib/\$\(TargetUniversalCRTVersion\)/um/x86/OneCoreUap.lib" CACHE STRING "" FORCE)
+else()
+ message(FATAL_ERROR "Unsupported architecture ${_onecoreuap_arch}. Only X86 or X86_64 are supported")
+endif()
+
+unset(_onecoreuap_arch)
+
+# compile flags
+
+set(includes "/I\"\$\(UniversalCRT_IncludePath\)\"")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${includes}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${includes}")
+unset(includes)
+
+# linker flags
+
+foreach(lib kernel32 user32 advapi32 ole32 mscoree combase)
+ set(linker_flags "/NODEFAULTLIB:${lib}.lib ${linker_flags}")
+endforeach()
+
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${linker_flags}")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${linker_flags}")
+unset(linker_flags)
+
+#
+# Flags for 3rd party projects
+#
+
+set(use_static_runtime ON)
+
+if(use_static_runtime)
+ foreach(lang C CXX)
+ foreach(build_type "" "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
+ set(flag_var "CMAKE_${lang}_FLAGS${build_type}")
+ string(REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+ endforeach()
+ endforeach()
+endif()
+
+function(onecoreuap_set_runtime var)
+ set(${var} ${use_static_runtime} CACHE BOOL "" FORCE)
+endfunction()
+
+# ONNX
+onecoreuap_set_runtime(ONNX_USE_MSVC_STATIC_RUNTIME)
+# pugixml
+onecoreuap_set_runtime(STATIC_CRT)
+# protobuf
+onecoreuap_set_runtime(protobuf_MSVC_STATIC_RUNTIME)
+# clDNN
+onecoreuap_set_runtime(CLDNN__COMPILE_LINK_USE_STATIC_RUNTIME)
+
+unset(use_static_runtime)
endif()
if(ENABLE_COVERAGE)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
+ ie_add_compiler_flags(--coverage)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
-if(NOT MSVC)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char")
+if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ ie_add_compiler_flags(-fsigned-char)
endif()
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
set(CMAKE_SYSTEM_NAME WindowsStore)
+#
+# Define CMAKE_SYSTEM_VERSION if not defined
+#
+
if(NOT DEFINED CMAKE_SYSTEM_VERSION)
# Sometimes CMAKE_HOST_SYSTEM_VERSION has form 10.x.y while we need
# form 10.x.y.z Adding .0 at the end fixes the issue
- if(CMAKE_HOST_SYSTEM_VERSION MATCHES "^10\.0.[0-9]+$")
+ if(CMAKE_HOST_SYSTEM_VERSION MATCHES "^10\.0\.[0-9]+$")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}.0")
else()
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
+#
+# Compilation flags
+#
+
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/src/uwp.hpp"
"#ifdef WINAPI_FAMILY\n"
"#undef WINAPI_FAMILY\n"
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
+# Failed because of OpenCL
+# ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# install
install(FILES "${clDNN_SOURCE_DIR}/kernel_selector/core/cache/cache.json"
"${IE_MAIN_SOURCE_DIR}/src/readers/ir_reader" # for ie_ir_version.hpp
$<TARGET_PROPERTY:${TARGET_NAME}_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_transformations,INTERFACE_INCLUDE_DIRECTORIES>
- $<TARGET_PROPERTY:${TARGET_NAME}_reader_api,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:${TARGET_NAME}_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
+target_link_libraries(${TARGET_NAME}_obj PRIVATE ${TARGET_NAME}_reader_api)
+
if(ENABLE_MKL_DNN)
target_include_directories(${TARGET_NAME}_obj SYSTEM PRIVATE "${IE_MAIN_SOURCE_DIR}/thirdparty/mkl-dnn/src/cpu/xbyak")
endif()
"${CMAKE_CURRENT_SOURCE_DIR}/reader_api"
$<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>)
-file(GLOB_RECURSE reader_api_src "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.hpp"
- "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.h")
+file(GLOB_RECURSE reader_api_hpp "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.hpp")
+file(GLOB_RECURSE reader_api_src "${CMAKE_CURRENT_SOURCE_DIR}/reader_api/*.cpp")
-add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${reader_api_src})
+set_target_properties(${TARGET_NAME} PROPERTIES INTERFACE_SOURCES ${reader_api_src})
+
+add_cpplint_target(${TARGET_NAME}_cpplint FOR_SOURCES ${reader_api_hpp} ${reader_api_src})
add_subdirectory(ir_reader)
add_subdirectory(ir_reader_v7)
namespace InferenceEngine {
namespace details {
-class INFERENCE_ENGINE_API_CLASS(BlobStream): public std::istream {
+class BlobStream: public std::istream {
private:
class BlobBuffer: public std::streambuf {
public:
PRIVATE
mvnc inference_engine inference_engine_legacy vpu_graph_transformer)
+ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
+
# LTO
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})
if (MSVC)
# When we build dll libraries. These flags make sure onnx and protobuf build with /MD, not /MT.
# These two options can't be mixed, because they requires link two imcompatiable runtime.
- set(ONNX_USE_MSVC_STATIC_RUNTIME OFF)
set(protobuf_WITH_ZLIB OFF CACHE BOOL "" FORCE)
- set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link protobuf to static runtime libraries" FORCE)
+
+ if(NOT DEFINED ONNX_USE_MSVC_STATIC_RUNTIME)
+ set(ONNX_USE_MSVC_STATIC_RUNTIME OFF)
+ endif()
+ if(NOT DEFINED protobuf_MSVC_STATIC_RUNTIME)
+ set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link protobuf to static runtime libraries" FORCE)
+ endif()
endif()
if (NOT NGRAPH_USE_SYSTEM_PROTOBUF)
include(cmake/external_protobuf.cmake)
# Use the interface of FindProtobuf.cmake
# -----------------------------------------------------------------------------
if (NOT TARGET protobuf::libprotobuf)
- add_library(protobuf::libprotobuf UNKNOWN IMPORTED)
- set_target_properties(protobuf::libprotobuf PROPERTIES
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
- IMPORTED_LOCATION "${Protobuf_LIBRARY}")
- add_dependencies(protobuf::libprotobuf ext_protobuf)
+ add_library(protobuf::libprotobuf UNKNOWN IMPORTED)
+ set_target_properties(protobuf::libprotobuf PROPERTIES
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}"
+ IMPORTED_LOCATION "${Protobuf_LIBRARY}")
+ add_dependencies(protobuf::libprotobuf ext_protobuf)
endif()
set(Protobuf_LIBRARIES protobuf::libprotobuf)
if (NOT TARGET protobuf::protoc)
- add_executable(protobuf::protoc IMPORTED)
- set_target_properties(protobuf::protoc PROPERTIES
- INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_PROTOC_EXECUTABLE}"
- IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
- add_dependencies(protobuf::protoc ext_protobuf)
+ add_executable(protobuf::protoc IMPORTED)
+ set_target_properties(protobuf::protoc PROPERTIES
+ INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_PROTOC_EXECUTABLE}"
+ IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}")
+ add_dependencies(protobuf::protoc ext_protobuf)
endif()
set(Protobuf_FOUND TRUE)