forked from carnegierobotics/multisense_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
134 lines (112 loc) · 4.22 KB
/
Makefile
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
include /usr/include/mrbuild/Makefile.common.header
PROJECT_NAME := multisense-ros
ABI_VERSION := 0
TAIL_VERSION := 0
LIB_SOURCES += \
multisense_ros/src/pps.cpp \
multisense_ros/src/camera.cpp \
multisense_ros/src/status.cpp \
multisense_ros/src/imu.cpp \
multisense_ros/src/laser.cpp \
multisense_ros/src/reconfigure.cpp \
multisense_ros/src/camera_utilities.cpp \
multisense_ros/src/ground_surface_utilities.cpp \
multisense_ros/src/point_cloud_utilities.cpp
# Things with main()
BIN_SOURCES += \
multisense_ros/src/raw_snapshot.cpp \
multisense_ros/src/color_laser.cpp \
multisense_ros/src/ros_driver.cpp
# non-ros stuff
LDLIBS += \
-lopencv_core \
-lopencv_imgproc \
-lopencv_calib3d \
-lturbojpeg \
-lMultiSense
# ros stuf
LDLIBS += \
-lroscpp \
-lrosconsole \
-lroscpp_serialization \
-lrostime \
-limage_transport \
-ltf2_ros \
-lrosbag_storage \
-ldynamic_reconfigure_config_init_mutex \
-lconsole_bridge
# I must set up dependendies on generated files manually. I don't want to deeply
# figure out what all the .o files are that transitively include the generated
# headers, so I make ALL .o files depend on these
ALL_O_FILES := $(addsuffix .o,$(basename $(LIB_SOURCES)) \
$(basename $(BIN_SOURCES)) )
ALL_GENERATED_CONFIG_H := $(shell awk -F'[<>]' '/include.*Config.h/ {print $$2}' multisense_ros/include/multisense_ros/reconfigure.h)
ALL_GENERATED_CONFIG_H_NO_M := $(addprefix ultisense_ros/include/,$(ALL_GENERATED_CONFIG_H))
ALL_GENERATED_CONFIG_H := $(addprefix m,$(ALL_GENERATED_CONFIG_H_NO_M))
$(ALL_O_FILES): $(ALL_GENERATED_CONFIG_H)
# Set the ROS_ROOT. The OSRF packages already set this, but they do it wrong: I
# want /opt/ros/noetic, not /opt/ros/noetic/share/ros
ifeq ($(ROS_DISTRO),)
ROS_ROOT := /usr
else
ROS_ROOT := /opt/ros/$(ROS_DISTRO)
endif
# I'm writing a bunch of files from one command. The nice way to communicate
# this fact to Make is to use group prerequisites. Like this:
#
# $(ALL_GENERATED_CONFIG_H) &: multisense_ros/cfg/multisense.cfg
#
# But they appeared in GNU Make 4.3, which isn't shipped with Ubuntu 20.04,
# which I'm targeting. So instead I do it the old-fashioned way: using pattern
# rules. There isn't a pattern here, so I do it in a hacky way: the initial "m"
# is the wildcard in the pattern
$(addprefix %,$(ALL_GENERATED_CONFIG_H_NO_M)): %ultisense_ros/cfg/multisense.cfg
python3 \
$< \
$(ROS_ROOT)/share/dynamic_reconfigure \
BINARY_DIR_UNUSED \
$(dir $@) \
PYTHON_GEN_DIR_UNUSED
# I clean out ALL the Config.h. I could have generated some that
# ALL_GENERATED_CONFIG_H doesn't contain
EXTRA_CLEAN += multisense_ros/include/multisense_ros/*Config.h BINARY_DIR_UNUSED PYTHON_GEN_DIR_UNUSED
# All .o files depend on all the message definitions that we have. Tighter
# dependencies are possible, but require manual work
ALL_GENERATED_MSG_H := $(patsubst multisense_ros/msg/%.msg,multisense_ros/include/multisense_ros/%.h,$(wildcard multisense_ros/msg/*.msg))
$(ALL_O_FILES): $(ALL_GENERATED_MSG_H)
multisense_ros/include/multisense_ros/%.h: multisense_ros/msg/%.msg
python3 \
$(ROS_ROOT)/lib/gencpp/gen_cpp.py \
$< \
-Imultisense_ros:multisense_ros/msg \
-Isensor_msgs:$(ROS_ROOT)/share/sensor_msgs/msg \
-Igeometry_msgs:$(ROS_ROOT)/share/geometry_msgs/msg \
-Istd_msgs:$(ROS_ROOT)/share/std_msgs/msg \
-p multisense_ros \
-o multisense_ros/include/multisense_ros/ \
-e $(ROS_ROOT)/share/gencpp
EXTRA_CLEAN += $(ALL_GENERATED_MSG_H)
CCXXFLAGS += -Wno-missing-field-initializers -Wno-unused-variable -Wno-unused-parameter
CCXXFLAGS += -std=c++17
CCXXFLAGS += -DCRL_HAVE_GETOPT=1
CCXXFLAGS += \
-Imultisense_ros/include \
-I/usr/include/eigen3/ \
-I/usr/include/opencv4
# For ROS
ifeq ($(ROS_DISTRO),)
# Using the vanilla Debian packages
CXXFLAGS += \
-I/usr/include/pluginlib \
-I/usr/include/class_loader \
-I/usr/include/rcutils \
-I/usr/include/rcpputils \
-I/usr/include/ament_index_cpp \
-I/usr/include/angles
else
# OSRF packages
CXXFLAGS += \
-I$(ROS_ROOT)/include
LDFLAGS += $(addprefix -L,$(LD_LIBRARY_PATH))
endif
include /usr/include/mrbuild/Makefile.common.footer