-
Notifications
You must be signed in to change notification settings - Fork 490
/
Copy pathpackages.cmake
132 lines (109 loc) · 4.02 KB
/
packages.cmake
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
# 引入该目录下的.cmake文件
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
# livox ros driver
add_subdirectory(thirdparty/livox_ros_driver)
include_directories(${CMAKE_BINARY_DIR}/devel/include) # 引用ros生成的msg header
# eigen 3
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIRS})
# sophus
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/sophus)
# glog
find_package(Glog REQUIRED)
include_directories(${Glog_INCLUDE_DIRS})
# csparse
find_package(CSparse REQUIRED)
include_directories(${CSPARSE_INCLUDE_DIR})
# cholmod
find_package(Cholmod REQUIRED)
include_directories(${CHOLMOD_INCLUDE_DIRS})
# pcl
find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
# opencv
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
# g2o 使用thirdparty中的
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/g2o/)
set(g2o_libs
${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_stuff.so
${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_core.so
# ${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_solver_cholmod.so
${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_solver_dense.so
${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_solver_csparse.so
${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_csparse_extension.so
${PROJECT_SOURCE_DIR}/thirdparty/g2o/lib/libg2o_types_sba.so
${CSPARSE_LIBRARY}
${CHOLMOD_LIBRARY}
)
# ros
# 为了2D scan, pointcloud2
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
sensor_msgs
pcl_ros
pcl_conversions
)
include_directories(${catkin_INCLUDE_DIRS})
find_package(Pangolin REQUIRED)
include_directories(${Pangolin_INCLUDE_DIRS})
# yaml-cpp
find_package(yaml-cpp REQUIRED)
include_directories(${yaml-cpp_INCLUDE_DIRS})
# 其他thirdparty下的内容
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/velodyne/include)
if(BUILD_WITH_UBUNTU1804)
function(extract_file filename extract_dir)
message(STATUS "Extract ${filename} to ${extract_dir} ...")
set(temp_dir ${extract_dir})
if(EXISTS ${temp_dir})
file(REMOVE_RECURSE ${temp_dir})
endif()
file(MAKE_DIRECTORY ${temp_dir})
execute_process(COMMAND ${CMAKE_COMMAND} -E tar -xvzf ${filename}
WORKING_DIRECTORY ${temp_dir})
endfunction()
set(TBB_ROOT_DIR ${PROJECT_SOURCE_DIR}/thirdparty/tbb/oneTBB-2019_U8/oneTBB-2019_U8)
set(TBB_BUILD_DIR "tbb_build_dir=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
set(TBB_BUILD_PREFIX "tbb_build_prefix=tbb")
extract_file(${PROJECT_SOURCE_DIR}/thirdparty/tbb/2019_U8.tar.gz ${PROJECT_SOURCE_DIR}/thirdparty/tbb/oneTBB-2019_U8)
include(${TBB_ROOT_DIR}/cmake/TBBBuild.cmake)
#message(STATUS "======TBB_BUILD_DIR = ${TBB_BUILD_DIR}")
#message(STATUS "======TBB_BUILD_PREFIX = ${TBB_BUILD_PREFIX}")
tbb_build(TBB_ROOT ${TBB_ROOT_DIR}
compiler=gcc-9
stdver=c++17
${TBB_BUILD_DIR}
${TBB_BUILD_PREFIX}
CONFIG_DIR
TBB_DIR)
find_package(TBB REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/thirdparty/tbb/oneTBB-2019_U8/oneTBB-2019_U8/include)
link_directories(${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tbb_release)
set(third_party_libs
${catkin_LIBRARIES}
${g2o_libs}
${OpenCV_LIBS}
${PCL_LIBRARIES}
${Pangolin_LIBRARIES}
glog gflags
${yaml-cpp_LIBRARIES}
yaml-cpp
TBB::tbb
)
else()
set(third_party_libs
${catkin_LIBRARIES}
${g2o_libs}
${OpenCV_LIBS}
${PCL_LIBRARIES}
${Pangolin_LIBRARIES}
glog gflags
${yaml-cpp_LIBRARIES}
yaml-cpp
tbb
)
endif ()