From 8ec1ba70b19610def1be41c69740288358529bd9 Mon Sep 17 00:00:00 2001 From: Anastasia Kuporosova Date: Wed, 13 Nov 2024 12:20:08 +0000 Subject: [PATCH] wa for debian9 --- thirdparty/onnx/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/thirdparty/onnx/CMakeLists.txt b/thirdparty/onnx/CMakeLists.txt index 8c1327ac737a7b..aae8e13b9c6c14 100644 --- a/thirdparty/onnx/CMakeLists.txt +++ b/thirdparty/onnx/CMakeLists.txt @@ -52,6 +52,21 @@ endif() # from onnx==1.13.1 it requires C++17 when compiling on Windows, and since onnx==1.16.0 on Linux target_compile_features(onnx PRIVATE cxx_std_17) +# WA to allow build on Debian 9 +if(CMAKE_COMPILER_IS_GNUCXX AND LINUX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0) + file(READ onnx/onnx/common/file_utils.h CONTENT) + string(REPLACE "#include " "" CONTENT "${CONTENT}") + string(REPLACE "std::filesystem::path proto_u8_path = std::filesystem::u8path(proto_path);" "" CONTENT "${CONTENT}") + string(REPLACE "proto_u8_path" "proto_path" CONTENT "${CONTENT}") + file(WRITE onnx/onnx/common/file_utils.h "${CONTENT}") + + file(READ onnx/onnx/defs/traditionalml/utils.h CONTENT) + string(REPLACE "const auto& [type, length]" "const std::pair& type_length" CONTENT "${CONTENT}") + string(REPLACE "type !=" "type_length.first !=" CONTENT "${CONTENT}") + string(REPLACE "length !=" "type_length.second !=" CONTENT "${CONTENT}") + file(WRITE onnx/onnx/defs/traditionalml/utils.h "${CONTENT}") +endif() + ov_disable_all_warnings(onnx onnx_proto) # install