[TensorRT EP] Properly set CUDA_INCLUDE_DIR for onnx-tensorrt (#18274)

https://github.com/microsoft/onnxruntime/pull/17468
The above PR didn't fully fix the issue for some environments.
This PR fixes this.
This commit is contained in:
Chi Lo 2023-11-04 03:04:10 +00:00 committed by GitHub
parent 08eaa1c55d
commit dfafcb58aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,12 +57,14 @@
URL ${DEP_URL_onnx_tensorrt}
URL_HASH SHA1=${DEP_SHA1_onnx_tensorrt}
)
if (NOT CUDA_INCLUDE_DIR)
set(CUDA_INCLUDE_DIR ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) # onnx-tensorrt repo needs this variable to build
endif()
# The onnx_tensorrt repo contains a test program, getSupportedAPITest, which doesn't support Windows. It uses
# unistd.h. So we must exclude it from our build. onnxruntime_fetchcontent_makeavailable is for the purpose.
onnxruntime_fetchcontent_makeavailable(onnx_tensorrt)
include_directories(${onnx_tensorrt_SOURCE_DIR})
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
set(CUDA_INCLUDE_DIR ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) # onnx-tensorrt repo needs this variable to build
if ( CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
endif()