diff --git a/CMakeLists.txt b/CMakeLists.txt index 3377253..bd9f2b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,24 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Ofast -DNDEBUG -Wno-deprecated-de # For finding FindTensorRT.cmake set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) -# TODO: Specify the path to TensorRT root dir -if (NOT TensorRT_DIR) - set(TensorRT_DIR /home/cyrus/work/libs/TensorRT-10.0.0.6/) +set(TensorRT_INCLUDE_DIRS /usr/include) +set(TENSORRT_LIB_DIR /usr/lib/x86_64-linux-gnu) + +find_library(NVINFER_LIBRARY nvinfer HINTS ${TENSORRT_LIB_DIR}) +find_library(NVINFER_PLUGIN_LIBRARY nvinfer_plugin HINTS ${TENSORRT_LIB_DIR}) +find_library(NVONNXPARSER_LIBRARY nvonnxparser HINTS ${TENSORRT_LIB_DIR}) + +if (NOT NVINFER_LIBRARY OR NOT NVINFER_PLUGIN_LIBRARY OR NOT NVONNXPARSER_LIBRARY) + message(FATAL_ERROR "Could not find TensorRT libraries. Make sure TensorRT is installed.") endif() + +include_directories(${TENSORRT_INCLUDE_DIR}) + +set(TensorRT_LIBRARIES ${NVINFER_LIBRARY} ${NVINFER_PLUGIN_LIBRARY} ${NVONNXPARSER_LIBRARY}) + # Use the correct version of CUDA set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda) -# We require CUDA, OpenCV, and TensorRT -find_package(TensorRT REQUIRED) find_package(CUDA REQUIRED) find_package(OpenCV REQUIRED) find_package(fmt REQUIRED)