forked from linClubs/BEVFusion-ROS-TensorRT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
160 lines (130 loc) · 3.82 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
cmake_minimum_required(VERSION 2.8.12)
project(bevfusion)
add_definitions(-w)
# set(CMAKE_BUILD_TYPE "Release") # pcl会报错 使用debug模式
# set(CMAKE_BUILD_TYPE "Debug")
add_compile_options(-W)
add_compile_options(-std=c++14)
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
set(CMAKE_CXX_FLAGS "-std=c++14 -O3 -g -DENABLE_TEXT_BACKEND_STB")
# set(CMAKE_CXX_FLAGS_RELEASE "-std=c++14 -Wextra -Wall -Wno-missing-field-initializers -Wno-deprecated-declarations -O3 -DENABLE_TEXT_BACKEND_STB")
# set(CMAKE_CXX_FLAGS_DEBUG "-std=c++14 -O0 -g -DENABLE_TEXT_BACKEND_STB")
set(CUDA_NVCC_FLAGS_RELEASE "-Werror=all-warnings -Xcompiler -std=c++14,-Wextra,-Wall,-Wno-deprecated-declarations,-O3 -DENABLE_TEXT_BACKEND_STB")
set(CUDA_NVCC_FLAGS_DEBUG "-std=c++14 -O0 -g -DENABLE_TEXT_BACKEND_STB")
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS}
# -gencode arch=compute_$ENV{CUDASM},code=compute_$ENV{CUDASM}
-gencode arch=compute_86,code=compute_86
)
# ----------------x86-----------------
# cuda
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-11.3)
set(CUDA_INSTALL_TARGET_DIR targets/x86_64-linux)
set(CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_ROOT_DIR}/${CUDA_INSTALL_TARGET_DIR}/include)
set(CUDA_LIBS ${CUDA_TOOLKIT_ROOT_DIR}/${CUDA_INSTALL_TARGET_DIR}/lib)
# TENSORRT
set(TensorRT_ROOT /home/lin/software/TensorRT-8.5.3.1)
# set(TensorRT_ROOT ~/share/TensorRT-8.5.3.1)
set(TensorRT_INCLUDE_DIRS ${TensorRT_ROOT}/include)
set(TensorRT_LIBS ${TensorRT_ROOT}/lib/)
# ------------------------------------
# ----------------orin-----------------
# # cuda
# set(CUDA_INCLUDE_DIRS /usr/local/cuda-11.4/include)
# set(CUDA_LIBS /usr/local/cuda-11.4/targets/aarch64-linux/lib)
# # tensorrt
# set(TensorRT_INCLUDE_DIRS /usr/include)
# set(TensorRT_LIBS /usr/lib/aarch64-linux-gnu)
# # ------------------------------------
find_package(CUDA REQUIRED)
find_package(Protobuf REQUIRED)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
roslib
message_filters
sensor_msgs
pcl_conversions
pcl_ros
cv_bridge
)
include_directories(
third_party/stb
third_party/pybind11/include
third_party/cuOSD/src
third_party/3DSparseConvolution/libspconv/include
src/common
src/
${TensorRT_INCLUDE_DIRS}
${Protobuf_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
include_ros
)
catkin_package()
link_directories(
third_party/3DSparseConvolution/libspconv/lib/${arch}
build
/usr/lib/aarch64-linux-gnu
/usr/aarch64-linux-gnu/lib
${TensorRT_LIBS}
${CUDA_LIBS}
)
file(GLOB_RECURSE CORE_FILES
src/bevfusion/*.cu
src/bevfusion/*.cpp
src/common/tensor.cu
src/common/tensorrt.cpp
)
file(GLOB_RECURSE VISUALIZE_FILES
third_party/cuOSD/src/*.cpp
third_party/cuOSD/src/*.cu
src/common/visualize.cu
)
####################### libbevfusion_core.so ##########################
cuda_add_library(bevfusion_core SHARED
${CORE_FILES}
)
target_link_libraries(bevfusion_core
libcudart.so
libcublasLt.so
libnvinfer.so
libspconv.so
${Protobuf_LIBRARIES}
libnvinfer_plugin.so
)
####################### bevfusion program #############################
# cuda_add_executable(demo
# src_ros/demo.cpp src_ros/bevfusion_plugin.cpp
# ${VISUALIZE_FILES}
# )
# target_link_libraries(demo
# bevfusion_core
# libnvinfer.so
# libspconv.so
# ${Protobuf_LIBRARIES}
# libnvinfer_plugin.so
# ${OpenCV_LIBS}
# ${PCL_LIBRARIES}
# ${catkin_LIBRARIES}
# )
# bevfusion_node
cuda_add_executable(bevfusion_node
src_ros/bevfusion_ros_node.cpp
src_ros/bevfusion_ros.cpp
src_ros/bevfusion_plugin.cpp
${VISUALIZE_FILES}
)
target_link_libraries(bevfusion_node
bevfusion_core
libnvinfer.so
libspconv.so
${Protobuf_LIBRARIES}
libnvinfer_plugin.so
${OpenCV_LIBS}
${PCL_LIBRARIES}
${catkin_LIBRARIES}
)