From 0a6b22018fd52d927c745cfa1d51d9c7db629f69 Mon Sep 17 00:00:00 2001 From: Kevin Chen <45886021+kevinch-nv@users.noreply.github.com> Date: Wed, 8 Feb 2023 10:19:55 -0800 Subject: [PATCH] Move TRT include_directories to outside scope (#14622) Signed-off-by: Kevin Chen ### Description Previously `include_directories(${TENSORRT_INCLUDE_DIR})` was only done if `onnxruntime_USE_TENSORRT_BUILTIN_PARSER` was false. This would cause a build failure when the switch was true as the include directory was not added. ### Motivation and Context Fixes TRT build when `onnxruntime_USE_TENSORRT_BUILTIN_PARSER` is true. --------- Signed-off-by: Kevin Chen --- cmake/onnxruntime_providers.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake index 33d13f4476..84e429db30 100644 --- a/cmake/onnxruntime_providers.cmake +++ b/cmake/onnxruntime_providers.cmake @@ -689,10 +689,11 @@ if (onnxruntime_USE_TENSORRT) target_compile_options(nvonnxparser_static PRIVATE /FIio.h /wd4100) target_compile_options(nvonnxparser PRIVATE /FIio.h /wd4100) endif() - include_directories(${TENSORRT_INCLUDE_DIR}) set(onnxparser_link_libs nvonnxparser_static) endif() + include_directories(${TENSORRT_INCLUDE_DIR}) + set(trt_link_libs cudnn cublas ${CMAKE_DL_LIBS} ${TENSORRT_LIBRARY}) file(GLOB_RECURSE onnxruntime_providers_tensorrt_cc_srcs CONFIGURE_DEPENDS @@ -710,11 +711,10 @@ if (onnxruntime_USE_TENSORRT) add_dependencies(onnxruntime_providers_tensorrt onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES}) if (onnxruntime_USE_TENSORRT_BUILTIN_PARSER) target_link_libraries(onnxruntime_providers_tensorrt PRIVATE ${trt_link_libs} cudart ${ONNXRUNTIME_PROVIDERS_SHARED} ${PROTOBUF_LIB} flatbuffers::flatbuffers Boost::mp11 safeint_interface ${ABSEIL_LIBS}) - target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${TENSORRT_INCLUDE_DIR} PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) else() target_link_libraries(onnxruntime_providers_tensorrt PRIVATE ${onnxparser_link_libs} ${trt_link_libs} cudart ${ONNXRUNTIME_PROVIDERS_SHARED} ${PROTOBUF_LIB} flatbuffers::flatbuffers ${ABSEIL_LIBS}) - target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) endif() + target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) if(onnxruntime_CUDNN_HOME) target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${onnxruntime_CUDNN_HOME}/include) endif()