-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
118 lines (101 loc) · 3.5 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
cmake_minimum_required(VERSION 3.5)
project(HDF5)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_COMPILER g++)
#set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF)
set(CMAKE_FIND_USE_SYSTEM_INCLUDE_PATH OFF)
set(CMAKE_FIND_USE_SYSTEM_LIBRARY_PATH OFF)
set(PLATFORM "amd64")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(PLATFORM "aarch64")
message("Detected aarch64 architecture")
else()
message("Not aarch64 architecture")
endif()
set(MQTT_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/lib/mqtt/${PLATFORM}")
set(HDF5_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/lib/hdf5/${PLATFORM}")
set(OPENCV_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/lib/opencv/${PLATFORM}")
set(ETC_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/lib/etc")
set(X264_LIBRARY_PATH "${CMAKE_SOURCE_DIR}/lib/x264/${PLATFORM}")
set(BOOST_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/include")
find_path(BOOST_INCLUDE_DIRS NAMES boost/asio.hpp PATHS "${CMAKE_SOURCE_DIR}/include")
find_path(HDF5_INCLUDE_DIRS NAMES H5Cpp.h PATHS "${CMAKE_SOURCE_DIR}/include/hdf5")
find_path(OPENCV_INCLUDE_DIRS NAMES opencv2/opencv.hpp PATHS "${CMAKE_SOURCE_DIR}/include/opencv")
find_path(MQTT_INCLUDE_DIRS NAMES mqtt/async_client.h PATHS "${CMAKE_SOURCE_DIR}/include/mqtt")
find_path(JSON_INCLUDE_DIRS NAMES nlohmann/json.hpp PATHS "${CMAKE_SOURCE_DIR}/include/json")
find_path(X264_INCLUDE_DIRS NAMES x264.h PATHS "${CMAKE_SOURCE_DIR}/include/x264")
include_directories(${HDF5_INCLUDE_DIRS})
include_directories(${MQTT_INCLUDE_DIRS})
include_directories(${OPENCV_INCLUDE_DIRS})
include_directories(${JSON_INCLUDE_DIRS})
include_directories(${BOOST_INCLUDE_DIRS})
include_directories(${X264_INCLUDE_DIRS})
set(SRC_LIST
src/main.cpp
src/sensors/Camera.cpp
src/sensors/Lidar.cpp
src/sensors/Radar.cpp
src/sensors/GPS.cpp
src/sensors/IMU.cpp
src/sensors/mqtt.cpp
)
add_executable(coll ${SRC_LIST})
add_executable(pub0 src/pub_0.cpp)
add_executable(rec0 src/rec_0.cpp)
message(STATUS "PLATFORM: ${PLATFORM}")
message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
message(STATUS "HDF5_include_DIRS: ${HDF5_INCLUDE_DIRS}")
message(STATUS "MqttCpp_Include_DIRS: ${MQTT_INCLUDE_DIRS}")
message(STATUS "OpenCV_Include_DIRS: ${OPENCV_INCLUDE_DIRS}")
message(STATUS "JSON_include_DIRS: ${JSON_INCLUDE_DIRS}")
message(STATUS "BOOST_Include_DIRS: ${BOOST_INCLUDE_DIRS}")
message(STATUS "x264_Include: ${X264_INCLUDE_DIRS}!!")
message(STATUS "ETC_LIBS: ${ETC_LIBRARY_PATH}")
message(STATUS "OpenCV_LIB: ${OPENCV_LIBRARY_PATH}")
message(STATUS "HDF5_include_DIRS: ${HDF5_INCLUDE_DIRS}")
message(STATUS "HDF5_LIB: ${HDF5_LIBRARY_PATH}")
message(STATUS "MqttCpp_Include_DIRS: ${MQTT_INCLUDE_DIRS}")
message(STATUS "MqttCpp_LIB: ${MQTT_LIBRARY_PATH}")
message(STATUS "x264_LIB: ${X264_LIBRARY_PATH}!!")
link_directories(
${HDF5_LIBRARY_PATH}
${MQTT_LIBRARY_PATH}
${OPENCV_LIBRARY_PATH}
)
set(COMMON_LIBRARIES
-lpaho-mqttpp3
-lpaho-mqtt3as
-lpaho-mqtt3c
)
target_link_libraries(pub0
-L${MQTT_LIBRARY_PATH}
${COMMON_LIBRARIES}
)
target_link_libraries(rec0
-L${MQTT_LIBRARY_PATH}
${COMMON_LIBRARIES}
)
#amd64下需要添加
target_link_libraries(coll PRIVATE
-L${HDF5_LIBRARY_PATH}
-L${MQTT_LIBRARY_PATH}
-L${OPENCV_LIBRARY_PATH}
-L${X264_LIBRARY_PATH}
#-L${ETC_LIBRARY_PATH}
-lopencv_imgproc
-lopencv_core
-lopencv_imgcodecs
-lopencv_highgui
-lopencv_videoio
${COMMON_LIBRARIES}
-lsz
-laec
-lhdf5
-lhdf5_cpp
-lhdf5_serial
-lcrypto
-lpthread
-lx264
)