Skip to content

Commit

Permalink
[TensorRT EP] Properly set CUDA_INCLUDE_DIR for onnx-tensorrt (#18274)
Browse files Browse the repository at this point in the history
#17468
The above PR didn't fully fix the issue for some environments.
This PR fixes this.
  • Loading branch information
chilo-ms authored Nov 4, 2023
1 parent 08eaa1c commit dfafcb5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmake/onnxruntime_providers_tensorrt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit dfafcb5

Please sign in to comment.