Skip to content

Commit

Permalink
Tuned wheels build (#14038)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov authored Nov 16, 2022
1 parent af7adf2 commit c51ee52
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
13 changes: 5 additions & 8 deletions src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ if(NOT DEFINED OpenVINO_SOURCE_DIR)
set(OpenVINO_BINARY_DIR "${OpenVINODeveloperPackage_DIR}")
endif()

if(DEFINED ENV{CI_BUILD_DEV_TAG} AND NOT "$ENV{CI_BUILD_DEV_TAG}" STREQUAL "")
set(WHEEL_VERSION "${OpenVINO_VERSION}.$ENV{CI_BUILD_DEV_TAG}" CACHE STRING "Version of this release" FORCE)
set(wheel_pre_release ON)
else()
set(WHEEL_VERSION ${OpenVINO_VERSION} CACHE STRING "Version of this release" FORCE)
endif()
set(WHEEL_BUILD "${OpenVINO_VERSION_BUILD}" CACHE STRING "Build number of this release" FORCE)

#
# Check python requirements
#
Expand Down Expand Up @@ -148,6 +140,11 @@ if(LINUX)
endif()
endif()

if(CMAKE_VERSION VERSION_LESS 3.15)
message(${message_mode} "Cmake version 3.15 and higher is required. Provided version ${CMAKE_VERSION}")
set(ENABLE_WHEEL_DEFAULT OFF)
endif()

# this option should not be a part of OpenVINODeveloperPackage
# since wheels can be built only together with main OV build
ie_dependent_option(ENABLE_WHEEL "Build wheel packages for PyPI" ${ENABLE_WHEEL_DEFAULT} "ENABLE_PYTHON" OFF)
Expand Down
11 changes: 11 additions & 0 deletions src/bindings/python/wheel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
# SPDX-License-Identifier: Apache-2.0
#

# define version (syncronize with tools/openvino_dev/CMakeLists.txt)

if(DEFINED ENV{CI_BUILD_DEV_TAG} AND NOT "$ENV{CI_BUILD_DEV_TAG}" STREQUAL "")
set(WHEEL_VERSION "${OpenVINO_VERSION}.$ENV{CI_BUILD_DEV_TAG}" CACHE STRING "Version of this release" FORCE)
set(wheel_pre_release ON)
else()
set(WHEEL_VERSION ${OpenVINO_VERSION} CACHE STRING "Version of this release" FORCE)
endif()
set(WHEEL_BUILD "${OpenVINO_VERSION_BUILD}" CACHE STRING "Build number of this release" FORCE)


#
# Common vars used by setup.py
#
Expand Down
34 changes: 33 additions & 1 deletion tools/openvino_dev/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@
# SPDX-License-Identifier: Apache-2.0
#

cmake_minimum_required (VERSION 3.13)

project(OpenVINODevPython DESCRIPTION "OpenVINO Python Development tools")

#
# Packages & settings
#

if(NOT DEFINED OpenVINO_SOURCE_DIR)
get_filename_component(OpenVINO_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../.." REALPATH)
endif()

find_package(IEDevScripts REQUIRED
PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)

# define version (syncronize with src/bindings/python/wheel/CMakeLists.txt)

if(DEFINED ENV{CI_BUILD_DEV_TAG} AND NOT "$ENV{CI_BUILD_DEV_TAG}" STREQUAL "")
set(WHEEL_VERSION "${OpenVINO_VERSION}.$ENV{CI_BUILD_DEV_TAG}" CACHE STRING "Version of this release" FORCE)
set(wheel_pre_release ON)
else()
set(WHEEL_VERSION ${OpenVINO_VERSION} CACHE STRING "Version of this release" FORCE)
endif()
set(WHEEL_BUILD "${OpenVINO_VERSION_BUILD}" CACHE STRING "Build number of this release" FORCE)

# openvino_dev build

set(SETUP_PY "${CMAKE_CURRENT_SOURCE_DIR}/setup.py")

set(openvino_wheel_name "openvino_dev-${WHEEL_VERSION}-${WHEEL_BUILD}-py3-none-any.whl")
Expand All @@ -17,13 +46,16 @@ add_custom_command(OUTPUT ${openvino_wheel_path}
--quiet
COMMAND ${CMAKE_COMMAND} -E env OPENVINO_VERSION=${WHEEL_VERSION}
${PYTHON_EXECUTABLE} ${SETUP_PY} clean
DEPENDS ie_wheel
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Building Python wheel ${openvino_wheel_name}"
VERBATIM)

add_custom_target(openvino_dev_wheel ALL DEPENDS ${openvino_wheel_path})

if(TARGET ie_wheel)
add_dependencies(openvino_dev_wheel ie_wheel)
endif()

# install

ie_cpack_add_component(${OV_CPACK_COMP_PYTHON_WHEELS} HIDDEN)
Expand Down

0 comments on commit c51ee52

Please sign in to comment.