-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
81 lines (60 loc) · 3.11 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
cmake_minimum_required(VERSION 3.1)
project(yolov3-trt)
file(GLOB_RECURSE sources modules/*.hpp modules/*.cpp modules/*.h modules/*.cu extra/*.h deepsort/DeepAppearanceDescriptor/*.cpp deepsort/KalmanFilter/*.cpp deepsort/MunkresAssignment/*.cpp)
add_executable(yolov3-trt samples/sample_detector.cpp)
include_directories("/usr/local/include/eigen3")
include_directories(./deepsort/DeepAppearanceDescriptor ./deepsort/KalmanFilter ./deepsort/MunkresAssignment)
set(TENSORRT_ROOT "/home/aipc/code-YK/TensorRT-5.1.5.0")
set(OpenCV_DIR "/usr/local/opencv346")
#find_Package(gflags REQUIRED)
#if(gflags_FOUND)
#message("-- gflags found")
#endif()
set(CMAKE_CXX_COMPILIER "/usr/bin/g++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-write-strings")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,$ORIGIN")
#cudaS
find_package(CUDA REQUIRED)
message("-- CUDA version:$(CUDA_VERSION)")
if(CUDA_VERSION_MAJOR GREATER 9)
message("-- CUDA ${CUDA_VERSION_MAJOR} detected")
set(
CUDA_NVCC_FLAGS
${CUDA_NVCC_FLAGS};
-gencode arch=compute_53,code=sm_53
-gencode arch=compute_60,code=sm_60
-gencode arch=compute_61,code=sm_61
-gencode arch=compute_70,code=sm_70
-gencode arch=compute_75,code=sm_75
)
find_package(OpenCV REQUIRED)
endif()
message("-- sources:$(sources)")
cuda_add_library(detector SHARED ${sources})
# /usr/include/gflags/include
target_include_directories(detector PRIVATE modules/ ${CUDA_TOOLKIT_ROOT_DIR}/include /home/aipc/code-YK/TensorRT-5.1.5.0/include /usr/local/opencv346/include extra/ ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
#target_link_libraries(detector opencv_core opencv_calib3d opencv_dnn opencv_imgproc opencv_highgui)
target_include_directories(yolov3-trt PRIVATE modules/ extra/ deepsort/)
find_path(TENSORRT_INCLUDE_DIR NvInfer.h
HINTS ${TENSORRT_ROOT} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES include)
MESSAGE(STATUS "Found TensorRT headers at ${TENSORRT_INCLUDE_DIR}")
find_library(TENSORRT_LIBRARY_INFER nvinfer
HINTS ${TENSORRT_ROOT} ${TENSORRT_BUILD} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
#find_library(TENSORRT_LIBRARY_INFER_PLUGIN nvinfer_plugin
# HINTS ${TENSORRT_ROOT} ${TENSORRT_BUILD} ${CUDA_TOOLKIT_ROOT_DIR}
# PATH_SUFFIXES lib lib64 lib/x64)
find_library(TENSORRT_LIBRARY_CAFFEPARSER nvcaffe_parser
HINTS ${TENSORRT_ROOT} ${TENSORRT_BUILD} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
find_library(TENSORRT_LIBRARY_PLUGIN nvinfer_plugin
HINTS ${TENSORRT_ROOT} ${TENSORRT_BUILD} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
set(TENSORRT_LIBRARY ${TENSORRT_LIBRARY_INFER} ${TENSORRT_LIBRARY_CAFFEPARSER} ${TENSORRT_LIBRARY_PLUGIN})
MESSAGE(STATUS "TENSORRT_LIBRARY are ${TENSORRT_LIBRARY}")
#target_link_libraries(detector nvinfer nvinfer_plugin nvcaffe_parser gflags "stdc++fs")
target_link_libraries(detector ${TENSORRT_LIBRARY} "stdc++fs")
if(CUDA_VERSION_MAJOR GREATER 9)
target_link_libraries(yolov3-trt detector opencv_core opencv_calib3d opencv_dnn opencv_video)
endif()