Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[Cpp20] Set cpp20 as default standard (#39146)

Pawel Raasze264be1b5554
diff --git a/.github/workflows/job_build_linux_cpp20.yml b/.github/workflows/job_build_linux_cpp20.yml
deleted file mode 100644
index 88b25b07fef..00000000000
--- a/.github/workflows/job_build_linux_cpp20.yml
+++ /dev/null
@@ -1,109 +0,0 @@
-on:
- workflow_call:
- inputs:
- runner:
- description: 'Machine on which the build would run'
- type: string
- required: true
- image:
- description: 'Docker image to use for the job'
- type: string
- required: true
- os:
- description: 'OS that is used for building in the form of "ubuntu_22_04"'
- type: string
- required: true
- arch:
- description: 'Target architecture'
- type: string
- default: 'x86_64'
- required: false
- cmake-options:
- description: 'A string of options passed to CMake'
- type: string
- required: true
- cmake-build-parallel-level:
- description: 'Number of threads for parallel build (hard-coded; nproc does not respect container CPU limits)'
- type: string
- required: true
-
-permissions: read-all
-
-# Compile-only C++20 check. It is intentionally separate from job_build_linux.yml, so it
-# neither uploads artifacts nor shares compiler cache, shared-drive paths or logs with the main Build.
-jobs:
- Build:
- name: Build
- timeout-minutes: 150
- continue-on-error: true # non-blocking C++20 check (CVS-189849)
- runs-on: ${{ inputs.runner }}
- container:
- image: ${{ inputs.image }}
- volumes:
- - /mount:/mount
- - /home/runner/secrets/:/secrets:ro
- - ${{ github.workspace }}:${{ github.workspace }} # Needed as ${{ github.workspace }} is not working correctly when using Docker
- options: >-
- -e SCCACHE_AZURE_BLOB_CONTAINER
- defaults:
- run:
- shell: bash
- env:
- DEBIAN_FRONTEND: noninteractive # to prevent apt-get from waiting user input
- CMAKE_BUILD_TYPE: 'Release'
- CMAKE_CXX_COMPILER_LAUNCHER: sccache
- CMAKE_C_COMPILER_LAUNCHER: sccache
- SCCACHE_IGNORE_SERVER_IO_ERROR: 1
- SCCACHE_SERVER_PORT: 35555
- SCCACHE_ERROR_LOG: ${{ github.workspace }}/sccache_log.txt
- SCCACHE_LOG: warn
- SCCACHE_AZURE_KEY_PREFIX: ${{ inputs.os }}_${{ inputs.arch }}_Release_cpp20
- OPENVINO_REPO: ${{ github.workspace }}/openvino
- BUILD_DIR: ${{ github.workspace }}/openvino/openvino_build
- PIP_INDEX_URL: ${{ contains(inputs.runner, 'aks') && 'http://pip-proxy.pip-proxy.svc.cluster.local/simple/' || '' }}
- PIP_TRUSTED_HOST: ${{ contains(inputs.runner, 'aks') && 'pip-proxy.pip-proxy.svc.cluster.local' || '' }}
- # Nested cmake --build (e.g. intel_gpu onednn_gpu ExternalProject) does not inherit --parallel from the top-level build.
- CMAKE_BUILD_PARALLEL_LEVEL: ${{ inputs.cmake-build-parallel-level }}
- steps:
- - name: Append the environment variable - load SCCACHE_AZURE_CONNECTION_STRING from file
- shell: bash
- run: |
- SCCACHE_AZURE_CONNECTION_STRING="$(cat /secrets/sccache/connection-string)"
- # nosemgrep: yaml.github-actions.security.audit.unsafe-add-mask-workflow-command.unsafe-add-mask-workflow-command
- echo "::add-mask::${SCCACHE_AZURE_CONNECTION_STRING}"
- echo "SCCACHE_AZURE_CONNECTION_STRING=${SCCACHE_AZURE_CONNECTION_STRING}" >> $GITHUB_ENV
-
- - name: Clone OpenVINO
- uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
- timeout-minutes: 15
- with:
- path: ${{ env.OPENVINO_REPO }}
- submodules: 'recursive'
-
- - name: System info
- uses: ./openvino/.github/actions/system_info
-
- - name: Install python dependencies
- run: python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt
-
- - name: CMake configure - OpenVINO
- run: eval cmake ${{ env.CMAKE_OPTIONS }} -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }}
- env:
- CMAKE_OPTIONS: ${{ inputs.cmake-options }}
-
- - name: Clean sccache stats
- run: ${SCCACHE_PATH} --zero-stats
-
- - name: Cmake build - OpenVINO
- run: cmake --build ${BUILD_DIR} --parallel ${CMAKE_BUILD_PARALLEL_LEVEL} --config ${{ env.CMAKE_BUILD_TYPE }} -- --quiet
-
- - name: Show sccache stats
- if: always()
- run: ${SCCACHE_PATH} --show-stats
-
- - name: Report non-blocking failure
- if: failure()
- run: |
- msg="C++20 build failed. This check is non-blocking (CVS-189849), the failure does not fail the workflow."
- echo "::warning title=C++20 build failed (non-blocking)::${msg}"
- echo "${msg}" >> "${GITHUB_STEP_SUMMARY}"
diff --git a/.github/workflows/job_build_windows_cpp20.yml b/.github/workflows/job_build_windows_cpp20.yml
deleted file mode 100644
index ee9744fcafd..00000000000
--- a/.github/workflows/job_build_windows_cpp20.yml
+++ /dev/null
@@ -1,119 +0,0 @@
-on:
- workflow_call:
- inputs:
- runner:
- description: 'Machine on which the build would run'
- type: string
- required: true
- build-type:
- description: 'OpenVINO build type, e.g., "Release"'
- type: string
- required: true
- target-branch:
- description: 'Retained for compatibility; remote ccache is shared across branches'
- type: string
- required: true
- cmake-options:
- description: 'A string of options passed to CMake'
- type: string
- required: true
- build-variant:
- description: 'Build variant including toolchain, e.g., "vs2022"'
- type: string
- required: false
- default: 'vs2022'
- cmake-build-parallel-level:
- description: 'Number of threads for parallel build (hard-coded; NUMBER_OF_PROCESSORS does not respect container CPU limits)'
- type: string
- required: true
-
-permissions: read-all
-
-env:
- PYTHON_VERSION: '3.11'
-
-# Compile-only C++20 check. It is intentionally separate from job_build_windows.yml, so it
-# neither uploads artifacts nor shares compiler cache or shared-drive paths with the main Build.
-jobs:
- Build:
- name: Build
- timeout-minutes: 180
- continue-on-error: true # non-blocking C++20 check (CVS-189849)
- defaults:
- run:
- shell: pwsh
- runs-on: ${{ inputs.runner }}
- env:
- CMAKE_BUILD_TYPE: ${{ inputs.build-type }}
- CMAKE_CXX_COMPILER_LAUNCHER: ccache
- CMAKE_C_COMPILER_LAUNCHER: ccache
- CCACHE_SECONDARY_STORAGE: "file:///C:/mount/caches/ccache/shared/windows/${{ inputs.build-variant }}/x86_64/${{ inputs.build-type }}_cpp20|update-mtime=true"
- CCACHE_DIR: ${{ github.workspace }}\\ccache
- CCACHE_MAXSIZE: 3G
- CCACHE_COMPILERCHECK: content
- CCACHE_SLOPPINESS: pch_defines,time_macros
- OPENVINO_REPO: "${{ github.workspace }}\\openvino"
- BUILD_DIR: "${{ github.workspace }}\\openvino_build"
- # Nested cmake --build (e.g. intel_gpu onednn_gpu ExternalProject) does not inherit --parallel from the top-level build.
- CMAKE_BUILD_PARALLEL_LEVEL: ${{ inputs.cmake-build-parallel-level }}
- steps:
- - name: Clone OpenVINO
- uses: ababushk/checkout@dd591a6a2ac25618db4eda86e7e0d938f88cf01b # cherry_pick_retries
- timeout-minutes: 15
- with:
- path: 'openvino'
- submodules: 'recursive'
-
- - name: Setup Python ${{ env.PYTHON_VERSION }}
- uses: ./openvino/.github/actions/setup_python
- with:
- version: ${{ env.PYTHON_VERSION }}
- use-pip-proxy: 'true'
- self-hosted-runner: 'true'
-
- - name: System info
- uses: ./openvino/.github/actions/system_info
-
- - name: Install python dependencies
- run: python3 -m pip install -r ${{ env.OPENVINO_REPO }}/src/bindings/python/wheel/requirements-dev.txt
-
- - name: Setup ccache
- run: |
- ccache --version
- $config = ccache --show-config | Out-String
- Write-Output $config
- if (-not $config.Contains($env:CCACHE_SECONDARY_STORAGE)) {
- Write-Error "ccache remote storage is not configured: expected $env:CCACHE_SECONDARY_STORAGE"
- exit 1
- }
-
- - name: Configure Developer Command Prompt for Microsoft Visual C++
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- with:
- toolset: "14.42" # v2022
-
- - name: CMake configure
- env:
- CMAKE_OPTIONS: ${{ inputs.cmake-options }}
- run: |
- $cmakeOptions = "$env:CMAKE_OPTIONS"
- $splitCmakeOptions = $cmakeOptions.Split(" ")
- $cmakeCommand = "cmake $splitCmakeOptions -S ${{ env.OPENVINO_REPO }} -B ${{ env.BUILD_DIR }}"
- Invoke-Expression $cmakeCommand
-
- - name: Clean ccache stats
- run: '& ccache --zero-stats'
-
- - name: Cmake build - OpenVINO
- run: cmake --build ${{ env.BUILD_DIR }} --config ${{ env.CMAKE_BUILD_TYPE }} --parallel $env:CMAKE_BUILD_PARALLEL_LEVEL -- --quiet
-
- - name: Show ccache stats
- if: always()
- run: '& ccache --show-stats --verbose'
-
- - name: Report non-blocking failure
- if: failure()
- run: |
- $msg = "C++20 build failed. This check is non-blocking (CVS-189849), the failure does not fail the workflow."
- echo "::warning title=C++20 build failed (non-blocking)::$msg"
- echo $msg >> $env:GITHUB_STEP_SUMMARY
diff --git a/.github/workflows/job_gguf_genai_validation.yml b/.github/workflows/job_gguf_genai_validation.yml
index 7a52c6e4b09..1e7dff81b14 100644
--- a/.github/workflows/job_gguf_genai_validation.yml
+++ b/.github/workflows/job_gguf_genai_validation.yml
@@ -125,10 +125,11 @@ jobs:
id: build_genai
run: |
source "${INSTALL_DIR}/setupvars.sh"
+ # CVS-199298: remove -DCMAKE_CXX_STANDARD=17 once GenAI migrates to C++20.
cmake -S "${GENAI_DIR}" -B "${BUILD_DIR}" \
-DOpenVINODeveloperPackage_DIR="${INSTALL_DIR}/developer_package/cmake" \
-DENABLE_PYTHON=ON -DENABLE_TESTS=OFF -DENABLE_SAMPLES=OFF -DENABLE_TOOLS=OFF \
- -DBUILD_TOKENIZERS=OFF -DCMAKE_BUILD_TYPE=Release \
+ -DBUILD_TOKENIZERS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 \
-DCMAKE_C_COMPILER_LAUNCHER= -DCMAKE_CXX_COMPILER_LAUNCHER=
cmake --build "${BUILD_DIR}" --target py_openvino_genai --parallel 4
python3 - <<'PY'
diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml
index bfe1b4dd88a..8179de341d8 100644
--- a/.github/workflows/linux_conditional_compilation.yml
+++ b/.github/workflows/linux_conditional_compilation.yml
@@ -174,7 +174,6 @@ jobs:
run: |
cmake \
-G "${{ env.CMAKE_GENERATOR }}" \
- -DCMAKE_CXX_STANDARD=20 \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_TESTS=ON \
-DENABLE_NCC_STYLE=OFF \
diff --git a/.github/workflows/ubuntu_22.yml b/.github/workflows/ubuntu_22.yml
index ffc214a6236..cd0d2f5cc7e 100644
--- a/.github/workflows/ubuntu_22.yml
+++ b/.github/workflows/ubuntu_22.yml
@@ -1,13 +1,11 @@
name: Linux (Ubuntu 22.04, Python 3.11)
-run-name: ${{ github.event_name == 'schedule' && (github.event.schedule == '0 2 * * *' && 'Linux (Ubuntu 22.04, Python 3.11) - Nightly (C++20 build only)' || github.event.schedule == '0 0 * * 3,6' && 'Linux (Ubuntu 22.04, Python 3.11) - Nightly (with latest OneDNN)' || 'Linux (Ubuntu 22.04, Python 3.11) - Nightly (without latest OneDNN)') || 'Linux (Ubuntu 22.04, Python 3.11)' }}
+run-name: ${{ github.event_name == 'schedule' && (github.event.schedule == '0 0 * * 3,6' && 'Linux (Ubuntu 22.04, Python 3.11) - Nightly (with latest OneDNN)' || 'Linux (Ubuntu 22.04, Python 3.11) - Nightly (without latest OneDNN)') || 'Linux (Ubuntu 22.04, Python 3.11)' }}
on:
schedule:
# at 00:00 on Wednesday and Saturday (with latest OneDNN)
- cron: '0 0 * * 3,6'
# at 00:00 on Tuesday and Thursday (without latest OneDNN)
- cron: '0 0 * * 2,4'
- # at 02:00 every day: C++20 build without the regular build and tests
- - cron: '0 2 * * *'
workflow_dispatch:
inputs:
target-branch:
@@ -38,7 +36,6 @@ concurrency:
permissions: read-all
env:
-
PYTHON_VERSION: '3.11'
TARGET_BRANCH: ${{ inputs.target-branch || github.base_ref || github.event.merge_group.base_ref || github.ref }}
@@ -140,8 +137,7 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- # Skip the regular build and its dependent build/test jobs on the daily C++20 schedule.
- if: ${{ !needs.smart_ci.outputs.skip_workflow && github.event.schedule != '0 2 * * *' }}
+ if: ${{ !needs.smart_ci.outputs.skip_workflow }}
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
@@ -171,33 +167,6 @@ jobs:
-DENABLE_WHEEL=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- # Non-blocking C++20 compile check (CVS-189849): daily or dispatched workflows.
- # Promote to a required pre-commit check once stable.
- Build_CPP20:
- name: Build (C++20, non-blocking)
- needs: [Docker, Smart_CI]
- if: >-
- ${{
- !needs.smart_ci.outputs.skip_workflow &&
- (github.event.schedule == '0 2 * * *' || github.event_name == 'workflow_dispatch')
- }}
- uses: ./.github/workflows/job_build_linux_cpp20.yml
- with:
- runner: 'aks-linux-16-cores-32gb'
- cmake-build-parallel-level: '15'
- image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_22_04_x64 }}
- os: 'ubuntu_22_04'
- cmake-options: >-
- -G 'Ninja Multi-Config'
- -DENABLE_NCC_STYLE=OFF
- -DENABLE_TESTS=ON
- -DENABLE_STRICT_DEPENDENCIES=OFF
- -DENABLE_SYSTEM_OPENCL=ON
- -DENABLE_OV_GGUF_FRONTEND=ON
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- -DCMAKE_CXX_STANDARD=20
-
Debian_Packages:
name: Debian Packages
needs: [Docker, Build]
diff --git a/.github/workflows/ubuntu_24.yml b/.github/workflows/ubuntu_24.yml
index a3c21dde429..89b3ea78d64 100644
--- a/.github/workflows/ubuntu_24.yml
+++ b/.github/workflows/ubuntu_24.yml
@@ -1,11 +1,9 @@
name: Linux (Ubuntu 24.04, Python 3.12)
-run-name: ${{ github.event_name == 'schedule' && (github.event.schedule == '0 2 * * *' && 'Linux (Ubuntu 24.04, Python 3.12) - Nightly (C++20 build only)' || 'Linux (Ubuntu 24.04, Python 3.12) - Nightly') || 'Linux (Ubuntu 24.04, Python 3.12)' }}
+run-name: ${{ github.event_name == 'schedule' && 'Linux (Ubuntu 24.04, Python 3.12) - Nightly' || 'Linux (Ubuntu 24.04, Python 3.12)' }}
on:
schedule:
# at 00:00 on Wednesday and Saturday (with latest OneDNN)
- cron: '0 0 * * 3,6'
- # at 02:00 every day: C++20 build without the regular build and tests
- - cron: '0 2 * * *'
workflow_dispatch:
inputs:
target-branch:
@@ -98,8 +96,7 @@ jobs:
Build:
needs: [Docker, Smart_CI]
- # Skip the regular build and its dependent build/test jobs on the daily C++20 schedule.
- if: ${{ !needs.smart_ci.outputs.skip_workflow && github.event.schedule != '0 2 * * *' }}
+ if: ${{ !needs.smart_ci.outputs.skip_workflow }}
uses: ./.github/workflows/job_build_linux.yml
with:
runner: 'aks-linux-16-cores-32gb'
@@ -127,33 +124,6 @@ jobs:
-DCPACK_GENERATOR=TGZ
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- # Non-blocking C++20 compile check (CVS-189849): daily or dispatched workflows.
- # Promote to a required pre-commit check once stable.
- Build_CPP20:
- name: Build (C++20, non-blocking)
- needs: [Docker, Smart_CI]
- if: >-
- ${{
- !needs.smart_ci.outputs.skip_workflow &&
- (github.event.schedule == '0 2 * * *' || github.event_name == 'workflow_dispatch')
- }}
- uses: ./.github/workflows/job_build_linux_cpp20.yml
- with:
- runner: 'aks-linux-16-cores-32gb'
- cmake-build-parallel-level: '15'
- image: ${{ fromJSON(needs.docker.outputs.images).ov_build.ubuntu_24_04_x64 }}
- os: 'ubuntu_24_04'
- cmake-options: >-
- -G 'Ninja Multi-Config'
- -DENABLE_NCC_STYLE=OFF
- -DENABLE_TESTS=ON
- -DENABLE_OV_GGUF_FRONTEND=ON
- -DENABLE_STRICT_DEPENDENCIES=OFF
- -DENABLE_SYSTEM_OPENCL=ON
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- -DCMAKE_CXX_STANDARD=20
-
CXX_Unit_Tests:
name: C++ unit tests
needs: [ Docker, Build, Smart_CI ]
diff --git a/.github/workflows/windows_conditional_compilation.yml b/.github/workflows/windows_conditional_compilation.yml
index e23cd26b097..2a1bb34cccd 100644
--- a/.github/workflows/windows_conditional_compilation.yml
+++ b/.github/workflows/windows_conditional_compilation.yml
@@ -160,7 +160,6 @@ jobs:
run: |
cmake -G "${{ env.CMAKE_GENERATOR }}" `
-DBUILD_SHARED_LIBS=OFF `
- -DCMAKE_CXX_STANDARD=20 `
-DENABLE_TESTS=ON `
-DENABLE_NCC_STYLE=OFF `
-DENABLE_PROFILING_ITT=FULL `
diff --git a/.github/workflows/windows_vs2022_release.yml b/.github/workflows/windows_vs2022_release.yml
index c7dc50cf63b..bdc6b653ebc 100644
--- a/.github/workflows/windows_vs2022_release.yml
+++ b/.github/workflows/windows_vs2022_release.yml
@@ -1,9 +1,5 @@
name: Windows (VS 2022, Python 3.11, Release)
-run-name: ${{ github.event_name == 'schedule' && 'Windows (VS 2022, Python 3.11, Release) - Nightly (C++20 build only)' || 'Windows (VS 2022, Python 3.11, Release)' }}
on:
- schedule:
- # at 02:00 every day: C++20 build without the regular build and tests
- - cron: '0 2 * * *'
workflow_dispatch:
inputs:
target-branch:
@@ -68,8 +64,7 @@ jobs:
Build:
needs: [ Smart_CI ]
- # Skip the regular build and its dependent build/test jobs on the daily C++20 schedule.
- if: ${{ !needs.smart_ci.outputs.skip_workflow && github.event.schedule != '0 2 * * *' }}
+ if: ${{ !needs.smart_ci.outputs.skip_workflow }}
uses: ./.github/workflows/job_build_windows.yml
with:
runner: 'aks-win-16-cores-32gb-build'
@@ -91,35 +86,6 @@ jobs:
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DFETCHCONTENT_BASE_DIR="C:\fcc\ninja_multi_config"
- # Non-blocking C++20 compile check (CVS-189849): daily or dispatched workflows.
- # Promote to a required pre-commit check once stable.
- Build_CPP20:
- name: Build (C++20, non-blocking)
- needs: [ Smart_CI ]
- if: >-
- ${{
- !needs.smart_ci.outputs.skip_workflow &&
- (github.event.schedule == '0 2 * * *' || github.event_name == 'workflow_dispatch')
- }}
- uses: ./.github/workflows/job_build_windows_cpp20.yml
- with:
- runner: 'aks-win-16-cores-32gb-build'
- cmake-build-parallel-level: '15'
- build-type: 'Release'
- target-branch: ${{ needs.smart_ci.outputs.target_branch }}
- cmake-options: >-
- -G 'Ninja Multi-Config'
- -DENABLE_PYTHON=ON
- -DENABLE_WHEEL=OFF
- -DENABLE_TESTS=ON
- -DENABLE_OV_GGUF_FRONTEND=ON
- -DCMAKE_COMPILE_WARNING_AS_ERROR=ON
- -DENABLE_STRICT_DEPENDENCIES=OFF
- -DCMAKE_DISABLE_FIND_PACKAGE_PkgConfig=ON
- -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- -DFETCHCONTENT_BASE_DIR="C:\fcc\ninja_multi_config_cpp20"
- -DCMAKE_CXX_STANDARD=20
-
Samples:
needs: [ Build, Smart_CI ]
if: fromJSON(needs.smart_ci.outputs.affected_components).samples
diff --git a/cmake/developer_package/compile_flags/cxx_standard.cmake b/cmake/developer_package/compile_flags/cxx_standard.cmake
index 076f99d3adb..9b612113c87 100644
--- a/cmake/developer_package/compile_flags/cxx_standard.cmake
+++ b/cmake/developer_package/compile_flags/cxx_standard.cmake
@@ -8,9 +8,6 @@ if(NOT CMAKE_CXX_STANDARD GREATER_EQUAL 20)
return()
endif()
-if(NOT DEFINED OV_CXX_STANDARD_FALLBACK)
- set(OV_CXX_STANDARD_FALLBACK 17)
-endif()
# OpenVINO has no C++20 named modules; this scanning only costs a version-matched
# clang-scan-deps (CMP0155/CMake 3.28+) that may not exist in every toolchain/image.
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28 AND NOT DEFINED CMAKE_CXX_SCAN_FOR_MODULES)
@@ -18,7 +15,7 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.28 AND NOT DEFINED CMAKE_CXX_SCAN_FOR_M
endif()
# CVS-190125: raise the GNU floor (currently 10) once OpenVINO drops the OSes that
-# ship it (e.g. RHEL 8) as part of the 2027.0 C++20 default switch.
+# ship it (e.g. RHEL 8).
set(_ov_cxx20_floor_GNU 10)
set(_ov_cxx20_floor_Clang 14)
set(_ov_cxx20_floor_AppleClang 13)
@@ -67,14 +64,8 @@ if(NOT _ov_cxx20_error)
endif()
if(_ov_cxx20_error)
- # only a defaulted standard may fall back, an explicit request must fail
- if(OV_CXX_STANDARD_IS_DEFAULT)
- message(STATUS "${_ov_cxx20_error}. Falling back to C++${OV_CXX_STANDARD_FALLBACK}")
- set(CMAKE_CXX_STANDARD ${OV_CXX_STANDARD_FALLBACK})
- else()
- message(FATAL_ERROR
- "${_ov_cxx20_error} (CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} was requested)")
- endif()
+ message(FATAL_ERROR
+ "${_ov_cxx20_error} (CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD})")
endif()
unset(_ov_cxx20_error)
diff --git a/cmake/developer_package/compile_flags/os_flags.cmake b/cmake/developer_package/compile_flags/os_flags.cmake
index f170fea415e..d07b9463f27 100644
--- a/cmake/developer_package/compile_flags/os_flags.cmake
+++ b/cmake/developer_package/compile_flags/os_flags.cmake
@@ -13,11 +13,10 @@ if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
endif()
# the only place to change the project default standard
-set(OV_CXX_STANDARD_DEFAULT 17)
+set(OV_CXX_STANDARD_DEFAULT 20)
# to allows to override CMAKE_CXX_STANDARD from command line
if(NOT DEFINED CMAKE_CXX_STANDARD)
- set(OV_CXX_STANDARD_IS_DEFAULT ON)
set(CMAKE_CXX_STANDARD ${OV_CXX_STANDARD_DEFAULT})
endif()
diff --git a/cmake/extra_modules.cmake b/cmake/extra_modules.cmake
index 2e447a68d1c..a443027eff6 100644
--- a/cmake/extra_modules.cmake
+++ b/cmake/extra_modules.cmake
@@ -49,7 +49,7 @@ function(ov_generate_dev_package_config)
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in"
- "${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig-version.cmake"
+ "${CMAKE_BINARY_DIR}/OpenVINODeveloperPackageConfig-version.cmake"
@ONLY)
#
@@ -68,7 +68,7 @@ function(ov_generate_dev_package_config)
NO_CHECK_REQUIRED_COMPONENTS_MACRO)
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in"
- "${OpenVINO_BINARY_DIR}/share/OpenVINODeveloperPackageConfig-version.cmake"
+ "${OpenVINO_BINARY_DIR}/share/OpenVINODeveloperPackageConfig-version.cmake"
@ONLY)
install(FILES "${OpenVINO_BINARY_DIR}/share/OpenVINODeveloperPackageConfig.cmake"
@@ -130,7 +130,7 @@ endif()\n")
endforeach()
configure_file("${OpenVINO_SOURCE_DIR}/cmake/templates/OpenVINOConfig-version.cmake.in"
- "${OpenVINODeveloperPackage_DIR}/OpenVINODeveloperPackageConfig-version.cmake"
+ "${OpenVINODeveloperPackage_DIR}/OpenVINODeveloperPackageConfig-version.cmake"
@ONLY)
endfunction()
@@ -142,8 +142,11 @@ endif()\n")
get_filename_component(module_path "${module_path}" ABSOLUTE)
if(EXISTS "${module_path}/CMakeLists.txt")
list(APPEND extra_modules "${module_path}")
+ list(APPEND user_extra_modules "${module_path}")
elseif(module_path)
- file(GLOB extra_modules ${extra_modules} "${module_path}/*")
+ file(GLOB module_subdirs "${module_path}/*")
+ list(APPEND extra_modules ${module_subdirs})
+ list(APPEND user_extra_modules ${module_subdirs})
endif()
endforeach()
@@ -171,7 +174,16 @@ endif()\n")
endif()
if(BUILD_${module_name})
message(STATUS "Register ${module_name} to be built in build-modules/${module_name}")
+ set(_ov_saved_cxx_flags "${CMAKE_CXX_FLAGS}")
+ # External modules may still assign u8"" literals to std::string, which C++20 char8_t forbids.
+ # CVS-199298/CVS-199299: remove this shim once GenAI and openvino_contrib (the current
+ # OPENVINO_EXTRA_MODULES consumers) migrate to C++20 and no longer need it.
+ if(CMAKE_CXX_STANDARD GREATER_EQUAL 20 AND module_path IN_LIST user_extra_modules
+ AND (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang"))
+ string(APPEND CMAKE_CXX_FLAGS " -fno-char8_t")
+ endif()
add_subdirectory("${module_path}" "build-modules/${module_name}")
+ set(CMAKE_CXX_FLAGS "${_ov_saved_cxx_flags}")
endif()
endif()
endforeach()
diff --git a/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst b/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst
index 6cd27cb8c63..1cbed47ef1e 100644
--- a/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst
+++ b/docs/articles_en/about-openvino/release-notes-openvino/system-requirements.rst
@@ -190,10 +190,10 @@ to learn more about the release types.
* GCC 11.3.0 (for Ubuntu 22.04), GCC 13.2.0 (for Ubuntu 24.04) or GCC 15.2.0 (for Ubuntu 26.04)
- .. tab-item:: RHEL 8
- :sync: rhel-8
+ .. tab-item:: RHEL 9
+ :sync: rhel-9
- * GCC 8.4.1
+ * GCC 11
.. tab-item:: macOS
:name: archive-mac-sysreq
diff --git a/docs/dev/build_linux.md b/docs/dev/build_linux.md
index d714f4b4661..01465f4ca5f 100644
--- a/docs/dev/build_linux.md
+++ b/docs/dev/build_linux.md
@@ -10,7 +10,7 @@ build OpenVINO, but are not covered by the current CI matrix.
## Software requirements
- [CMake](https://cmake.org/download/) 3.26 or higher
-- GCC 7.5 or higher to build OpenVINO Runtime
+- GCC 10 or higher to build OpenVINO Runtime with its C++20 standard
- Python 3.11 - 3.15 for OpenVINO Runtime Python API
- (Optional) Install Intel® Graphics Compute Runtime for OpenCL™ Driver package to enable inference on Intel integrated GPUs.
diff --git a/docs/dev/build_mac_arm.md b/docs/dev/build_mac_arm.md
index 64271595128..0cdcc492262 100644
--- a/docs/dev/build_mac_arm.md
+++ b/docs/dev/build_mac_arm.md
@@ -24,7 +24,7 @@ The software was:
```
- **x86_64** Select universal2 installer from [Python releases](https://www.python.org/downloads/macos/) download page and install `python-3.X.Y-macos11.pkg` image. This allows you to have universal python libraries of OpenVINO Python API (build x86_64).
-- Clang compiler and other command line tools from Xcode 10.1 or higher:
+- Clang compiler and other command line tools from Xcode 13.0 or higher:
```sh
% xcode-select --install
```
diff --git a/docs/dev/build_mac_intel_cpu.md b/docs/dev/build_mac_intel_cpu.md
index 3da7aed6754..8529f7eefbc 100644
--- a/docs/dev/build_mac_intel_cpu.md
+++ b/docs/dev/build_mac_intel_cpu.md
@@ -25,7 +25,7 @@ The x86_64 native and cross-compilation paths described in this guide are not ex
```sh
% brew install cmake scons fdupes git-lfs ninja
```
-- Clang compiler and other command line tools from Xcode 10.1 or higher:
+- Clang compiler and other command line tools from Xcode 13.0 or higher:
```sh
% xcode-select --install
```
diff --git a/docs/dev/build_riscv64.md b/docs/dev/build_riscv64.md
index 03f12c2bd94..e74005b1b61 100644
--- a/docs/dev/build_riscv64.md
+++ b/docs/dev/build_riscv64.md
@@ -13,7 +13,8 @@ The software was validated on the following devices:
## Software requirements
- [CMake](https://cmake.org/download/) 3.26 or higher
-- GCC 7.5 or higher (for non-RVV) / [riscv-gnu-toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain.git) (for RVV)
+- GCC 10 or higher (for non-RVV) /
+ [riscv-gnu-toolchain](https://github.com/riscv-collab/riscv-gnu-toolchain.git) (for RVV)
- Python 3.12 for the optional OpenVINO Runtime Python API cross-build described below
## How to build
@@ -57,7 +58,7 @@ Currently, there are two ways to build OpenVINO Runtime for 64-bit RISC-V platfo
3. Create a build folder:
```sh
mkdir build && cd build
- ```
+ ```
4. To cross compile OpenVINO Runtime for RISC-V devices, run `cmake` with specified `CMAKE_TOOLCHAIN_FILE` and `RISCV_TOOLCHAIN_ROOT` (the last one is needed only for build using GNU toolchain).
- For target with RVV intrinsics using `riscv-gnu-toolchain`:
@@ -68,7 +69,7 @@ Currently, there are two ways to build OpenVINO Runtime for 64-bit RISC-V platfo
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/riscv64-gnu.toolchain.cmake \
-DRISCV_TOOLCHAIN_ROOT=/opt/riscv
```
- > **NOTE**: The `riscv-gnu-toolchain` is build as there are essential files used for cross compilation under `/opt/riscv/sysroot`. The latest stable versions of Clang or GCC both support compiling source code into RISC-V instructions, so it is acceptable to choose your preferable compilers by specifying `-DCMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER`. But remember to add the key `-DCMAKE_SYSROOT=/opt/riscv/sysroot`, otherwise many fundamental headers and libs could not be found during cross compilation.
+ > **NOTE**: The `riscv-gnu-toolchain` is build as there are essential files used for cross compilation under `/opt/riscv/sysroot`. The latest stable versions of Clang or GCC both support compiling source code into RISC-V instructions, so it is acceptable to choose your preferable compilers by specifying `-DCMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER`. But remember to add the key `-DCMAKE_SYSROOT=/opt/riscv/sysroot`, otherwise many fundamental headers and libs could not be found during cross compilation.
- For target without optimized primitives using installed Linux packages:
```sh
cmake .. \
@@ -85,7 +86,7 @@ Currently, there are two ways to build OpenVINO Runtime for 64-bit RISC-V platfo
### (Optional) Build the OpenVINO Runtime Python API
To enable cross-compilation with python, the library `libpython3-dev:riscv64` should be on the host machine.
-When installing packages using the utilities `apt` or `apt-get` the packages are downloaded from apt software repositories. On Ubuntu the apt software repositories are defined in the `/etc/apt/sources.list` file or in separate files under the `/etc/apt/sources.list.d/` directory. Host machine contains host-specific repositories (for example, x86-x64) in these files.
+When installing packages using the utilities `apt` or `apt-get` the packages are downloaded from apt software repositories. On Ubuntu the apt software repositories are defined in the `/etc/apt/sources.list` file or in separate files under the `/etc/apt/sources.list.d/` directory. Host machine contains host-specific repositories (for example, x86-x64) in these files.
1. Add riscv64 repositories to download riscv64-specific packages:
```sh
diff --git a/docs/dev/build_windows.md b/docs/dev/build_windows.md
index 3f729b524c4..6f8aac8c8be 100644
--- a/docs/dev/build_windows.md
+++ b/docs/dev/build_windows.md
@@ -12,7 +12,7 @@ Visual Studio 2019 remains the documented minimum but is not exercised by the cu
## Software requirements
- [CMake](https://cmake.org/download/) 3.26 or higher
-- Microsoft Visual Studio 2019 or higher, version 16.3 or later
+- Microsoft Visual Studio 2019 or higher, version 16.8 or later (MSVC 19.28, required for C++20)
> **NOTE**: Native Microsoft Visual Studio for WoA has been available since version 3.11.
- Python 3.11 - 3.15 for OpenVINO Runtime Python API
- [Git for Windows*]
diff --git a/docs/dev/ci/github_actions/caches.md b/docs/dev/ci/github_actions/caches.md
index f271bad8c87..f049d8445ec 100644
--- a/docs/dev/ci/github_actions/caches.md
+++ b/docs/dev/ci/github_actions/caches.md
@@ -134,8 +134,7 @@ Users:
* The RISC-V GNU and Conan builds in [`linux_riscv.yml`](./../../../../.github/workflows/linux_riscv.yml)
and [`linux_riscv_conan.yml`](./../../../../.github/workflows/linux_riscv_conan.yml).
* The Windows builds in
- [`job_build_windows.yml`](./../../../../.github/workflows/job_build_windows.yml),
- [`job_build_windows_cpp20.yml`](./../../../../.github/workflows/job_build_windows_cpp20.yml) and
+ [`job_build_windows.yml`](./../../../../.github/workflows/job_build_windows.yml) and
[`windows_conditional_compilation.yml`](./../../../../.github/workflows/windows_conditional_compilation.yml).
ccache cannot cache MSVC compilations with a separate PDB (`/Zi`), so the Windows Debug build
diff --git a/docs/snippets/CMakeLists.txt b/docs/snippets/CMakeLists.txt
index 389de6a07fa..3afbc8515e3 100644
--- a/docs/snippets/CMakeLists.txt
+++ b/docs/snippets/CMakeLists.txt
@@ -103,7 +103,9 @@ endif()
set(TARGET_NAME "ov_integration_snippet")
# [cmake:integration_example_cpp]
cmake_minimum_required(VERSION 3.10)
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
find_package(OpenVINO REQUIRED)
@@ -116,7 +118,9 @@ target_link_libraries(${TARGET_NAME} PRIVATE openvino::runtime)
set(TARGET_NAME_PY "ov_integration_snippet_py")
# [cmake:integration_example_cpp_py]
cmake_minimum_required(VERSION 3.10)
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
if(NOT CMAKE_CROSSCOMPILING)
find_package(Python3 QUIET COMPONENTS Interpreter)
@@ -139,7 +143,9 @@ target_link_libraries(${TARGET_NAME_PY} PRIVATE openvino::runtime)
set(TARGET_NAME_C "ov_integration_snippet_c")
# [cmake:integration_example_c]
cmake_minimum_required(VERSION 3.10)
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
find_package(OpenVINO REQUIRED)
diff --git a/samples/c/common/opencv_c_wrapper/CMakeLists.txt b/samples/c/common/opencv_c_wrapper/CMakeLists.txt
index 6efd2f87133..ace0f65d92a 100644
--- a/samples/c/common/opencv_c_wrapper/CMakeLists.txt
+++ b/samples/c/common/opencv_c_wrapper/CMakeLists.txt
@@ -25,6 +25,8 @@ if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
else()
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
target_link_libraries(${TARGET_NAME} PRIVATE ${OpenCV_LIBRARIES})
+ # OpenCV headers do enum arithmetic that C++20 deprecates; treat them as system headers
+ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})
endif()
target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include"
diff --git a/samples/cpp/CMakeLists.txt b/samples/cpp/CMakeLists.txt
index 4e588e56e3c..f7942fa8fcc 100644
--- a/samples/cpp/CMakeLists.txt
+++ b/samples/cpp/CMakeLists.txt
@@ -99,9 +99,9 @@ if(ARM AND NOT (CMAKE_CROSSCOMPILING OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"))
endif()
####################################
-## to use C++11; can overwritten via cmake command line
+## default C++ standard; can be overwritten via cmake command line
if(NOT DEFINED CMAKE_CXX_STANDARD)
- set (CMAKE_CXX_STANDARD 17)
+ set (CMAKE_CXX_STANDARD 20)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
@@ -115,6 +115,7 @@ if(CMAKE_CXX_STANDARD GREATER_EQUAL 20)
set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
endif()
+ # kept in sync with cmake/developer_package/compile_flags/cxx_standard.cmake
set(_ov_samples_cxx20_floor_GNU 10)
set(_ov_samples_cxx20_floor_Clang 14)
set(_ov_samples_cxx20_floor_AppleClang 13)
diff --git a/samples/cpp/benchmark_app/CMakeLists.txt b/samples/cpp/benchmark_app/CMakeLists.txt
index 0c290e02c7b..c366097d8f5 100644
--- a/samples/cpp/benchmark_app/CMakeLists.txt
+++ b/samples/cpp/benchmark_app/CMakeLists.txt
@@ -126,4 +126,6 @@ if(NOT OpenCV_FOUND OR NOT OpenCV_VERSION VERSION_GREATER_EQUAL 3)
else()
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
target_link_libraries(${TARGET_NAME} PRIVATE opencv_core)
+ # OpenCV headers do enum arithmetic that C++20 deprecates; treat them as system headers
+ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})
endif()
diff --git a/samples/cpp/common/format_reader/CMakeLists.txt b/samples/cpp/common/format_reader/CMakeLists.txt
index 39ea5f5655b..501a6304a7c 100644
--- a/samples/cpp/common/format_reader/CMakeLists.txt
+++ b/samples/cpp/common/format_reader/CMakeLists.txt
@@ -45,6 +45,8 @@ else()
target_link_libraries(${TARGET_NAME} INTERFACE "-Wl,-rpath-link,${OpenCV_INSTALL_PATH}/lib")
endif()
target_compile_definitions(${TARGET_NAME} PRIVATE USE_OPENCV)
+ # OpenCV headers do enum arithmetic that C++20 deprecates; treat them as system headers
+ target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})
endif()
target_include_directories(${TARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
diff --git a/src/bindings/js/node/CMakeLists.txt b/src/bindings/js/node/CMakeLists.txt
index 7bedf58ea2f..3d8c763563b 100644
--- a/src/bindings/js/node/CMakeLists.txt
+++ b/src/bindings/js/node/CMakeLists.txt
@@ -26,7 +26,9 @@ cmake_minimum_required(VERSION 3.14)
project(ov_node_addon)
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
add_definitions(-DNAPI_VERSION=8)
include(FetchContent)
diff --git a/src/common/snippets/.clang-tidy b/src/common/snippets/.clang-tidy
index 044e9edf61f..769f0c0ab65 100644
--- a/src/common/snippets/.clang-tidy
+++ b/src/common/snippets/.clang-tidy
@@ -40,6 +40,11 @@
# Remove warning disablement after CI pipeline migrates to C++17 from C++20 for:
# -modernize-use-constraints,
# -modernize-use-std-numbers
+# TODO: C++20 default exposed new findings; fix the code and re-enable:
+# -modernize-loop-convert,
+# -modernize-use-equals-default,
+# -modernize-use-starts-ends-with,
+# -readability-container-contains
Checks: >
-*,
@@ -74,6 +79,10 @@ Checks: >
-modernize-use-trailing-return-type,
-modernize-use-constraints,
-modernize-use-std-numbers,
+ -modernize-loop-convert,
+ -modernize-use-equals-default,
+ -modernize-use-starts-ends-with,
+ -readability-container-contains,
-misc-const-correctness,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
@@ -99,10 +108,10 @@ CheckOptions:
value: true
- key: modernize-use-default-member-init.UseAssignment
value: true
- # matches with corresponding cpplink check
+ # matches with corresponding cpplink check
- key: google-readability-namespace-comments.ShortNamespaceLines
value: "10"
- # matches with corresponding cpplink check
+ # matches with corresponding cpplink check
- key: google-readability-namespace-comments.SpacesBeforeComments
value: "2"
- key: modernize-loop-convert.MinConfidence
diff --git a/src/common/transformations/docs/writing_transformations.md b/src/common/transformations/docs/writing_transformations.md
index 084105f4ce0..3422364dd7e 100644
--- a/src/common/transformations/docs/writing_transformations.md
+++ b/src/common/transformations/docs/writing_transformations.md
@@ -124,7 +124,11 @@ ov::pass::MyFusion::MyFusion() {
`MATCHER_SCOPE` / `RUN_ON_MODEL_SCOPE` are mandatory: they provide the ITT domain name used by transformation profiling and allow the pass to be excluded from conditionally-compiled builds.
-Use `OV_CAPTURE_CPY_AND_THIS` in the callback lambda capture list instead of `[=]` or `[&]`.
+Use `OV_CAPTURE_CPY_AND_THIS` in the callback lambda capture list instead of `[=]` or `[&]`,
+unless the callback body never touches `this`/a member (e.g. it only uses captured-by-value
+locals or constructor parameters) — then use plain `[=]`. `OV_CAPTURE_CPY_AND_THIS` expands to
+`[=, this]` under C++20, and an unused `this` there is a hard error
+(`-Werror=unused-lambda-capture`) on GCC/Clang.
A few mechanics are worth remembering:
diff --git a/src/common/transformations/src/transformations/paged_attention/position_ids_replacer.cpp b/src/common/transformations/src/transformations/paged_attention/position_ids_replacer.cpp
index 53592692122..7555daa7839 100644
--- a/src/common/transformations/src/transformations/paged_attention/position_ids_replacer.cpp
+++ b/src/common/transformations/src/transformations/paged_attention/position_ids_replacer.cpp
@@ -375,7 +375,7 @@ ov::pass::PositionIDsReplacerGranite::PositionIDsReplacerGranite(const Output<No
auto p_angles = wrap_type<v0::Concat>({p_transpose, p_transpose});
auto p_sin_cos = wrap_type<v0::Sin, v0::Cos>({p_angles});
- matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](Matcher& m) {
+ matcher_pass_callback callback = [=](Matcher& m) {
const auto& pattern_map = m.get_pattern_map();
pattern_map.at(p_positions_heads)->input(0).replace_source_output(unsq_position_ids);
return true;
@@ -400,7 +400,7 @@ ov::pass::PositionIDsReplacerQwen3_5::PositionIDsReplacerQwen3_5(const Output<No
auto p_matmul = wrap_type<v0::MatMul>({p_inv_freq, p_convert});
auto p_transpose = wrap_type<v1::Transpose>({p_matmul, any_input()});
- matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](Matcher& m) {
+ matcher_pass_callback callback = [=](Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();
const auto broadcast = pattern_map.at(p_broadcast).get_node_shared_ptr();
diff --git a/src/common/util/include/openvino/util/cpp_version.hpp b/src/common/util/include/openvino/util/cpp_version.hpp
index ded12d9fe3d..2a6b0d7bf76 100644
--- a/src/common/util/include/openvino/util/cpp_version.hpp
+++ b/src/common/util/include/openvino/util/cpp_version.hpp
@@ -13,7 +13,7 @@
# define OPENVINO_CPP_VER_AT_LEAST_14
# if __cplusplus >= 201703L
# define OPENVINO_CPP_VER_AT_LEAST_17
-# if __cplusplus >= 202002L
+# if __cplusplus > 201703L // GCC 10 reports 201709L for -std=c++2a/c++20
# define OPENVINO_CPP_VER_AT_LEAST_20
# if __cplusplus >= 202302L
# define OPENVINO_CPP_VER_AT_LEAST_23
diff --git a/src/common/util/include/openvino/util/pp.hpp b/src/common/util/include/openvino/util/pp.hpp
index bb4a3ace969..9e6b0016a92 100644
--- a/src/common/util/include/openvino/util/pp.hpp
+++ b/src/common/util/include/openvino/util/pp.hpp
@@ -55,10 +55,10 @@
/* This macro is intended to fix C++20 [=] lambda
warning. Although C++20 identifier is 202002L,
some compilers supporting C++20, or their drafts like
-C++2a, producing the warning, are using 201402L value.
+C++2a (e.g. GCC 10 reports 201709L), producing the warning, are using values greater than C++17's 201703L.
Also, MSVC requires a special check due to the
__cplusplus value compatibility issues.*/
-#if (defined(_MSVC_LANG) && (_MSVC_LANG >= 202002L)) || (__cplusplus >= 202002L)
+#if (defined(_MSVC_LANG) && (_MSVC_LANG >= 202002L)) || (__cplusplus > 201703L)
# define OV_CAPTURE_CPY_AND_THIS =, this
#else
# define OV_CAPTURE_CPY_AND_THIS =
diff --git a/src/core/include/openvino/core/visibility.hpp b/src/core/include/openvino/core/visibility.hpp
index b5e6e18ceed..6625ec9bb45 100644
--- a/src/core/include/openvino/core/visibility.hpp
+++ b/src/core/include/openvino/core/visibility.hpp
@@ -85,7 +85,7 @@
# define OPENVINO_CPP_VER_AT_LEAST_14
# if __cplusplus >= 201703L
# define OPENVINO_CPP_VER_AT_LEAST_17
-# if __cplusplus >= 202002L
+# if __cplusplus > 201703L // GCC 10 reports 201709L for -std=c++2a/c++20
# define OPENVINO_CPP_VER_AT_LEAST_20
# if __cplusplus >= 202302L
# define OPENVINO_CPP_VER_AT_LEAST_23
diff --git a/src/core/template_extension/CMakeLists.txt b/src/core/template_extension/CMakeLists.txt
index 0f782433f31..d661c6b3f39 100644
--- a/src/core/template_extension/CMakeLists.txt
+++ b/src/core/template_extension/CMakeLists.txt
@@ -3,7 +3,9 @@
#
# [cmake:extension]
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
set(TARGET_NAME "openvino_template_extension")
diff --git a/src/frontends/gguf/tests/test_parser.cpp b/src/frontends/gguf/tests/test_parser.cpp
index 43dc5e3b695..58e0a3deac8 100644
--- a/src/frontends/gguf/tests/test_parser.cpp
+++ b/src/frontends/gguf/tests/test_parser.cpp
@@ -729,7 +729,7 @@ TEST_F(GGUFShards, FrontendConvertsTheSameConstantsFromSingleFileAndShardInputs)
EXPECT_TRUE(comparison.valid) << comparison.message;
}
auto unicode_prefix = ov::util::make_path(m_base);
- unicode_prefix += ov::util::make_path(u8"_模型_żółć");
+ unicode_prefix += ov::util::make_path(reinterpret_cast<const char*>(u8"_模型_żółć"));
const auto unicode_first =
std::filesystem::path(unicode_prefix.native() + std::filesystem::path("-00001-of-00002.gguf").native());
const auto unicode_second =
diff --git a/src/plugins/intel_cpu/src/.clang-tidy b/src/plugins/intel_cpu/src/.clang-tidy
index 262006a28cf..a79b78636d3 100644
--- a/src/plugins/intel_cpu/src/.clang-tidy
+++ b/src/plugins/intel_cpu/src/.clang-tidy
@@ -26,7 +26,7 @@
# -misc-const-correctness. No big reason to enforce
# -misc-no-recursion. No big reason to enforce
# -readability-identifier-length. A lot of code use short names for readability, i.e. 'B' for batch
-# -readability-uppercase-literal-suffix.
+# -readability-uppercase-literal-suffix.
#
### Checks that are turned off but better be enabled later:
# -bugprone-easily-swappable-parameters
@@ -48,6 +48,11 @@
# Remove warning disablement after CI pipeline migrates to C++17 from C++20 for:
# -modernize-use-constraints,
# -modernize-use-std-numbers
+# TODO: C++20 default exposed new findings; fix the code and re-enable:
+# -modernize-loop-convert,
+# -modernize-use-equals-default,
+# -modernize-use-starts-ends-with,
+# -readability-container-contains
Checks: >
-*,
@@ -87,6 +92,10 @@ Checks: >
-modernize-avoid-c-arrays,
-modernize-use-constraints,
-modernize-use-std-numbers,
+ -modernize-loop-convert,
+ -modernize-use-equals-default,
+ -modernize-use-starts-ends-with,
+ -readability-container-contains,
-modernize-use-trailing-return-type,
-misc-header-include-cycle,
-misc-const-correctness,
@@ -115,10 +124,10 @@ CheckOptions:
value: true
- key: modernize-use-default-member-init.UseAssignment
value: true
- # matches with corresponding cpplink check
+ # matches with corresponding cpplink check
- key: google-readability-namespace-comments.ShortNamespaceLines
value: "10"
- # matches with corresponding cpplink check
+ # matches with corresponding cpplink check
- key: google-readability-namespace-comments.SpacesBeforeComments
value: "2"
- key: modernize-loop-convert.MinConfidence
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/clamp_bf16_scalar_constants.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/clamp_bf16_scalar_constants.cpp
index e41eba11dc9..eb1862b8fd9 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/clamp_bf16_scalar_constants.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/clamp_bf16_scalar_constants.cpp
@@ -26,7 +26,6 @@
#include "openvino/pass/pattern/op/label.hpp"
#include "openvino/pass/pattern/op/or.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
-#include "openvino/util/pp.hpp"
namespace ov::intel_cpu {
@@ -55,7 +54,7 @@ ClampBF16ScalarConstants::ClampBF16ScalarConstants() {
wrap_type<ov::op::v1::Multiply, ov::op::v1::Add, ov::op::v1::Subtract>({overflowing_const_m, any_input()});
auto binary_m = const_second_m | const_first_m;
- ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](Matcher& m) {
+ ov::matcher_pass_callback callback = [=](Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();
const auto constant =
ov::as_type_ptr<ov::op::v0::Constant>(pattern_map.at(overflowing_const_m).get_node_shared_ptr());
diff --git a/src/plugins/intel_cpu/src/utils/cpp/bit_cast.hpp b/src/plugins/intel_cpu/src/utils/cpp/bit_cast.hpp
index 10041eda580..a4b07399f2f 100644
--- a/src/plugins/intel_cpu/src/utils/cpp/bit_cast.hpp
+++ b/src/plugins/intel_cpu/src/utils/cpp/bit_cast.hpp
@@ -6,13 +6,21 @@
#include <cstring>
#include <type_traits>
-#if defined(OPENVINO_CPP_VER_AT_LEAST_20)
+#if defined(__has_include)
+# if __has_include(<version>)
+# include <version>
+# endif
+#endif
+#if defined(__cpp_lib_bit_cast)
# include <bit>
#endif
namespace ov::intel_cpu {
-#if defined(OPENVINO_CPP_VER_AT_LEAST_20)
+// Gated on the library feature-test macro, not OPENVINO_CPP_VER_AT_LEAST_20: with
+// Clang using an older libstdc++ (e.g. from GCC 10), the language standard can be
+// C++20 while std::bit_cast is still missing from the linked standard library.
+#if defined(__cpp_lib_bit_cast)
using std::bit_cast;
#else
template <typename To,
diff --git a/src/plugins/intel_gpu/.clang-tidy b/src/plugins/intel_gpu/.clang-tidy
index 19424534651..ad6e5a3684a 100644
--- a/src/plugins/intel_gpu/.clang-tidy
+++ b/src/plugins/intel_gpu/.clang-tidy
@@ -3,6 +3,9 @@
#
# Readability checks and their options match the CPU plugin configuration.
# 'WarningsAsErrors' is '*' so every enabled check is enforced during the build.
+#
+# C++20 default exposed new findings; fix the code and re-enable:
+# -readability-container-contains
Checks: >
-*,
@@ -16,6 +19,7 @@ Checks: >
modernize-use-equals-default,
modernize-use-equals-delete,
readability-*,
+ -readability-container-contains,
-readability-function-cognitive-complexity,
-readability-identifier-length,
-readability-isolate-declaration,
diff --git a/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp b/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
index a2315465266..3135c53c25f 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
@@ -176,7 +176,7 @@ public:
const stream& get_stream() const { return *_stream; }
const std::list<primitive_id>& get_optimized_out() const { return optimized_out; }
const std::list<optimized_info>& get_optimized() const { return optimized; }
- bool has_node(const primitive_id& prim) const { return nodes_map.count(prim) > 0; }
+ bool has_node(const primitive_id& prim) const { return nodes_map.contains(prim); }
program_node& get_node(primitive_id const& id);
program_node const& get_node(primitive_id const& id) const;
std::shared_ptr<program_node> get_node_ptr(const primitive_id& prim) { return nodes_map.at(prim); }
@@ -301,7 +301,7 @@ public:
}
bool has_static_impl_type(primitive_type_id type) const {
std::lock_guard<std::mutex> lock(_static_impl_types_mutex);
- return _static_impl_types.count(type) != 0;
+ return _static_impl_types.contains(type);
}
ICompilationContext& get_compilation_context() const { return *_compilation_context; }
std::shared_ptr<ICompilationContext> get_compilation_context_ptr() const { return _compilation_context; }
diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/primitive.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/primitive.hpp
index 55a560ff713..eec0bdab569 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/primitives/primitive.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/primitive.hpp
@@ -321,7 +321,7 @@ public:
}
auto dependencies_map = get_dependencies_map();
- OPENVINO_ASSERT(dependencies_map.count(idx) > 0,
+ OPENVINO_ASSERT(dependencies_map.contains(idx),
"[GPU] Requested index ",
std::to_string(idx),
" exceeds total dependencies count (",
@@ -344,7 +344,7 @@ public:
}
auto dependencies_map = get_dependencies_map();
- OPENVINO_ASSERT(dependencies_map.count(idx) > 0,
+ OPENVINO_ASSERT(dependencies_map.contains(idx),
"[GPU] Requested index ",
std::to_string(idx),
" exceeds total dependencies count (",
diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp
index 9821cb166e1..5f29f2d5cd3 100644
--- a/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp
+++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/compounds.hpp
@@ -39,7 +39,7 @@ public:
using reference = std::remove_pointer_t<_Ptr>&;
checked_array_iterator() = default;
-
+
checked_array_iterator(const pointer data, const std::size_t size, const std::size_t index = 0) noexcept
: _Myptr(data), _Mysize(size), _Myoff(index) {
_STL_VERIFY(index <= size, "cldnn::checked_array_iterator out of range");
@@ -73,10 +73,10 @@ public:
return *this;
}
- constexpr checked_array_iterator operator++(int) noexcept {
- auto tmp = *this;
- ++(*this);
- return tmp;
+ constexpr checked_array_iterator operator++(int) noexcept {
+ auto tmp = *this;
+ ++(*this);
+ return tmp;
}
constexpr checked_array_iterator& operator--() noexcept {
@@ -86,10 +86,10 @@ public:
return *this;
}
- constexpr checked_array_iterator operator--(int) noexcept {
- auto tmp = *this;
- --(*this);
- return tmp;
+ constexpr checked_array_iterator operator--(int) noexcept {
+ auto tmp = *this;
+ --(*this);
+ return tmp;
}
constexpr checked_array_iterator& operator+=(difference_type n) noexcept {
@@ -98,21 +98,21 @@ public:
return *this;
}
- _NODISCARD constexpr checked_array_iterator operator+(const difference_type n) const noexcept {
+ _NODISCARD constexpr checked_array_iterator operator+(const difference_type n) const noexcept {
auto _Tmp = *this;
_Tmp += n;
return _Tmp;
}
- _NODISCARD friend constexpr checked_array_iterator operator+(const difference_type n, const checked_array_iterator<_Ptr>& it) noexcept {
- return it + n;
+ _NODISCARD friend constexpr checked_array_iterator operator+(const difference_type n, const checked_array_iterator<_Ptr>& it) noexcept {
+ return it + n;
}
- constexpr checked_array_iterator& operator-=(const difference_type n) noexcept {
- return *this += -n;
+ constexpr checked_array_iterator& operator-=(const difference_type n) noexcept {
+ return *this += -n;
}
- _NODISCARD constexpr checked_array_iterator operator-(const difference_type n) const noexcept {
+ _NODISCARD constexpr checked_array_iterator operator-(const difference_type n) const noexcept {
auto _Tmp = *this;
_Tmp -= n;
return _Tmp;
@@ -138,7 +138,7 @@ public:
}
_NODISCARD constexpr bool operator<(const checked_array_iterator& a) const noexcept {
_Compat(a);
- return Myoff < a._Myoff;
+ return _Myoff < a._Myoff;
}
_NODISCARD constexpr bool operator>(const checked_array_iterator& a) const noexcept {
_Compat(a);
diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_opt.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_opt.cpp
index 116ea5a0018..fb27b554451 100644
--- a/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_opt.cpp
+++ b/src/plugins/intel_gpu/src/graph/impls/ocl_v2/sdpa/sdpa_opt.cpp
@@ -48,9 +48,11 @@ bool use_multi_token_stage(const RuntimeParams& params) {
}
// Micro single-token kernel has no key partitions, so it is used for one query row only.
+#ifdef OV_GPU_WITH_ONEDNN_MICROKERNELS
bool single_query_row(const RuntimeParams& params) {
return get_target_seq_len(params) <= 1;
}
+#endif
} // namespace
diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp
index cf9e466153a..5ea3edb9ab5 100644
--- a/src/plugins/intel_gpu/src/plugin/plugin.cpp
+++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp
@@ -357,7 +357,7 @@ ov::SoPtr<ov::IRemoteContext> Plugin::create_context(const ov::AnyMap& remote_pr
std::shared_ptr<RemoteContextImpl> Plugin::get_default_context(const std::string& device_id, bool initialize) const {
auto contexts = get_default_contexts();
- OPENVINO_ASSERT(contexts.count(device_id), "[GPU] Context was not initialized for ", device_id, " device");
+ OPENVINO_ASSERT(contexts.contains(device_id), "[GPU] Context was not initialized for ", device_id, " device");
auto context = contexts.at(device_id);
if (initialize) {
@@ -985,7 +985,7 @@ uint32_t Plugin::get_max_batch_size(const ov::AnyMap& options) const {
}
const uint32_t default_streams_for_tput = 2;
- if (options.count(ov::num_streams.name()) > 0) {
+ if (options.contains(ov::num_streams.name())) {
auto streams = options.at(ov::num_streams.name()).as<ov::streams::Num>();
if (streams == ov::streams::AUTO) {
n_streams = std::max(default_streams_for_tput, device_info.num_ccs);
diff --git a/src/plugins/intel_gpu/src/plugin/transformations/decompose_reduce_for_false_keepdims.cpp b/src/plugins/intel_gpu/src/plugin/transformations/decompose_reduce_for_false_keepdims.cpp
index 939bedc752d..06cda9daea2 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations/decompose_reduce_for_false_keepdims.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations/decompose_reduce_for_false_keepdims.cpp
@@ -34,7 +34,7 @@ DecomposeReduceForFalseKeepDims::DecomposeReduceForFalseKeepDims() {
ov::pass::pattern::has_static_shape());
// register callback
- ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher& m) {
+ ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();
auto reduce =
as_type_ptr<op::util::ArithmeticReductionKeepDims>(pattern_map.at(reduce_pattern).get_node_shared_ptr());
diff --git a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
index 56d47982bab..a4871255d24 100644
--- a/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
+++ b/src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp
@@ -2036,9 +2036,11 @@ void TransformationsPipeline::apply(std::shared_ptr<ov::Model> func) {
const bool use_gs128_for_linear_attention = is_hybrid_linear_attention_model(*func);
const bool use_gs128_for_int8_per_token = m_context->get_engine().get_device_info().arch >= cldnn::gpu_arch::xe2;
+ // Read outside the lambda: config is a member, and capturing this is unused in release builds
+ [[maybe_unused]] const int64_t dyn_quan_bisect = GPU_DEBUG_VALUE_OR(config.get_dynamic_quantization_bisect(), 0); // 0 will be ignored from GPU_DEBUG_IF
+ [[maybe_unused]] const int64_t dyn_quan_single = GPU_DEBUG_VALUE_OR(config.get_dynamic_quantization_single(), 0); // 0 will be ignored from GPU_DEBUG_IF
+
pass_config->set_callback<ov::intel_gpu::DynamicQuantizeFullyConnected>([=](const_node_ptr& root) -> bool {
- const int64_t dyn_quan_bisect = GPU_DEBUG_VALUE_OR(config.get_dynamic_quantization_bisect(), 0); // 0 will be ignored from GPU_DEBUG_IF
- const int64_t dyn_quan_single = GPU_DEBUG_VALUE_OR(config.get_dynamic_quantization_single(), 0); // 0 will be ignored from GPU_DEBUG_IF
GPU_DEBUG_IF(dyn_quan_bisect != std::numeric_limits<int64_t>::max() ||
dyn_quan_single >= 0) {
static int64_t fc_count = 0;
diff --git a/src/plugins/intel_npu/CMakeLists.txt b/src/plugins/intel_npu/CMakeLists.txt
index c4c59f84462..78b78d844f1 100644
--- a/src/plugins/intel_npu/CMakeLists.txt
+++ b/src/plugins/intel_npu/CMakeLists.txt
@@ -28,9 +28,9 @@ else()
message(STATUS "The download of Intel NPU Compiler library is skipped!")
endif()
-# to allow overriding CMAKE_CXX_STANDARD from the command line (e.g. the C++20 opt-in CI jobs)
+# fallback in case this directory is ever processed before the top-level default is set
if(NOT DEFINED CMAKE_CXX_STANDARD)
- set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD 20)
endif()
if(ENABLE_NPU_DEBUG_CAPS)
diff --git a/src/plugins/intel_npu/tests/functional/CMakeLists.txt b/src/plugins/intel_npu/tests/functional/CMakeLists.txt
index 2365c588075..5864520352f 100644
--- a/src/plugins/intel_npu/tests/functional/CMakeLists.txt
+++ b/src/plugins/intel_npu/tests/functional/CMakeLists.txt
@@ -70,7 +70,7 @@ if(WIN32)
endif()
set_target_properties(
- ${TARGET_NAME} PROPERTIES CXX_STANDARD 17)
+ ${TARGET_NAME} PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
if(MSVC)
# Enforce standards conformance on MSVC
diff --git a/src/plugins/intel_npu/tools/common/CMakeLists.txt b/src/plugins/intel_npu/tools/common/CMakeLists.txt
index 23e791d132b..a14f2d22216 100644
--- a/src/plugins/intel_npu/tools/common/CMakeLists.txt
+++ b/src/plugins/intel_npu/tools/common/CMakeLists.txt
@@ -16,7 +16,7 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})
add_library(${TARGET_NAME} STATIC EXCLUDE_FROM_ALL ${SOURCES})
set_target_properties(${TARGET_NAME} PROPERTIES
FOLDER intel_npu_tools
- CXX_STANDARD 17)
+ CXX_STANDARD ${CMAKE_CXX_STANDARD})
target_include_directories(${TARGET_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>")
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime)
diff --git a/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt b/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt
index e86c682efa2..6737f61bd05 100644
--- a/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt
+++ b/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt
@@ -33,7 +33,7 @@ ov_add_target(TYPE EXECUTABLE
set_target_properties(${TARGET_NAME} PROPERTIES
FOLDER intel_npu_tools
- CXX_STANDARD 17)
+ CXX_STANDARD ${CMAKE_CXX_STANDARD})
# TODO: fix warnings and remove this exception
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
diff --git a/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake b/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake
index 64a60003987..5d8b3093ffd 100644
--- a/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake
+++ b/src/plugins/intel_npu/tools/compile_tool/cmake/standalone.cmake
@@ -3,7 +3,9 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
diff --git a/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt b/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt
index f21f68be622..fe3ed291b27 100644
--- a/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt
+++ b/src/plugins/intel_npu/tools/protopipe/CMakeLists.txt
@@ -68,7 +68,10 @@ ov_add_target(TYPE EXECUTABLE
set_target_properties(${TARGET_NAME} PROPERTIES
FOLDER intel_npu_tools
- CXX_STANDARD 17)
+ CXX_STANDARD ${CMAKE_CXX_STANDARD})
+
+# OpenCV headers do enum arithmetic that C++20 deprecates; treat them as system headers
+target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})
if (WIN32)
target_link_options(${TARGET_NAME} PRIVATE "/MANIFESTINPUT:${CMAKE_CURRENT_SOURCE_DIR}/protopipe.exe.manifest")
diff --git a/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake b/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake
index 7f24e65c23f..da29273a750 100644
--- a/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake
+++ b/src/plugins/intel_npu/tools/protopipe/cmake/standalone.cmake
@@ -3,7 +3,9 @@
# SPDX-License-Identifier: Apache 2.0
#
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
diff --git a/src/plugins/intel_npu/tools/single-image-test/CMakeLists.txt b/src/plugins/intel_npu/tools/single-image-test/CMakeLists.txt
index d45ecf31d77..e15503215b0 100644
--- a/src/plugins/intel_npu/tools/single-image-test/CMakeLists.txt
+++ b/src/plugins/intel_npu/tools/single-image-test/CMakeLists.txt
@@ -53,13 +53,16 @@ ov_set_threading_interface_for(${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES
FOLDER intel_npu_tools
- CXX_STANDARD 17)
+ CXX_STANDARD ${CMAKE_CXX_STANDARD})
# TODO: fix warnings and remove this exception
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
ov_add_compiler_flags(-Wno-missing-declarations)
endif()
+# OpenCV headers do enum arithmetic that C++20 deprecates; treat them as system headers
+target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${OpenCV_INCLUDE_DIRS})
+
#
# Install
#
diff --git a/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake b/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake
index e4d6009388d..b8516301807 100644
--- a/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake
+++ b/src/plugins/intel_npu/tools/single-image-test/cmake/standalone.cmake
@@ -2,7 +2,9 @@
# SPDX-License-Identifier: Apache-2.0
#
-set(CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
diff --git a/tests/memory_tests/CMakeLists.txt b/tests/memory_tests/CMakeLists.txt
index 0196eba3d68..65c14dd3b2e 100644
--- a/tests/memory_tests/CMakeLists.txt
+++ b/tests/memory_tests/CMakeLists.txt
@@ -4,7 +4,9 @@
cmake_minimum_required(VERSION 3.14)
-set (CMAKE_CXX_STANDARD 17)
+if(NOT DEFINED CMAKE_CXX_STANDARD)
+ set(CMAKE_CXX_STANDARD 20)
+endif()
if(NOT TARGET openvino::runtime)
find_package(OpenVINO REQUIRED)