From f4faceab28bd7dffbaffd737719357129eadead7 Mon Sep 17 00:00:00 2001 From: Chi Lo <54722500+chilo-ms@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:51:58 -0700 Subject: [PATCH] Ignore deprecated declarations warning for TRT EP build (#16948) In additions to `onnxruntime_test_all`, `onnxruntime_shared_lib_test` and `onnxruntime_customopregistration_test` should also add "-Wno-deprecated-declarations" flag to ignore compiler warning --- cmake/onnxruntime_unittests.cmake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index 9a1b089ade..41b3e870fe 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -842,6 +842,8 @@ if (HAS_SHORTEN_64_TO_32 AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8) endif() if (UNIX AND onnxruntime_USE_TENSORRT) + # The test_main.cc includes NvInfer.h where it has many deprecated declarations + # simply ignore them for TensorRT EP build set_property(TARGET onnxruntime_test_all APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations") endif() @@ -1276,6 +1278,12 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP) $/testdata) endif() + if (UNIX AND onnxruntime_USE_TENSORRT) + # The test_main.cc includes NvInfer.h where it has many deprecated declarations + # simply ignore them for TensorRT EP build + set_property(TARGET onnxruntime_shared_lib_test APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations") + endif() + # test inference using global threadpools if (NOT CMAKE_SYSTEM_NAME MATCHES "Android|iOS" AND NOT onnxruntime_MINIMAL_BUILD) AddTest(DYN @@ -1531,6 +1539,13 @@ if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten") ${TEST_DATA_SRC} $/testdata) endif() + + if (UNIX AND onnxruntime_USE_TENSORRT) + # The test_main.cc includes NvInfer.h where it has many deprecated declarations + # simply ignore them for TensorRT EP build + set_property(TARGET onnxruntime_customopregistration_test APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-deprecated-declarations") + endif() + endif() endif()