+1








a883dc0b85
* Extensibility guide with FE extensions and remove OV_FRAMEWORK_MAP from docs * Rework of Extensibility Intro, adopted examples to missing OPENVINO_FRAMEWORK_MAP * Removed OPENVINO_FRAMEWORK_MAP reference * Frontend extension detailed documentation * Fixed distributed snippets * Fixed snippet inclusion in FE extension document and chapter headers * Fixed wrong name in a snippet reference * Fixed test for template extension due to changed number of loaded extensions * Update docs/Extensibility_UG/frontend_extensions.md Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> * Minor fixes in extension snippets * Small grammar fix Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> * DOCS: transition banner (#10973) * transition banner * minor fix * update transition banner * updates * update custom.js * updates * updates * Documentation fixes (#11044) * Benchmark app usage * Fixed link to the devices * More fixes * Update docs/OV_Runtime_UG/multi_device.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Removed several hardcoded links Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Updated documentation for compile_tool (#11049) * Added deployment guide (#11060) * Added deployment guide * Added local distribution * Updates * Fixed more indentations * Removed obsolete code snippets (#11061) * Removed obsolete code snippets * NCC style * Fixed NCC for BA * Add a troubleshooting issue for PRC installation (#11074) * updates * adding gna to linux * add missing reference * update * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * Update docs/install_guides/installing-model-dev-tools.md Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * update * minor updates * add gna item to yum and apt * add gna to get started page * update reference formatting * merge commit * add a troubleshooting issue * update * update * fix CVS-71846 Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> * DOCS: fixed hardcoded links (#11100) * Fixes * Use links * applying reviewers comments to the Opt Guide (#11093) * applying reviewrs comments * fixed refs, more structuring (bold, bullets, etc) * refactoring tput/latency sections * next iteration (mostly latency), also brushed the auto-batching and other sections * updates sync/async images * common opts brushed * WIP tput redesigned * minor brushing of common and auto-batching * Tput fully refactored * fixed doc name in the link * moved int8 perf counters to the right section * fixed links * fixed broken quotes * fixed more links * add ref to the internals to the TOC * Added a note on the batch size Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com> * [80085] New images for docs (#11114) * change doc structure * fix manager tools * fix manager tools 3 step * fix manager tools 3 step * new img * new img for OV Runtime * fix steps * steps * fix intendents * change list * fix space * fix space * code snippets fix * change display * Benchmarks 2022 1 (#11130) * Minor fixes * Updates for 2022.1 * Edits according to the review * Edits according to review comments * Edits according to review comments * Edits according to review comments * Fixed table * Edits according to review comments * Removed config for Intel® Core™ i7-11850HE * Removed forward-tacotron-duration-prediction-241 graph * Added resnet-18-pytorch * Add info about Docker images in Deployment guide (#11136) * Renamed user guides (#11137) * fix screenshot (#11140) * More conservative recommendations on dynamic shapes usage in docs (#11161) * More conservative recommendations about using dynamic shapes * Duplicated statement from C++ part to Python part of reshape doc (no semantical changes) * Update ShapeInference.md (#11168) * Benchmarks 2022 1 updates (#11180) * Updated graphs * Quick fix for TODO in Dynamic Shapes article * Anchor link fixes * Fixed DM config (#11199) * DOCS: doxy sphinxtabs (#11027) * initial implementation of doxy sphinxtabs * fixes * fixes * fixes * fixes * fixes * WA for ignored visibility attribute * Fixes Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com> Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com> Co-authored-by: Nikolay Tyukaev <nikolay.tyukaev@intel.com> Co-authored-by: Sergey Lyubimtsev <sergey.lyubimtsev@intel.com> Co-authored-by: Yuan Xu <yuan1.xu@intel.com> Co-authored-by: Maxim Shevtsov <maxim.y.shevtsov@intel.com> Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com> Co-authored-by: Tatiana Savina <tatiana.savina@intel.com> Co-authored-by: Ilya Naumov <ilya.naumov@intel.com> Co-authored-by: Evgenya Stepyreva <evgenya.stepyreva@intel.com>
247 lines
8.3 KiB
CMake
247 lines
8.3 KiB
CMake
# Copyright (C) 2018-2022 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
cmake_minimum_required (VERSION 3.10)
|
|
|
|
# Enable CMAKE_<LANG>_COMPILER_ID AppleClang
|
|
cmake_policy(SET CMP0025 NEW)
|
|
|
|
project(Samples)
|
|
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type")
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" "Debug" "RelWithDebInfo" "MinSizeRel")
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
if (NOT BIN_FOLDER)
|
|
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} ARCH)
|
|
if(ARCH STREQUAL "x86_64" OR ARCH STREQUAL "amd64") # Windows detects Intel's 64-bit CPU as AMD64
|
|
set(ARCH intel64)
|
|
elseif(ARCH STREQUAL "i386")
|
|
set(ARCH ia32)
|
|
endif()
|
|
|
|
set (BIN_FOLDER ${ARCH})
|
|
|
|
if(UNIX)
|
|
set(BIN_FOLDER "${BIN_FOLDER}/${CMAKE_BUILD_TYPE}")
|
|
endif()
|
|
endif()
|
|
|
|
if(OpenVINO_SOURCE_DIR)
|
|
# in case if samples are built from IE repo
|
|
set(IE_MAIN_SAMPLES_DIR "${OpenVINO_SOURCE_DIR}")
|
|
set(OpenVINO_DIR "${CMAKE_BINARY_DIR}")
|
|
else()
|
|
# in case if samples are built out of IE repo
|
|
set(IE_MAIN_SAMPLES_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
endif()
|
|
|
|
if(NOT(UNIX))
|
|
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
|
|
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
|
|
else ()
|
|
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER}/lib)
|
|
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER}/lib)
|
|
endif()
|
|
set (CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
|
|
set (CMAKE_PDB_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
|
|
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${IE_MAIN_SAMPLES_DIR}/${BIN_FOLDER})
|
|
|
|
if (WIN32)
|
|
set_property (DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") # no asynchronous structured exception handling
|
|
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
|
|
|
|
if (TREAT_WARNING_AS_ERROR)
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") # treating warnings as errors
|
|
endif ()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qdiag-disable:177")
|
|
endif()
|
|
|
|
# disable some noisy warnings
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275 /wd4267 /wd4819")
|
|
endif()
|
|
else()
|
|
# treating warnings as errors
|
|
if(TREAT_WARNING_AS_ERROR)
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
|
endif()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable:177")
|
|
endif()
|
|
endif()
|
|
|
|
if(APPLE)
|
|
set(CMAKE_MACOSX_RPATH ON)
|
|
endif()
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*)")
|
|
set(AARCH64 ON)
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
|
|
set(ARM ON)
|
|
endif()
|
|
if(ARM AND NOT CMAKE_CROSSCOMPILING)
|
|
add_compile_options(-march=armv7-a)
|
|
endif()
|
|
|
|
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
|
|
####################################
|
|
## to use C++11; can overwritten via cmake command line
|
|
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
|
set (CMAKE_CXX_STANDARD 11)
|
|
set (CMAKE_CXX_EXTENSIONS OFF)
|
|
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
endif()
|
|
####################################
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags" AND
|
|
NOT DEFINED OpenVINO_SOURCE_DIR)
|
|
add_subdirectory(thirdparty/gflags EXCLUDE_FROM_ALL)
|
|
endif()
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib")
|
|
add_subdirectory(thirdparty/zlib EXCLUDE_FROM_ALL)
|
|
endif()
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/cnpy")
|
|
add_subdirectory(thirdparty/cnpy EXCLUDE_FROM_ALL)
|
|
endif()
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/json")
|
|
add_subdirectory(thirdparty/json EXCLUDE_FROM_ALL)
|
|
endif()
|
|
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/utils")
|
|
add_subdirectory(common/utils)
|
|
endif()
|
|
|
|
# format reader must be added after find_package(OpenVINO) to get
|
|
# exactly the same OpenCV_DIR path which was used for the OpenVINO build
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/format_reader")
|
|
add_subdirectory(common/format_reader)
|
|
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/common/opencv_c_wrapper")
|
|
add_subdirectory(common/opencv_c_wrapper)
|
|
endif()
|
|
|
|
# samples build can be switched off during whole IE build
|
|
if (DEFINED OpenVINO_SOURCE_DIR AND NOT ENABLE_SAMPLES)
|
|
return()
|
|
endif()
|
|
|
|
function(add_samples_to_build)
|
|
# check each passed sample subdirectory
|
|
foreach (dir ${ARGN})
|
|
if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
|
|
# check if a subdirectory contains CMakeLists.txt. In this case we can build it.
|
|
file(GLOB is_sample_dir "${CMAKE_CURRENT_SOURCE_DIR}/${dir}/CMakeLists.txt")
|
|
if(is_sample_dir)
|
|
# check if specified sample/demo is found.
|
|
if (BUILD_SAMPLE_NAME)
|
|
list(FIND BUILD_SAMPLE_NAME ${dir} index)
|
|
endif()
|
|
if (index EQUAL -1)
|
|
message(STATUS "${dir} SKIPPED")
|
|
else()
|
|
# Include subdirectory to the project.
|
|
add_subdirectory(${dir})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
endforeach()
|
|
endfunction(add_samples_to_build)
|
|
|
|
include(CMakeParseArguments)
|
|
|
|
#
|
|
# ie_add_sample(NAME <target name>
|
|
# SOURCES <source files>
|
|
# [HEADERS <header files>]
|
|
# [INCLUDE_DIRECTORIES <include dir>]
|
|
# [DEPENDENCIES <dependencies>]
|
|
# [EXCLUDE_CLANG_FORMAT]
|
|
#
|
|
macro(ie_add_sample)
|
|
set(options EXCLUDE_CLANG_FORMAT)
|
|
set(oneValueArgs NAME)
|
|
set(multiValueArgs SOURCES HEADERS DEPENDENCIES INCLUDE_DIRECTORIES)
|
|
cmake_parse_arguments(IE_SAMPLE "${options}" "${oneValueArgs}"
|
|
"${multiValueArgs}" ${ARGN} )
|
|
|
|
# Create named folders for the sources within the .vcproj
|
|
# Empty name lists them directly under the .vcproj
|
|
source_group("src" FILES ${IE_SAMPLE_SOURCES})
|
|
if(IE_SAMPLE_HEADERS)
|
|
source_group("include" FILES ${IE_SAMPLE_HEADERS})
|
|
endif()
|
|
|
|
# Create executable file from sources
|
|
add_executable(${IE_SAMPLE_NAME} ${IE_SAMPLE_SOURCES} ${IE_SAMPLE_HEADERS})
|
|
|
|
set(folder_name cpp_samples)
|
|
if(IE_SAMPLE_NAME MATCHES ".*_c$")
|
|
set(c_sample ON)
|
|
set(folder_name c_samples)
|
|
endif()
|
|
|
|
find_package(OpenVINO REQUIRED COMPONENTS Runtime)
|
|
if(c_sample)
|
|
set(ov_link_libraries openvino::runtime::c)
|
|
else()
|
|
set(ov_link_libraries openvino::runtime)
|
|
endif()
|
|
|
|
set_target_properties(${IE_SAMPLE_NAME} PROPERTIES FOLDER ${folder_name}
|
|
COMPILE_PDB_NAME ${IE_SAMPLE_NAME})
|
|
|
|
if(IE_SAMPLE_INCLUDE_DIRECTORIES)
|
|
target_include_directories(${IE_SAMPLE_NAME} PRIVATE ${IE_SAMPLE_INCLUDE_DIRECTORIES})
|
|
endif()
|
|
target_include_directories(${IE_SAMPLE_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../common")
|
|
|
|
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE ${ov_link_libraries} ${IE_SAMPLE_DEPENDENCIES})
|
|
if(NOT c_sample)
|
|
target_link_libraries(${IE_SAMPLE_NAME} PRIVATE gflags)
|
|
endif()
|
|
|
|
install(
|
|
TARGETS ${IE_SAMPLE_NAME}
|
|
RUNTIME DESTINATION samples_bin/
|
|
COMPONENT samples_bin
|
|
EXCLUDE_FROM_ALL
|
|
)
|
|
|
|
# create global target with all samples / demo apps
|
|
if(NOT TARGET ie_samples)
|
|
add_custom_target(ie_samples ALL)
|
|
endif()
|
|
add_dependencies(ie_samples ${IE_SAMPLE_NAME})
|
|
|
|
if(COMMAND add_clang_format_target AND NOT IE_SAMPLE_EXCLUDE_CLANG_FORMAT)
|
|
add_clang_format_target(${IE_SAMPLE_NAME}_clang FOR_SOURCES ${IE_SAMPLE_SOURCES} ${IE_SAMPLE_HEADERS})
|
|
endif()
|
|
if(COMMAND ov_ncc_naming_style AND NOT c_sample)
|
|
ov_ncc_naming_style(FOR_TARGET "${IE_SAMPLE_NAME}"
|
|
SOURCE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
endif()
|
|
endmacro()
|
|
|
|
# collect all samples subdirectories
|
|
file(GLOB samples_dirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
|
|
# skip building of unnecessary subdirectories
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty")
|
|
list(REMOVE_ITEM samples_dirs common thirdparty)
|
|
endif()
|
|
add_samples_to_build(${samples_dirs})
|