CMakeLists.txt
make_minimum_required(VERSION 3.0) project(yolo) add_definitions(-std=c++11) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Release) include_directories(${PROJECT_SOURCE_DIR}/include) # include and link dirs of cuda and tensorrt, you need adapt them if yours are different # cuda include_directories(/home/ljd/mei/cuda-11.4/include) link_directories(/home/ljd/mei/cuda-11.4/lib64) # tensorrt include_directories(/home/ljd/mei/TensorRT-8.2.1.8/include) link_directories(/home/ljd/mei/TensorRT-8.2.1.8/lib) include_directories(/home/ljd/mei/TensorRT-8.2.1.8/samples/common/) #link_directories(/home/ubuntu/soft/TensorRT-8.2.5.1/lib/stubs/) #realsense find_package(realsense2 REQUIRED) include_directories(/home/ljd/mei/librealsense2) # opencv find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) add_executable(yolo ${PROJECT_SOURCE_DIR}/main.cpp) target_link_libraries(yolo nvinfer) target_link_libraries(yolo cudart) target_link_libraries(yolo ${OpenCV_LIBS}) target_link_libraries(yolo ${realsense2_LIBRARY} ) target_link_libraries(yolo opencv_core) target_link_libraries(yolo opencv_imgproc) target_link_libraries(yolo opencv_videoio) target_link_libraries(yolo opencv_highgui) #target_link_libraries(yolo cuda_runtime_api) target_link_libraries(yolo /home/ljd/mei/TensorRT-8.2.1.8/lib/stubs/libnvonnxparser.so) add_definitions(-O2 -pthread