-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
101 lines (93 loc) · 4.21 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
cmake_minimum_required(VERSION 3.22)
project(point_detection LANGUAGES CXX)
include(cmake/utils.cmake)
add_subdirectory(plugins)
########################################################################################################################
# setup
########################################################################################################################
set(CMAKE_CXX_STANDARD 17)
set_ifndef_from_env(CUDNN_DIR)
set_ifndef_from_env(TENSORRT_DIR)
set_ifndef_from_default(CMAKE_BUILD_TYPE Release)
########################################################################################################################
# Dependencies
########################################################################################################################
find_package(catkin REQUIRED COMPONENTS roscpp sensor_msgs visualization_msgs pcl_conversions QUIET)
find_package(PCL REQUIRED COMPONENTS filters QUIET)
find_package(yaml-cpp REQUIRED QUIET)
find_package(Boost REQUIRED COMPONENTS filesystem QUIET)
find_package(CUDA ${CUDA_VERSION} REQUIRED QUIET)
find_library(TENSORRT_INFER_LIB nvinfer
HINTS ${TENSORRT_DIR} $ENV{TENSORRT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
find_library(TENSORRT_ONNX_PARSER_LIB nvonnxparser
HINTS ${TENSORRT_DIR} $ENV{TENSORRT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)
find_path(TENSORRT_INCLUDE_DIR NvInfer.h
HINTS ${TENSORRT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES include)
set(TENSORRT_LIB ${TENSORRT_INFER_LIB} ${TENSORRT_ONNX_PARSER_LIB})
find_library(CUDNN_LIB cudnn REQUIRED
HINTS ${CUDNN_DIR} $ENV{CUDNN_DIR}
PATH_SUFFIXES lib64 lib/x64 lib)
find_library(CUBLASLT_LIB cublasLt HINTS
${CUDA_TOOLKIT_ROOT_DIR} PATH_SUFFIXES lib64 lib lib/x64 lib/stubs)
########################################################################################################################
## build
########################################################################################################################
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES point_detection
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)
add_definitions(-DPROJECT_ROOT="${PROJECT_SOURCE_DIR}")
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
add_definitions(-DDEBUG)
endif ()
set(INC_DIRS
./
${TENSORRT_INCLUDE_DIR}
${CUDA_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS})
set(LINK_DIRS
${CUDNN_DIR}/lib)
set(LINK_LIBS
yaml-cpp
${TENSORRT_LIB}
${CUDNN_LIB}
${CUDA_LIBRARIES}
${CUBLASLT_LIB}
${Boost_LIBRARIES}
${catkin_LIBRARIES}
${PCL_LIBRARIES})
##############
## targets
##############
add_executable(point_detector src/point_detector.cpp)
target_include_directories(point_detector PRIVATE ${INC_DIRS})
target_link_directories(point_detector PRIVATE ${LINK_DIRS})
target_link_libraries(point_detector PRIVATE ${LINK_LIBS})
message(STATUS "******** Summary ********")
message(STATUS " CMake version : ${CMAKE_VERSION}")
message(STATUS " CMake command : ${CMAKE_COMMAND}")
message(STATUS " System : ${CMAKE_SYSTEM_NAME}")
message(STATUS " C++ compiler : ${CMAKE_CXX_COMPILER}")
message(STATUS " C++ compiler version : ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
message(STATUS " CXX flags : ${CMAKE_CXX_FLAGS}")
message(STATUS " CMAKE_PREFIX_PATH : ${CMAKE_PREFIX_PATH}")
message(STATUS " CMAKE_INSTALL_PREFIX : ${CMAKE_INSTALL_PREFIX}")
message(STATUS " CMAKE_MODULE_PATH : ${CMAKE_MODULE_PATH}")
message(STATUS "")
message(STATUS " CUDA_VERSION : ${CUDA_VERSION}")
message(STATUS " CUDA_TOOLKIT_ROOT_DIR : ${CUDA_TOOLKIT_ROOT_DIR}")
message(STATUS " CUDA_LIBRARIES : ${CUDA_LIBRARIES}")
message(STATUS " CUDA_INCLUDE_DIRS: : ${CUDA_INCLUDE_DIRS}")
message(STATUS " CUDART_LIB : ${CUDART_LIB}")
message(STATUS " CUBLAS_LIB : ${CUBLAS_LIB}")
message(STATUS " TENSORRT_LIB : ${TENSORRT_LIB}")
message(STATUS " TENSORRT_INCLUDE_DIR : ${TENSORRT_INCLUDE_DIR}")
message(STATUS " CUDNN_LIB : ${CUDNN_LIB}")
message(STATUS " CUBLASLT_LIB : ${CUBLASLT_LIB}")