-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile_2
134 lines (91 loc) · 4.22 KB
/
Makefile_2
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
########################################################################
####################### Makefile Template ##############################
########################################################################
OPT = -O0
# Armadillo
## As the Armadillo library uses recursive templates, compilation times depend on the level of optimisation:
##
## -O0: quick compilation, but the resulting program will be slow
## -O1: good trade-off between compilation time and execution speed
## -O2: produces programs which have almost all possible speedups, but compilation takes longer
## -O3: enables auto vectorisation when using gcc
#OPT = -xO4 -xannotate=no
## When using the Sun Studio compiler
#EXTRA_OPT = -fwhole-program
## Uncomment the above line if you're compiling all source files into one program in a single hit
#DEBUG_ARMA = -DARMA_EXTRA_DEBUG
## Uncomment the above line to enable low-level debugging.
## Lots of debugging information will be printed when a compiled program is run.
## Please enable this option when reporting bugs.
#FINAL = -DARMA_NO_DEBUG
## Uncomment the above line to disable Armadillo's checks.
## Not recommended unless your code has been first thoroughly tested!
ARMADILLO_LIB := -larmadillo
#-------------------------------------------------------------------------------------------
# Ceres
CERES_SRC_DIR := /usr/local/include/ # This should point to place where you unpacked or cloned Ceres.
CERES_BIN_DIR := /usr/local/lib # This should point to the place where you built Ceres.
EIGEN_SRC_DIR := /usr/include/eigen3 # The place you unpacked or cloned Eigen.
CERES_INCLUDES := -I$(CERES_SRC_DIR) \
-I$(EIGEN_SRC_DIR)
CERES_LIBRARY := -lceres
CERES_LIBRARY_PATH := -L$(CERES_BIN_DIR)
CERES_LIBRARY_DEPENDENCIES = -lgflags -lglog
# If Ceres was built with Suitesparse:
CERES_LIBRARY_DEPENDENCIES += -llapack -lblas -lm -lcamd -lamd -lccolamd -lcolamd -lcholmod
# If Ceres was built with CXSparse:
CERES_LIBRARY_DEPENDENCIES += -lcxsparse
# If Ceres was built with OpenMP:
CERES_LIBRARY_DEPENDENCIES += -fopenmp -lpthread -lgomp -lm
#-------------------------------------------------------------------------------------------
# OpenCV
OPENCV_SRC_DIR := /usr/local/include/opencv4/
OPENCV = `pkg-config opencv --cflags --libs`
OPENCVLIBRARIES = $(OPENCV)
#-------------------------------------------------------------------------------------------
# Python (for ploting)
PYTHON_SRC_DIR := /usr/include/python3.6
PYTHON_BIN_DIR := /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu
PYTHON_LIB := -lpython3.6
#-------------------------------------------------------------------------------------------
# SLAM (this app)
SLAM_LIB_DEPENDENCIES := -lpthread
SLAM_LIB_DEPENDENCIES_DIR := /usr/local/lib
SLAM_LIB_DIR := lib
SLAM_LIB_INCLUDE := include
#BIN := bin
#OBJ := obj
#SRC := src
# Extra source code directories
#-------------------------------------------------------------------------------------------
DEBUG = -ggdb
CXX := g++
CXX_FLAGS := -Wall -Wextra -std=c++17 $(DEBUG) $(DEBUG_ARMA) $(FINAL) $(OPT) $(EXTRA_OPT)
INCLUDE := -I$(SLAM_LIB_INCLUDE) -I$(OPENCV_SRC_DIR) -I$(PYTHON_SRC_DIR) $(CERES_INCLUDES)
INCLUDE2 :=
LIB := -L$(SLAM_LIB_DIR) -L$(SLAM_LIB_DEPENDENCIES_DIR) -L$(PYTHON_BIN_DIR) $(CERES_LIBRARY_PATH)
LIBRARIES := $(SLAM_LIB_DEPENDENCIES) $(ARMADILLO_LIB) $(PYTHON_LIB) $(CERES_LIBRARY) $(CERES_LIBRARY_DEPENDENCIES)
EXECUTABLE := slam
EXECUTABLE := slam
BIN := bin
#SRCFILES := $(wildcard $(SRCDIR)/*.cpp)
#OBJFILES := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCFILES))
#DEPFILES := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.d,$(SRCFILES))
#SRC := $(wildcard $(SRCDIR)/*.cpp)
#OBJ := $(SRC:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
CPPsrc = $(wildcard src/*.cpp) \
$(wildcard src/ekf/*.cpp) \
$(wildcard src/Transforms/*.cpp) \
$(wildcard src/Jacs/*.cpp) \
$(wildcard src/vision/*.cpp) \
$(wildcard src/map/*.cpp) \
$(wildcard src/anms/*.cpp)
APPLICATION_OBJS = $(CPPsrc:.cpp=.o)
#.PHONY: all clean
all: $(BIN)/$(EXECUTABLE)
$(BIN)/$(EXECUTABLE):$(APPLICATION_OBJS)
$(CXX) $(LIB) $(OPENCVLIBRARIES) $(LIBRARIES) -o $(BIN)/$(EXECUTABLE)
$(OBJ_DIR)/%.o: $(CPPsrc)
$(CXX) $(CXX_FLAGS) -c $< -o $@ $(INCLUDE)
-include $(OBJ:.o=.d)
-include $(DEPFILES)