Skip to content

Commit

Permalink
M [>0;136;0c:wq
Browse files Browse the repository at this point in the history
 [>0;136;0c:wq
thon-snippets
  • Loading branch information
ilya-lavrenov committed Aug 9, 2023
2 parents dbf4b7e + dafe437 commit 8cc2d28
Show file tree
Hide file tree
Showing 37 changed files with 618 additions and 402 deletions.
2 changes: 1 addition & 1 deletion .ci/azure/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
Static:
CMAKE_BUILD_SHARED_LIBS: 'OFF'
PYTHON_STATIC_ARGS: -m "not dynamic_library"
CMAKE_CPACK_GENERATOR:
CMAKE_CPACK_GENERATOR: "TGZ"
SAMPLES_INSTALL_DIR: $(INSTALL_DIR)/samples
PYTHON_SAMPLES_INSTALL_DIR: $(SAMPLES_INSTALL_DIR)/python
RUN_PREFIX: . $(SETUPVARS) &&
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION})
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
message (STATUS "OpenVINO_BINARY_DIR ................... " ${OpenVINO_BINARY_DIR})
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
message (STATUS "CPACK_GENERATOR ....................... " ${CPACK_GENERATOR})
message (STATUS "CMAKE_C_COMPILER_ID ................... " ${CMAKE_C_COMPILER_ID})
message (STATUS "CMAKE_CXX_COMPILER_ID ................. " ${CMAKE_CXX_COMPILER_ID})
if(OV_GENERATOR_MULTI_CONFIG)
Expand Down
90 changes: 90 additions & 0 deletions cmake/developer_package/packaging/archive.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

include(GNUInstallDirs)

#
# ov_archive_cpack_set_dirs()
#
# Set directories for ARCHIVE cpack
#
macro(ov_archive_cpack_set_dirs)
# common "archive" package locations
# TODO: move current variables to OpenVINO specific locations
set(OV_CPACK_INCLUDEDIR runtime/include)
set(OV_CPACK_IE_CMAKEDIR runtime/cmake)
set(OV_CPACK_NGRAPH_CMAKEDIR runtime/cmake)
set(OV_CPACK_OPENVINO_CMAKEDIR runtime/cmake)
set(OV_CPACK_DOCDIR docs)
set(OV_CPACK_LICENSESDIR licenses)
set(OV_CPACK_SAMPLESDIR samples)
set(OV_CPACK_WHEELSDIR tools)
set(OV_CPACK_TOOLSDIR tools)
set(OV_CPACK_DEVREQDIR tools)
set(OV_CPACK_PYTHONDIR python)

if(WIN32)
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_RUNTIMEDIR runtime/bin/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_WHEEL_RUNTIMEDIR runtime/bin/${ARCH_FOLDER}/Release)
elseif(APPLE)
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_RUNTIMEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_WHEEL_RUNTIMEDIR runtime/lib/${ARCH_FOLDER}/Release)
else()
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER})
set(OV_CPACK_RUNTIMEDIR runtime/lib/${ARCH_FOLDER})
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER})
set(OV_WHEEL_RUNTIMEDIR ${OV_CPACK_RUNTIMEDIR})
endif()
set(OV_CPACK_PLUGINSDIR ${OV_CPACK_RUNTIMEDIR})

# for BW compatibility
set(IE_CPACK_LIBRARY_PATH ${OV_CPACK_LIBRARYDIR})
set(IE_CPACK_RUNTIME_PATH ${OV_CPACK_RUNTIMEDIR})
set(IE_CPACK_ARCHIVE_PATH ${OV_CPACK_ARCHIVEDIR})
endmacro()

ov_archive_cpack_set_dirs()

#
# Override include / exclude rules for components
# This is required to exclude some files from installation
# (e.g. archive packages don't require python_package component)
#

macro(ov_define_component_include_rules)
# core components
unset(OV_CPACK_COMP_CORE_EXCLUDE_ALL)
unset(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL)
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
unset(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL)
# licensing
unset(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL)
# samples
unset(OV_CPACK_COMP_CPP_SAMPLES_EXCLUDE_ALL)
unset(OV_CPACK_COMP_C_SAMPLES_EXCLUDE_ALL)
unset(OV_CPACK_COMP_PYTHON_SAMPLES_EXCLUDE_ALL)
# python
unset(OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL)
unset(OV_CPACK_COMP_BENCHMARK_APP_EXCLUDE_ALL)
unset(OV_CPACK_COMP_OVC_EXCLUDE_ALL)
set(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL EXCLUDE_FROM_ALL)
unset(OV_CPACK_COMP_PYTHON_WHEELS_EXCLUDE_ALL)
# tools
set(OV_CPACK_COMP_OPENVINO_DEV_REQ_FILES_EXCLUDE_ALL EXCLUDE_FROM_ALL)
unset(OV_CPACK_COMP_DEPLOYMENT_MANAGER_EXCLUDE_ALL)
# scripts
unset(OV_CPACK_COMP_INSTALL_DEPENDENCIES_EXCLUDE_ALL)
unset(OV_CPACK_COMP_SETUPVARS_EXCLUDE_ALL)
endmacro()

ov_define_component_include_rules()

# New in version 3.18
set(CPACK_ARCHIVE_THREADS 8)
# multiple packages are generated
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
46 changes: 46 additions & 0 deletions cmake/developer_package/packaging/nsis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,52 @@ endmacro()

ov_nsis_specific_settings()

#
# ov_nsis_cpack_set_dirs()
#
# Set directories for ARCHIVE cpack
#
macro(ov_archive_cpack_set_dirs)
# common "archive" package locations
# TODO: move current variables to OpenVINO specific locations
set(OV_CPACK_INCLUDEDIR runtime/include)
set(OV_CPACK_IE_CMAKEDIR runtime/cmake)
set(OV_CPACK_NGRAPH_CMAKEDIR runtime/cmake)
set(OV_CPACK_OPENVINO_CMAKEDIR runtime/cmake)
set(OV_CPACK_DOCDIR docs)
set(OV_CPACK_LICENSESDIR licenses)
set(OV_CPACK_SAMPLESDIR samples)
set(OV_CPACK_WHEELSDIR tools)
set(OV_CPACK_TOOLSDIR tools)
set(OV_CPACK_DEVREQDIR tools)
set(OV_CPACK_PYTHONDIR python)

if(WIN32)
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_RUNTIMEDIR runtime/bin/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_WHEEL_RUNTIMEDIR runtime/bin/${ARCH_FOLDER}/Release)
elseif(APPLE)
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_RUNTIMEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_WHEEL_RUNTIMEDIR runtime/lib/${ARCH_FOLDER}/Release)
else()
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER})
set(OV_CPACK_RUNTIMEDIR runtime/lib/${ARCH_FOLDER})
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER})
set(OV_WHEEL_RUNTIMEDIR ${OV_CPACK_RUNTIMEDIR})
endif()
set(OV_CPACK_PLUGINSDIR ${OV_CPACK_RUNTIMEDIR})

# for BW compatibility
set(IE_CPACK_LIBRARY_PATH ${OV_CPACK_LIBRARYDIR})
set(IE_CPACK_RUNTIME_PATH ${OV_CPACK_RUNTIMEDIR})
set(IE_CPACK_ARCHIVE_PATH ${OV_CPACK_ARCHIVEDIR})
endmacro()

ov_nsis_cpack_set_dirs()

#
# Override include / exclude rules for components
# This is required to exclude some files from installation
Expand Down
96 changes: 9 additions & 87 deletions cmake/developer_package/packaging/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,52 +39,6 @@ function(ov_get_pyversion pyversion)
endif()
endfunction()

#
# ov_cpack_set_dirs()
#
# Set directories for cpack
#
macro(ov_cpack_set_dirs)
# common IRC package locations
# TODO: move current variables to OpenVINO specific locations
set(OV_CPACK_INCLUDEDIR runtime/include)
set(OV_CPACK_IE_CMAKEDIR runtime/cmake)
set(OV_CPACK_NGRAPH_CMAKEDIR runtime/cmake)
set(OV_CPACK_OPENVINO_CMAKEDIR runtime/cmake)
set(OV_CPACK_DOCDIR docs)
set(OV_CPACK_LICENSESDIR licenses)
set(OV_CPACK_SAMPLESDIR samples)
set(OV_CPACK_WHEELSDIR tools)
set(OV_CPACK_TOOLSDIR tools)
set(OV_CPACK_DEVREQDIR tools)
set(OV_CPACK_PYTHONDIR python)

if(WIN32)
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_RUNTIMEDIR runtime/bin/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_WHEEL_RUNTIMEDIR runtime/bin/${ARCH_FOLDER}/Release)
elseif(APPLE)
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_RUNTIMEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER}/$<CONFIG>)
set(OV_WHEEL_RUNTIMEDIR runtime/lib/${ARCH_FOLDER}/Release)
else()
set(OV_CPACK_LIBRARYDIR runtime/lib/${ARCH_FOLDER})
set(OV_CPACK_RUNTIMEDIR runtime/lib/${ARCH_FOLDER})
set(OV_CPACK_ARCHIVEDIR runtime/lib/${ARCH_FOLDER})
set(OV_WHEEL_RUNTIMEDIR ${OV_CPACK_RUNTIMEDIR})
endif()
set(OV_CPACK_PLUGINSDIR ${OV_CPACK_RUNTIMEDIR})

# for BW compatibility
set(IE_CPACK_LIBRARY_PATH ${OV_CPACK_LIBRARYDIR})
set(IE_CPACK_RUNTIME_PATH ${OV_CPACK_RUNTIMEDIR})
set(IE_CPACK_ARCHIVE_PATH ${OV_CPACK_ARCHIVEDIR})
endmacro()

ov_cpack_set_dirs()

#
# ov_cpack_add_component(NAME ...)
#
Expand Down Expand Up @@ -169,38 +123,15 @@ endmacro()

ov_define_component_names()

# default components for case when CPACK_GENERATOR is not set (i.e. default open source user)
macro(ov_define_component_include_rules)
# core components
unset(OV_CPACK_COMP_CORE_EXCLUDE_ALL)
unset(OV_CPACK_COMP_CORE_C_EXCLUDE_ALL)
unset(OV_CPACK_COMP_CORE_DEV_EXCLUDE_ALL)
unset(OV_CPACK_COMP_CORE_C_DEV_EXCLUDE_ALL)
# licensing
unset(OV_CPACK_COMP_LICENSING_EXCLUDE_ALL)
# samples
unset(OV_CPACK_COMP_CPP_SAMPLES_EXCLUDE_ALL)
unset(OV_CPACK_COMP_C_SAMPLES_EXCLUDE_ALL)
unset(OV_CPACK_COMP_PYTHON_SAMPLES_EXCLUDE_ALL)
# python
unset(OV_CPACK_COMP_PYTHON_OPENVINO_EXCLUDE_ALL)
unset(OV_CPACK_COMP_BENCHMARK_APP_EXCLUDE_ALL)
unset(OV_CPACK_COMP_OVC_EXCLUDE_ALL)
set(OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE_EXCLUDE_ALL EXCLUDE_FROM_ALL)
unset(OV_CPACK_COMP_PYTHON_WHEELS_EXCLUDE_ALL)
# tools
set(OV_CPACK_COMP_OPENVINO_DEV_REQ_FILES_EXCLUDE_ALL EXCLUDE_FROM_ALL)
unset(OV_CPACK_COMP_DEPLOYMENT_MANAGER_EXCLUDE_ALL)
# scripts
unset(OV_CPACK_COMP_INSTALL_DEPENDENCIES_EXCLUDE_ALL)
unset(OV_CPACK_COMP_SETUPVARS_EXCLUDE_ALL)
endmacro()

ov_define_component_include_rules()
if(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR "TGZ")
elseif(NOT CPACK_GENERATOR)
message(FATAL_ERROR "CPACK_GENERATOR cannot contain an empty value")
endif()

#
# Include generator specific configuration file:
# 1. Overrides directories set by ov_<debian | rpm | common_libraries>_cpack_set_dirs()
# 1. Overrides directories set by ov_<debian | rpm | archive | common_libraries>_cpack_set_dirs()
# This is requried, because different generator use different locations for installed files
# 2. Merges some components using ov_override_component_names()
# This is required, because different generators have different set of components
Expand Down Expand Up @@ -230,12 +161,11 @@ elseif(CPACK_GENERATOR STREQUAL "NSIS")
include(packaging/nsis)
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW|CONAN|VCPKG)$")
include(packaging/common-libraries)
elseif(CPACK_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|TZST|ZIP)$")
include(packaging/archive)
endif()

macro(ie_cpack)
if(NOT DEFINED CPACK_GENERATOR)
set(CPACK_GENERATOR "TGZ")
endif()
set(CPACK_SOURCE_GENERATOR "") # not used
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OpenVINO™ Toolkit")
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED OFF)
Expand Down Expand Up @@ -287,18 +217,10 @@ macro(ie_cpack)

# include GENERATOR dedicated per-component configuration file
# NOTE: private modules need to define ov_cpack_settings macro
# for custom packages configuration
# for custom packages configuration
if(COMMAND ov_cpack_settings)
ov_cpack_settings()
endif()

# generator specific variables
if(CPACK_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|ZIP)$")
# New in version 3.18
set(CPACK_ARCHIVE_THREADS 8)
# multiple packages are generated
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
endif()

include(CPack)
endmacro()
23 changes: 23 additions & 0 deletions cmake/packaging/archive.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

#
# OpenVINO Core components including frontends, plugins, etc
#
macro(ov_cpack_settings)
# fill a list of components which are part of conda
set(cpack_components_all ${CPACK_COMPONENTS_ALL})
unset(CPACK_COMPONENTS_ALL)
foreach(item IN LISTS cpack_components_all)
string(TOUPPER ${item} UPPER_COMP)
# filter out some components, which are not needed to be wrapped to conda-forge | brew | conan | vcpkg
if(NOT OV_CPACK_COMP_${UPPER_COMP}_EXCLUDE_ALL AND
# python_package is not needed in case of archives, because components like pyopenvino are used, as well as wheels
NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE}_python.*")
list(APPEND CPACK_COMPONENTS_ALL ${item})
endif()
endforeach()
unset(cpack_components_all)
list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)
endmacro()
3 changes: 3 additions & 0 deletions cmake/packaging/common-libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ macro(ov_cpack_settings)
string(TOUPPER ${item} UPPER_COMP)
# filter out some components, which are not needed to be wrapped to conda-forge | brew | conan | vcpkg
if(NOT OV_CPACK_COMP_${UPPER_COMP}_EXCLUDE_ALL AND
# because in case of VCPKG | CONAN | BREW | CONDA-FORGE distributions, python is either not needed or installed separately
(NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE}_python.*" OR ENABLE_PYTHON_PACKAGING) AND
# even for case of system TBB we have installation rules for wheels packages
# so, need to skip this explicitly since they are installed in `host` section
NOT item MATCHES "^tbb(_dev)?$" AND
Expand All @@ -21,6 +23,7 @@ macro(ov_cpack_settings)
list(APPEND CPACK_COMPONENTS_ALL ${item})
endif()
endforeach()
unset(cpack_components_all)
list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)

# override generator
Expand Down
3 changes: 2 additions & 1 deletion cmake/packaging/debian.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ macro(ov_cpack_settings)
string(TOUPPER ${item} UPPER_COMP)
# filter out some components, which are not needed to be wrapped to .deb package
if(NOT OV_CPACK_COMP_${UPPER_COMP}_EXCLUDE_ALL AND
# skip OpenVINO Python API (pattern in form of "<pyie | pyopenvino | pyngraph>_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
# skip OpenVINO Python API (pattern in form of "pyopenvino_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO}_python.*" AND
# because in case of .deb package, pyopenvino_package_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} is installed
(NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE}_python.*" OR ENABLE_PYTHON_PACKAGING) AND
Expand All @@ -65,6 +65,7 @@ macro(ov_cpack_settings)
list(APPEND CPACK_COMPONENTS_ALL ${item})
endif()
endforeach()
unset(cpack_components_all)
list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)

# version with 3 components
Expand Down
1 change: 1 addition & 0 deletions cmake/packaging/nsis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ macro(ov_cpack_settings)
list(APPEND CPACK_COMPONENTS_ALL ${item})
endif()
endforeach()
unset(cpack_components_all)

# restore the components settings

Expand Down
10 changes: 6 additions & 4 deletions cmake/packaging/packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
#

if(CPACK_GENERATOR STREQUAL "DEB")
include(cmake/packaging/debian.cmake)
include("${OpenVINO_SOURCE_DIR}/cmake/packaging/debian.cmake")
elseif(CPACK_GENERATOR STREQUAL "RPM")
include(cmake/packaging/rpm.cmake)
include("${OpenVINO_SOURCE_DIR}/cmake/packaging/rpm.cmake")
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW|CONAN|VCPKG)$")
include(cmake/packaging/common-libraries.cmake)
include("${OpenVINO_SOURCE_DIR}/cmake/packaging/common-libraries.cmake")
elseif(CPACK_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|TZST|ZIP)$")
include("${OpenVINO_SOURCE_DIR}/cmake/packaging/archive.cmake")
elseif(CPACK_GENERATOR STREQUAL "NSIS")
include(cmake/packaging/nsis.cmake)
include("${OpenVINO_SOURCE_DIR}/cmake/packaging/nsis.cmake")
endif()
3 changes: 2 additions & 1 deletion cmake/packaging/rpm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ macro(ov_cpack_settings)
string(TOUPPER ${item} UPPER_COMP)
# filter out some components, which are not needed to be wrapped to .rpm package
if(NOT OV_CPACK_COMP_${UPPER_COMP}_EXCLUDE_ALL AND
# skip OpenVINO Python API (pattern in form of "<pyie | pyopenvino | pyngraph>_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
# skip OpenVINO Python API (pattern in form of "pyopenvino_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO}_python.*" AND
# because in case of .rpm package, pyopenvino_package_python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR} is installed
(NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO_PACKAGE}_python.*" OR ENABLE_PYTHON_PACKAGING) AND
Expand All @@ -51,6 +51,7 @@ macro(ov_cpack_settings)
list(APPEND CPACK_COMPONENTS_ALL ${item})
endif()
endforeach()
unset(cpack_components_all)
list(REMOVE_DUPLICATES CPACK_COMPONENTS_ALL)

# version with 3 components
Expand Down
Loading

0 comments on commit 8cc2d28

Please sign in to comment.