Skip to content

Commit 3986f55

Browse files
[core] Support OpenVINO compilation with cpp20 (#22784)
### Details: - Add support to OpenVINO to build it with standards newer than cpp11 ### Tickets: - [CVS-128282](https://jira.devtools.intel.com/browse/CVS-128282) --------- Co-authored-by: Ilya Lavrenov <[email protected]>
1 parent 9b22324 commit 3986f55

File tree

28 files changed

+120
-43
lines changed

28 files changed

+120
-43
lines changed

.github/workflows/linux_conditional_compilation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ jobs:
152152
run: |
153153
cmake \
154154
-G "${{ env.CMAKE_GENERATOR }}" \
155+
-DCMAKE_CXX_STANDARD=20 \
155156
-DBUILD_SHARED_LIBS=OFF \
156157
-DENABLE_TESTS=ON \
157158
-DENABLE_CPPLINT=OFF \

.github/workflows/windows_conditional_compilation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ jobs:
147147
run: |
148148
cmake -G "${{ env.CMAKE_GENERATOR }}" `
149149
-DBUILD_SHARED_LIBS=OFF `
150+
-DCMAKE_CXX_STANDARD=20 `
150151
-DENABLE_TESTS=ON `
151152
-DENABLE_CPPLINT=OFF `
152153
-DENABLE_NCC_STYLE=OFF `

docs/snippets/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ if(UNUSED_BUT_SET_VARIABLE_SUPPORTED)
1515
ov_add_compiler_flags(-Wno-unused-but-set-variable)
1616
endif()
1717

18+
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
19+
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
20+
endif()
21+
1822
file(GLOB SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
1923
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
2024
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")

samples/cpp/hello_classification/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ int tmain(int argc, tchar* argv[]) {
2828

2929
// -------- Parsing and validation of input arguments --------
3030
if (argc != 4) {
31-
slog::info << "Usage : " << argv[0] << " <path_to_model> <path_to_image> <device_name>" << slog::endl;
31+
slog::info << "Usage : " << TSTRING2STRING(argv[0]) << " <path_to_model> <path_to_image> <device_name>"
32+
<< slog::endl;
3233
return EXIT_FAILURE;
3334
}
3435

src/common/low_precision_transformations/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC})
1616
source_group("include" FILES ${PUBLIC_HEADERS})
1717

1818
# Create library
19+
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
20+
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
21+
endif()
1922

2023
add_library(${TARGET_NAME}_obj OBJECT
2124
${LIBRARY_SRC}

src/common/snippets/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC})
1616
source_group("include" FILES ${PUBLIC_HEADERS})
1717

1818
# Create static library
19+
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
20+
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
21+
endif()
1922

2023
add_library(${TARGET_NAME} STATIC
2124
${LIBRARY_SRC}

src/common/transformations/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ source_group("src" FILES ${LIBRARY_SRC})
1616
source_group("include" FILES ${PUBLIC_HEADERS})
1717

1818
# Create library
19+
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
20+
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
21+
endif()
1922

2023
add_library(${TARGET_NAME}_obj OBJECT ${LIBRARY_SRC} ${PUBLIC_HEADERS})
2124
target_compile_definitions(${TARGET_NAME}_obj PRIVATE IMPLEMENT_OPENVINO_API)

src/common/transformations/include/transformations/rt_info/nms_selected_indices.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ TRANSFORMATIONS_API bool has_nms_selected_indices(const Node* node);
2121

2222
TRANSFORMATIONS_API void set_nms_selected_indices(Node* node);
2323

24-
class TRANSFORMATIONS_API NmsSelectedIndices : ov::RuntimeAttribute {
24+
class TRANSFORMATIONS_API NmsSelectedIndices : public ov::RuntimeAttribute {
2525
public:
2626
OPENVINO_RTTI("nms_selected_indices", "0");
2727
NmsSelectedIndices() = default;

src/core/tests/matcher_pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TestMatcherPass : public ov::pass::MatcherPass {
2525
auto m_relu1 = ov::pass::pattern::wrap_type<ov::op::v0::Relu>(pattern::consumers_count(1));
2626
auto m_relu2 = ov::pass::pattern::wrap_type<ov::op::v0::Relu>({m_relu1});
2727

28-
ov::graph_rewrite_callback callback = [=](pattern::Matcher& m) {
28+
ov::graph_rewrite_callback callback = [m_relu1, this](pattern::Matcher& m) {
2929
// Map that helps to connect labels with matched outputs
3030
auto& node_to_output = m.get_pattern_value_map();
3131

src/frontends/paddle/src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# SPDX-License-Identifier: Apache-2.0
33
#
44

5+
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
6+
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
7+
endif()
8+
59
ov_add_frontend(NAME paddle
610
LINKABLE_FRONTEND
711
PROTOBUF_REQUIRED

0 commit comments

Comments
 (0)