2023-01-16 11:02:17 +04:00
|
|
|
# Copyright (C) 2018-2023 Intel Corporation
|
2020-02-11 22:48:49 +03:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
#
|
|
|
|
|
|
2021-11-20 02:27:43 +03:00
|
|
|
if(DEFINED BUILD_SHARED_LIBS AND NOT BUILD_SHARED_LIBS)
|
2023-05-27 10:47:41 +04:00
|
|
|
# 3.17: 'target_link_libraries' does not work correctly when called from
|
2022-03-31 18:05:59 +03:00
|
|
|
# different directory where 'add_library' is called: CMake generates
|
2021-11-20 02:27:43 +03:00
|
|
|
# incorrect OpenVINOConfig.cmake in this case
|
2023-05-27 10:47:41 +04:00
|
|
|
# 3.18: add_library cannot create ALIAS for non-GLOBAL targets
|
|
|
|
|
cmake_minimum_required(VERSION 3.18)
|
2021-11-20 02:27:43 +03:00
|
|
|
else()
|
2022-08-08 13:59:24 +04:00
|
|
|
if(CPACK_GENERATOR STREQUAL "DEB")
|
|
|
|
|
# we have to use CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS variable
|
|
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
|
else()
|
2022-08-23 01:39:23 +04:00
|
|
|
# default choice
|
2022-08-08 13:59:24 +04:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
|
|
endif()
|
2021-11-20 02:27:43 +03:00
|
|
|
endif()
|
2020-02-11 22:48:49 +03:00
|
|
|
|
2023-03-30 21:01:41 +04:00
|
|
|
if(POLICY CMP0091)
|
|
|
|
|
cmake_policy(SET CMP0091 NEW) # Enables use of MSVC_RUNTIME_LIBRARY
|
|
|
|
|
endif()
|
|
|
|
|
|
2021-07-02 11:36:31 +03:00
|
|
|
project(OpenVINO DESCRIPTION "OpenVINO toolkit")
|
2020-02-11 22:48:49 +03:00
|
|
|
|
2020-12-22 18:44:59 +03:00
|
|
|
find_package(IEDevScripts REQUIRED
|
2021-07-02 11:36:31 +03:00
|
|
|
PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package"
|
2020-12-22 18:44:59 +03:00
|
|
|
NO_CMAKE_FIND_ROOT_PATH
|
|
|
|
|
NO_DEFAULT_PATH)
|
2020-02-11 22:48:49 +03:00
|
|
|
|
2020-12-22 18:44:59 +03:00
|
|
|
include(CTest)
|
|
|
|
|
include(cmake/features.cmake)
|
2020-02-11 22:48:49 +03:00
|
|
|
|
2020-10-05 23:37:50 +03:00
|
|
|
# These options are shared with 3rdparty plugins by means of developer package
|
2020-12-22 18:44:59 +03:00
|
|
|
include(cmake/dependencies.cmake)
|
2020-02-11 22:48:49 +03:00
|
|
|
|
2021-06-24 13:14:04 +03:00
|
|
|
if(ENABLE_COVERAGE)
|
|
|
|
|
include(cmake/coverage.cmake)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-02-11 22:48:49 +03:00
|
|
|
# resolving dependencies for the project
|
2021-11-28 21:36:24 +03:00
|
|
|
message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION})
|
2021-09-02 10:03:04 +03:00
|
|
|
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
|
2022-02-25 15:47:21 +03:00
|
|
|
message (STATUS "OpenVINO_BINARY_DIR ................... " ${OpenVINO_BINARY_DIR})
|
2020-02-11 22:48:49 +03:00
|
|
|
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
|
|
|
|
|
message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
|
2021-11-27 14:58:24 +03:00
|
|
|
message (STATUS "CMAKE_CXX_COMPILER_ID ................. " ${CMAKE_CXX_COMPILER_ID})
|
2023-03-05 10:46:53 +04:00
|
|
|
if(OV_GENERATOR_MULTI_CONFIG)
|
|
|
|
|
string(REPLACE ";" " " config_types "${CMAKE_CONFIGURATION_TYPES}")
|
|
|
|
|
message (STATUS "CMAKE_CONFIGURATION_TYPES ............. " ${config_types})
|
|
|
|
|
unset(config_types)
|
|
|
|
|
if(CMAKE_GENERATOR MATCHES "^Ninja Multi-Config$")
|
|
|
|
|
message (STATUS "CMAKE_DEFAULT_BUILD_TYPE .............. " ${CMAKE_DEFAULT_BUILD_TYPE})
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
message (STATUS "CMAKE_BUILD_TYPE ...................... " ${CMAKE_BUILD_TYPE})
|
|
|
|
|
endif()
|
|
|
|
|
if(CMAKE_GENERATOR_PLATFORM)
|
|
|
|
|
message (STATUS "CMAKE_GENERATOR_PLATFORM .............. " ${CMAKE_GENERATOR_PLATFORM})
|
|
|
|
|
endif()
|
|
|
|
|
if(CMAKE_GENERATOR_TOOLSET)
|
|
|
|
|
message (STATUS "CMAKE_GENERATOR_TOOLSET ............... " ${CMAKE_GENERATOR_TOOLSET})
|
|
|
|
|
endif()
|
|
|
|
|
if(CMAKE_TOOLCHAIN_FILE)
|
|
|
|
|
message (STATUS "CMAKE_TOOLCHAIN_FILE .................. " ${CMAKE_TOOLCHAIN_FILE})
|
|
|
|
|
endif()
|
2023-05-17 00:47:55 +04:00
|
|
|
if(NOT OV_GLIBC_VERSION VERSION_EQUAL 0.0)
|
2023-03-05 10:46:53 +04:00
|
|
|
message (STATUS "GLIBC_VERSION ......................... " ${OV_GLIBC_VERSION})
|
|
|
|
|
endif()
|
2020-02-11 22:48:49 +03:00
|
|
|
|
|
|
|
|
# remove file with exported developer targets to force its regeneration
|
2022-02-25 15:47:21 +03:00
|
|
|
file(REMOVE "${CMAKE_BINARY_DIR}/ngraphTargets.cmake")
|
2021-05-07 11:57:51 +03:00
|
|
|
file(REMOVE "${CMAKE_BINARY_DIR}/InferenceEngineTargets.cmake")
|
2021-09-10 15:31:27 +03:00
|
|
|
file(REMOVE "${CMAKE_BINARY_DIR}/OpenVINOTargets.cmake")
|
2020-12-22 18:44:59 +03:00
|
|
|
foreach(component IN LISTS openvino_export_components)
|
|
|
|
|
file(REMOVE "${CMAKE_BINARY_DIR}/${component}_dev_targets.cmake")
|
2022-04-05 04:47:22 +03:00
|
|
|
file(REMOVE "${CMAKE_BINARY_DIR}/ov_${component}_dev_targets.cmake")
|
2020-12-22 18:44:59 +03:00
|
|
|
unset(${component} CACHE)
|
|
|
|
|
endforeach()
|
2021-12-09 15:38:44 +03:00
|
|
|
unset(openvino_export_components CACHE)
|
2020-02-11 22:48:49 +03:00
|
|
|
|
2020-10-05 23:37:50 +03:00
|
|
|
#
|
|
|
|
|
# Build
|
|
|
|
|
#
|
|
|
|
|
|
2020-08-17 19:43:11 +03:00
|
|
|
function(openvino_developer_export_targets)
|
2020-12-22 18:44:59 +03:00
|
|
|
cmake_parse_arguments(EXPORT "" "COMPONENT" "TARGETS" ${ARGN})
|
|
|
|
|
|
|
|
|
|
if(EXPORT_UNPARSED_ARGUMENTS)
|
|
|
|
|
message(FATAL_ERROR "openvino_developer_export_targets has unparsed arguments: ${EXPORT_UNPARSED_ARGUMENTS}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}};${EXPORT_TARGETS}")
|
2020-08-17 19:43:11 +03:00
|
|
|
|
|
|
|
|
# to allow exporting of aliased targets with the original names
|
2020-12-22 18:44:59 +03:00
|
|
|
foreach(target_name IN LISTS ${EXPORT_COMPONENT})
|
2020-08-17 19:43:11 +03:00
|
|
|
if(TARGET "${target_name}")
|
|
|
|
|
get_target_property(original_name ${target_name} ALIASED_TARGET)
|
|
|
|
|
if(TARGET "${original_name}")
|
|
|
|
|
message(STATUS "The name ${target_name} is an ALIAS for ${original_name}. "
|
2022-10-15 01:15:03 +04:00
|
|
|
"It will be exported to the OpenVINODeveloperPackage with the original name.")
|
2020-12-22 18:44:59 +03:00
|
|
|
list(REMOVE_ITEM ${EXPORT_COMPONENT} ${target_name})
|
|
|
|
|
list(APPEND ${EXPORT_COMPONENT} ${original_name})
|
2020-08-17 19:43:11 +03:00
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
2020-12-22 18:44:59 +03:00
|
|
|
list(REMOVE_DUPLICATES ${EXPORT_COMPONENT})
|
|
|
|
|
set(${EXPORT_COMPONENT} "${${EXPORT_COMPONENT}}" CACHE INTERNAL
|
|
|
|
|
"A list of OpenVINO ${EXPORT_COMPONENT} exported targets" FORCE)
|
|
|
|
|
|
|
|
|
|
list(APPEND openvino_export_components ${EXPORT_COMPONENT})
|
|
|
|
|
list(REMOVE_DUPLICATES openvino_export_components)
|
|
|
|
|
set(openvino_export_components "${openvino_export_components}" CACHE INTERNAL
|
|
|
|
|
"A list of OpenVINO exported components" FORCE)
|
2020-08-17 19:43:11 +03:00
|
|
|
endfunction()
|
|
|
|
|
|
2021-07-31 17:21:35 +03:00
|
|
|
# add target with processed tests model zoo
|
2022-08-31 15:39:21 +02:00
|
|
|
if (ENABLE_TESTS)
|
|
|
|
|
include(cmake/test_model_zoo.cmake)
|
|
|
|
|
endif()
|
2021-07-31 17:21:35 +03:00
|
|
|
|
2023-05-27 10:47:41 +04:00
|
|
|
include(thirdparty/dependencies.cmake)
|
2021-11-27 11:28:25 +03:00
|
|
|
add_subdirectory(src)
|
2022-12-29 01:24:32 +04:00
|
|
|
|
|
|
|
|
if(ENABLE_SAMPLES OR ENABLE_TESTS OR ENABLE_COMPILE_TOOL)
|
|
|
|
|
add_subdirectory(samples)
|
|
|
|
|
endif()
|
2021-12-13 00:04:56 +03:00
|
|
|
|
2022-10-03 15:47:20 +04:00
|
|
|
# Enable interpreter backend for tests
|
2021-12-13 00:04:56 +03:00
|
|
|
if (ENABLE_TESTS OR ENABLE_TEMPLATE)
|
2022-10-03 15:47:20 +04:00
|
|
|
add_subdirectory(src/plugins/template/backend)
|
2021-12-13 00:04:56 +03:00
|
|
|
endif()
|
2021-06-30 18:15:41 +03:00
|
|
|
include(cmake/extra_modules.cmake)
|
2020-05-22 22:34:00 +03:00
|
|
|
add_subdirectory(docs)
|
2021-04-26 18:06:39 +03:00
|
|
|
add_subdirectory(tools)
|
2021-06-30 18:15:41 +03:00
|
|
|
add_subdirectory(scripts)
|
2021-12-01 11:42:52 +03:00
|
|
|
add_subdirectory(licensing)
|
2020-05-22 22:34:00 +03:00
|
|
|
|
2020-10-05 23:37:50 +03:00
|
|
|
#
|
2021-06-30 18:15:41 +03:00
|
|
|
# CPack
|
2020-10-05 23:37:50 +03:00
|
|
|
#
|
2020-04-28 22:20:54 +03:00
|
|
|
|
2022-07-19 10:07:26 +04:00
|
|
|
# provides a callback function to describe each component in repo
|
2022-07-27 14:04:22 +04:00
|
|
|
include(cmake/packaging/packaging.cmake)
|
2022-07-19 10:07:26 +04:00
|
|
|
|
2020-02-11 22:48:49 +03:00
|
|
|
ie_cpack(${IE_CPACK_COMPONENTS_ALL})
|