diff --git a/cmake/developer_package/features.cmake b/cmake/developer_package/features.cmake index 92096d49bd8..f382b8bd763 100644 --- a/cmake/developer_package/features.cmake +++ b/cmake/developer_package/features.cmake @@ -18,7 +18,12 @@ else() endif() # FIXME: ARM cross-compiler generates several "false positive" warnings regarding __builtin_memcpy buffer overflow -ie_dependent_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ON "X86 OR X86_64" OFF) +if(X86 OR X86_64) + set(TREAT_WARNING_AS_ERROR_DEFAULT ON) +else() + set(TREAT_WARNING_AS_ERROR_DEFAULT OFF) +endif() +ie_option (TREAT_WARNING_AS_ERROR "Treat build warnings as errors" ${TREAT_WARNING_AS_ERROR_DEFAULT}) ie_dependent_option (ENABLE_INTEGRITYCHECK "build DLLs with /INTEGRITYCHECK flag" OFF "CMAKE_CXX_COMPILER_ID STREQUAL MSVC" OFF) @@ -44,19 +49,25 @@ ie_option (BUILD_SHARED_LIBS "Build as a shared library" ON) ie_dependent_option (ENABLE_FASTER_BUILD "Enable build features (PCH, UNITY) to speed up build time" OFF "CMAKE_VERSION VERSION_GREATER_EQUAL 3.16" OFF) -ie_dependent_option (ENABLE_CPPLINT "Enable cpplint checks during the build" ON "UNIX;NOT ANDROID" OFF) +if(UNIX AND NOT ANDROID) + set(STYLE_CHECKS_DEFAULT ON) +else() + set(STYLE_CHECKS_DEFAULT OFF) +endif() + +ie_option (ENABLE_CPPLINT "Enable cpplint checks during the build" ${STYLE_CHECKS_DEFAULT}) ie_dependent_option (ENABLE_CPPLINT_REPORT "Build cpplint report instead of failing the build" OFF "ENABLE_CPPLINT" OFF) -ie_dependent_option (ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON "UNIX;NOT ANDROID" OFF) +ie_option (ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ${STYLE_CHECKS_DEFAULT}) -ie_dependent_option (ENABLE_NCC_STYLE "Enable ncc style check" ON "UNIX;NOT ANDROID" OFF) +ie_option (ENABLE_NCC_STYLE "Enable ncc style check" ${STYLE_CHECKS_DEFAULT}) ie_option (VERBOSE_BUILD "shows extra information about build" OFF) ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF) -ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG; NOT WIN32" OFF) +ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG;NOT WIN32" OFF) # # Check features diff --git a/cmake/developer_package/models.cmake b/cmake/developer_package/models.cmake index 698f1178531..8060087e959 100644 --- a/cmake/developer_package/models.cmake +++ b/cmake/developer_package/models.cmake @@ -2,7 +2,9 @@ # SPDX-License-Identifier: Apache-2.0 # -find_package(Git REQUIRED) +if(ENABLE_DATA) + find_package(Git REQUIRED) +endif() set(MODELS_LST "") set(MODELS_LST_TO_FETCH "") diff --git a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake index 7a02b74cbe5..5039fc2ccb1 100644 --- a/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake +++ b/cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake @@ -57,7 +57,7 @@ if(ENABLE_NCC_STYLE) get_target_property(libclang_location libclang LOCATION) message(STATUS "Found libclang: ${libclang_location}") else() - message(WARNING "libclang-${clang_version} is not found (required for ncc naming style check)") + message(WARNING "clang-${clang_version} libclang-${clang_version}-dev are not found (required for ncc naming style check)") set(ENABLE_NCC_STYLE OFF) endif() endif() diff --git a/cmake/developer_package/ncc_naming_style/ncc_run.cmake b/cmake/developer_package/ncc_naming_style/ncc_run.cmake index 59cba15409a..28c885d17fe 100644 --- a/cmake/developer_package/ncc_naming_style/ncc_run.cmake +++ b/cmake/developer_package/ncc_naming_style/ncc_run.cmake @@ -26,7 +26,7 @@ execute_process( --include ${ADDITIONAL_INCLUDE_DIRECTORIES} RESULT_VARIABLE result OUTPUT_VARIABLE output - ERROR_VARIABLE output) + ERROR_VARIABLE error) file(WRITE "${OUTPUT_FILE}" "${output}") @@ -40,6 +40,6 @@ endif() if(failed AND NOT EXPECTED_FAIL) # Display the output to console (to parse it form IDE) - message("${output}") + message("${output}\n${error}") message(FATAL_ERROR "[ncc naming style] Naming style check failed for ${INPUT_FILE}") endif() diff --git a/cmake/features.cmake b/cmake/features.cmake index 2eb8356b1a7..504f7b2e27f 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -24,7 +24,7 @@ else() set(ENABLE_ONEDNN_FOR_GPU_DEFAULT ON) endif() -ie_dependent_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ON "ENABLE_ONEDNN_FOR_GPU_DEFAULT" OFF) +ie_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ${ENABLE_ONEDNN_FOR_GPU_DEFAULT}) ie_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF) @@ -41,10 +41,9 @@ In case SELECTIVE_BUILD is enabled, the SELECTIVE_BUILD_STAT variable should con Usage: -DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=/path/*.csv" OFF ALLOWED_VALUES ON OFF COLLECT) -ie_option(ENABLE_ERROR_HIGHLIGHT "Highlight errors and warnings during compile time" OFF) +ie_option(ENABLE_ERROR_HIGHLIGHT "Highlight errors and warnings during compile time" ON) -find_host_package(PythonInterp 3 QUIET) -ie_dependent_option (ENABLE_DOCS "Build docs using Doxygen" OFF "PYTHONINTERP_FOUND" OFF) +ie_option (ENABLE_DOCS "Build docs using Doxygen" OFF) # # Inference Engine specific options @@ -111,11 +110,11 @@ ie_dependent_option (ENABLE_MYRIAD_MVNC_TESTS "functional and behavior tests for ie_dependent_option (ENABLE_DATA "fetch models from testdata repo" ON "ENABLE_FUNCTIONAL_TESTS;NOT ANDROID" OFF) -ie_dependent_option (ENABLE_BEH_TESTS "tests oriented to check inference engine API corecteness" ON "ENABLE_TESTS" OFF) +ie_dependent_option (ENABLE_BEH_TESTS "tests oriented to check inference engine API correctness" ON "ENABLE_TESTS" OFF) ie_dependent_option (ENABLE_FUNCTIONAL_TESTS "functional tests" ON "ENABLE_TESTS" OFF) -ie_dependent_option (ENABLE_SAMPLES "console samples are part of inference engine package" ON "NOT MINGW" OFF) +ie_option (ENABLE_SAMPLES "console samples are part of inference engine package" ON) ie_option (ENABLE_OPENCV "enables custom OpenCV download" OFF) @@ -156,13 +155,15 @@ else() set(protoc_available ON) endif() -ie_dependent_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ON "protoc_available" OFF) +find_host_package(PythonInterp 3 QUIET) +ie_dependent_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ${PYTHONINTERP_FOUND} "protoc_available" OFF) ie_dependent_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON "protoc_available" OFF) ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON) ie_dependent_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON "protoc_available" OFF) ie_dependent_option(ENABLE_SYSTEM_PROTOBUF "Use system protobuf" OFF "ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND;BUILD_SHARED_LIBS" OFF) -ie_dependent_option(ENABLE_OV_CORE_UNIT_TESTS "Enables OpenVINO core unit tests" ON "ENABLE_TESTS;NOT ANDROID" OFF) + +ie_dependent_option(ENABLE_OV_CORE_UNIT_TESTS "Enables OpenVINO core unit tests" ON "ENABLE_TESTS" OFF) ie_dependent_option(ENABLE_OV_CORE_BACKEND_UNIT_TESTS "Control the building of unit tests using backends" ON "ENABLE_OV_CORE_UNIT_TESTS" OFF) ie_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OFF) diff --git a/install_build_dependencies.sh b/install_build_dependencies.sh index afd9405896f..ad12ba00085 100755 --- a/install_build_dependencies.sh +++ b/install_build_dependencies.sh @@ -46,11 +46,13 @@ if [ -f /etc/lsb-release ]; then shellcheck \ patchelf \ lintian \ + gzip \ `# openvino` \ libtbb-dev \ libpugixml-dev \ `# python` \ python3-pip \ + python3-venv \ python3-enchant \ python3-setuptools \ libpython3-dev \ diff --git a/src/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt index 0924eb33cfa..38f3507b5c8 100644 --- a/src/bindings/python/CMakeLists.txt +++ b/src/bindings/python/CMakeLists.txt @@ -22,37 +22,48 @@ if(CMAKE_CROSSCOMPILING AND DEFINED ENV{OE_CMAKE_TOOLCHAIN_FILE}) endif() # -# Options +# Check python requirements # set(ov_python_req "${OpenVINOPython_SOURCE_DIR}/requirements.txt") set(ie_python_req "cython>=0.29.22") function(ov_check_python_build_conditions) - # Try to find python3 - find_package(PythonInterp 3 QUIET) - if(PYTHONINTERP_FOUND) - # use libraries with the same version as python itself - find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET) - if(NOT PYTHONLIBS_FOUND) - message(WARNING "Python development libraries are not found. OpenVINO Python API will be turned off (ENABLE_PYTHON is OFF)") - endif() + # user explicitly specified ENABLE_PYTHON=ON + if(ENABLE_PYTHON) + set(find_package_mode REQUIRED) + set(message_mode FATAL_ERROR) else() - message(WARNING "Python 3.x interpreter is not found. OpenVINO Python API will be turned off (ENABLE_PYTHON is OFF)") + set(find_package_mode QUIET) + set(message_mode WARNING) endif() - # pyopenvino requirements + # Try to find python3 + find_package(PythonInterp 3 ${find_package_mode}) + if(PYTHONINTERP_FOUND) + # use libraries with the same version as python itself + find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT ${find_package_mode}) + if(NOT PYTHONLIBS_FOUND) + message(${message_mode} "Python development libraries are not found. OpenVINO Python API will be turned off (ENABLE_PYTHON is OFF)") + endif() + else() + message(${message_mode} "Python 3.x interpreter is not found. OpenVINO Python API will be turned off (ENABLE_PYTHON is OFF)") + endif() + + # check pyopenvino requirements to OV 2.0 API ov_check_pip_packages(REQUIREMENTS_FILE ${ov_python_req} - RESULT_VAR ov_python_reqs_FOUND + RESULT_VAR ov_python_req_FOUND + WARNING_MESSAGE "install python3 -m install -r ${ov_python_req} for OV API 2.0 requirements" MESSAGE_MODE TRACE) - # Check for Cython to build IE_API + # ov_python_req are not mandatory for build + set(ov_python_req_FOUND ON) + + # check for Cython requirement for build IE API 1.0 ov_check_pip_package(REQUIREMENT ${ie_python_req} RESULT_VAR ie_python_req_FOUND + WARNING_MESSAGE "install python3 -m install ${ie_python_req} for IE API 1.0 requirements" MESSAGE_MODE TRACE) - # ov_python_req are not mandatory for build - set(ov_python_reqs_FOUND ON) - # cython can be installed as a debian package, so pip requirements can be unsatisfied # so, let's check to find cython anyway if(NOT ie_python_req_FOUND) @@ -63,26 +74,30 @@ function(ov_check_python_build_conditions) if(CYTHON_VERSION VERSION_GREATER_EQUAL 0.29) set(ie_python_req_FOUND ON) else() - message(WARNING "Python module '${ie_python_req}' is missed, IE Python API 1.0 will not be built (ENABLE_PYTHON is OFF)") + message(${message_mode} "Python module '${ie_python_req}' is missed, IE Python API 1.0 will not be built (ENABLE_PYTHON is OFF)") endif() endif() if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_DEBUG_POSTFIX) set(python_debug ON) - message(WARNING "Building python bindings in debug configuration is not supported on your platform (ENABLE_PYTHON is OFF)") + message(${message_mode} "Building python bindings in debug configuration is not supported on your platform (ENABLE_PYTHON is OFF)") else() set(python_debug OFF) endif() - set(python_debug ${python_debug} PARENT_SCOPE) - set(PYTHONLIBS_FOUND ${PYTHONLIBS_FOUND} PARENT_SCOPE) - set(ov_python_reqs_FOUND ${ov_python_reqs_FOUND} PARENT_SCOPE) + if(PYTHONLIBS_FOUND AND ov_python_req_FOUND AND ie_python_req_FOUND AND NOT python_debug) + set(ENABLE_PYTHON_DEFAULT ON PARENT_SCOPE) + else() + set(ENABLE_PYTHON_DEFAULT OFF PARENT_SCOPE) + endif() + + # to disable API 1.0 set(ie_python_req_FOUND ${ie_python_req_FOUND} PARENT_SCOPE) endfunction() ov_check_python_build_conditions() -ie_dependent_option(ENABLE_PYTHON "enables ie python bridge build" ON "PYTHONLIBS_FOUND;ov_python_reqs_FOUND;NOT python_debug" OFF) +ie_option(ENABLE_PYTHON "Enables OpenVINO Python API build" ${ENABLE_PYTHON_DEFAULT}) if(NOT ENABLE_PYTHON) if(CMAKE_SOURCE_DIR STREQUAL OpenVINOPython_SOURCE_DIR) @@ -92,26 +107,43 @@ if(NOT ENABLE_PYTHON) endif() endif() +# # Check for wheel package +# + +# user explicitly specified ENABLE_WHEEL=ON +if(ENABLE_WHEEL) + set(find_package_mode REQUIRED) + set(message_mode FATAL_ERROR) +else() + set(find_package_mode QUIET) + set(message_mode WARNING) +endif() + +set(wheel_reqs "${OpenVINOPython_SOURCE_DIR}/wheel/requirements-dev.txt") ov_check_pip_packages(REQUIREMENTS_FILE "${OpenVINOPython_SOURCE_DIR}/wheel/requirements-dev.txt" RESULT_VAR wheel_req_FOUND MESSAGE_MODE WARNING) -set(WHEEL_CONDITIONS "PYTHONINTERP_FOUND;ENABLE_PYTHON;wheel_req_FOUND;CMAKE_SOURCE_DIR STREQUAL OpenVINO_SOURCE_DIR") +if(wheel_req_FOUND AND "${CMAKE_SOURCE_DIR}" STREQUAL "${OpenVINO_SOURCE_DIR}") + set(ENABLE_WHEEL_DEFAULT ON) +else() + set(ENABLE_WHEEL_DEFAULT OFF) +endif() if(LINUX) find_host_program(patchelf_program NAMES patchelf DOC "Path to patchelf tool") if(NOT patchelf_program) - message(WARNING "patchelf is not found. It is required to build OpenVINO Runtime wheel. Install via apt-get install patchelf") - list(APPEND WHEEL_CONDITIONS patchelf_program) + set(ENABLE_WHEEL_DEFAULT OFF) + message(${message_mode} "patchelf is not found. It is required to build OpenVINO Runtime wheel. Install via apt-get install patchelf") endif() endif() # this option should not be a part of InferenceEngineDeveloperPackage # since wheels can be built only together with main OV build -ie_dependent_option(ENABLE_WHEEL "Build wheel packages for PyPI" ON "${WHEEL_CONDITIONS}" OFF) +ie_dependent_option(ENABLE_WHEEL "Build wheel packages for PyPI" ${ENABLE_WHEEL_DEFAULT} "ENABLE_PYTHON" OFF) # # Build the code diff --git a/src/bindings/python/wheel/setup.py b/src/bindings/python/wheel/setup.py index 1fbf78795a6..c54d4fa4884 100644 --- a/src/bindings/python/wheel/setup.py +++ b/src/bindings/python/wheel/setup.py @@ -205,8 +205,7 @@ class CustomBuild(build): self.announce(f"Configuring cmake project: {openvino_root_dir}", level=3) self.spawn(["cmake", "-H" + str(openvino_root_dir), "-B" + self.build_temp, "-DCMAKE_BUILD_TYPE={type}".format(type=self.config), - "-DENABLE_PYTHON=ON", - "-DENABLE_OV_ONNX_FRONTEND=ON"]) + "-DENABLE_PYTHON=ON"]) self.announce("Building binaries", level=3) self.spawn(["cmake", "--build", self.build_temp, diff --git a/src/frontends/tensorflow/tests/requirements_dev.txt b/src/frontends/tensorflow/tests/requirements_dev.txt new file mode 100644 index 00000000000..4d4e9fd4902 --- /dev/null +++ b/src/frontends/tensorflow/tests/requirements_dev.txt @@ -0,0 +1,2 @@ +numpy>=1.16.6,<=1.23.1 +tensorflow>=1.15.5,<=2.9.1 diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 6c203b8799f..0db118aa61c 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -4,7 +4,10 @@ file(GLOB local_modules "${CMAKE_CURRENT_SOURCE_DIR}/*") foreach(module_path IN LISTS local_modules) - if(NOT IS_DIRECTORY ${module_path}) # Skip files + if( # Skip files + NOT IS_DIRECTORY ${module_path} OR + # or directories without cmake + NOT EXISTS "${module_path}/CMakeLists.txt") continue() endif() add_subdirectory(${module_path}) diff --git a/src/plugins/intel_myriad/third_party/XLink/XLink.cmake b/src/plugins/intel_myriad/third_party/XLink/XLink.cmake index ce78f0af83b..fe0860826a0 100644 --- a/src/plugins/intel_myriad/third_party/XLink/XLink.cmake +++ b/src/plugins/intel_myriad/third_party/XLink/XLink.cmake @@ -21,8 +21,7 @@ file(GLOB_RECURSE SHARED_SRC "${XLINK_ROOT_DIR}/shared/*.c") list(APPEND XLINK_SOURCES ${PC_SRC} ${PC_PROTO_SRC} ${SHARED_SRC}) if(WIN32) - set(XLINK_PLATFORM_INCLUDE - ${XLINK_ROOT_DIR}/pc/Win/include) + set(XLINK_PLATFORM_INCLUDE ${XLINK_ROOT_DIR}/pc/Win/include) file(GLOB XLINK_PLATFORM_SRC "${XLINK_ROOT_DIR}/pc/Win/src/*.c") list(APPEND XLINK_SOURCES ${XLINK_PLATFORM_SRC}) @@ -32,14 +31,14 @@ else() find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES "include" "libusb" "libusb-1.0") find_library(LIBUSB_LIBRARY NAMES usb-1.0 PATH_SUFFIXES "lib") + # TODO: need to detect libusb before enabling ENABLE_INTEL_MYRIAD_COMMON if(NOT LIBUSB_INCLUDE_DIR OR NOT LIBUSB_LIBRARY) message(FATAL_ERROR "libusb is required, please install it") endif() - set(XLINK_PLATFORM_INCLUDE - ${XLINK_ROOT_DIR}/pc/MacOS) + set(XLINK_PLATFORM_INCLUDE ${XLINK_ROOT_DIR}/pc/MacOS) list(APPEND XLINK_SOURCES "${XLINK_ROOT_DIR}/pc/MacOS/pthread_semaphore.c") -endif(WIN32) +endif() #This is for the Movidius team set(XLINK_INCLUDE_DIRECTORIES diff --git a/thirdparty/onnx/CMakeLists.txt b/thirdparty/onnx/CMakeLists.txt index b5d2fc5e378..8da3d2066f5 100644 --- a/thirdparty/onnx/CMakeLists.txt +++ b/thirdparty/onnx/CMakeLists.txt @@ -23,7 +23,7 @@ set(ONNX_USE_PROTOBUF_SHARED_LIBS CACHE BOOL "Use dynamic protobuf by ONNX libra set(ONNX_NAMESPACE ${OV_ONNX_NAMESPACE}) set(ONNX_USE_LITE_PROTO ${ONNX_USE_LITE_PROTO_DEFAULT} CACHE BOOL "Use protobuf lite for ONNX library" FORCE) set(ONNX_ML ON CACHE BOOL "Use ONNX ML" FORCE) -if(CMAKE_CROSSCOMPILING) +if(CMAKE_CROSSCOMPILING AND NOT DEFINED ONNX_CUSTOM_PROTOC_EXECUTABLE) set(ONNX_CUSTOM_PROTOC_EXECUTABLE ${SYSTEM_PROTOC}) endif()