-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (49 loc) · 1.55 KB
/
Copy pathMakefile
File metadata and controls
68 lines (49 loc) · 1.55 KB
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
# OpenFrameworks Project Makefile
# Set project name (used for the output binary)
PROJECT_NAME = openFrameworksProjectTemplate
# Set path to your OpenFrameworks installation
OF_ROOT = /path/to/openFrameworks
# Compiler settings
CXX = g++
CXXFLAGS = -std=c++17 -Wall -Wno-unused-function -Wno-unused-parameter
LDFLAGS = -L$(OF_ROOT)/libs -Wl,-rpath=$(OF_ROOT)/libs
# Source files
SRC_DIR = src
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES = $(SRC_FILES:.cpp=.o)
# Include paths
INCLUDES = -I$(OF_ROOT)/libs/openFrameworks -I$(OF_ROOT)/addons
INCLUDES += -I$(OF_ROOT)/libs -I$(OF_ROOT)/addons/ofxGui/src
# Libraries to link against
LIBS = -lopenFrameworks -lGL -lGLU -lglut -lpthread
# Addons
ADDONS = $(shell cat addons.make)
ADDON_INCLUDES = $(foreach addon,$(ADDONS),$(OF_ROOT)/addons/$(addon)/src)
# Final binary output
BIN_DIR = bin
BIN_NAME = $(PROJECT_NAME)
# Platform-specific settings
PLATFORM_OS := $(shell uname)
ifeq ($(PLATFORM_OS), Darwin)
LDFLAGS += -framework OpenGL -framework GLUT
else
LIBS += -lX11 -lXrandr -lXi -lXxf86vm
endif
# Rules
all: $(BIN_DIR)/$(BIN_NAME)
$(BIN_DIR)/$(BIN_NAME): $(OBJ_FILES)
@mkdir -p $(BIN_DIR)
$(CXX) $(OBJ_FILES) -o $@ $(LDFLAGS) $(LIBS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) $(ADDON_INCLUDES) -c $< -o $@
clean:
rm -f $(SRC_DIR)/*.o
rm -f $(BIN_DIR)/$(BIN_NAME)
.PHONY: clean
TEST_SRC = $(wildcard tests/*.cpp)
TEST_OBJ = $(TEST_SRC:.cpp=.o)
test: $(TEST_OBJ)
$(CXX) $(TEST_OBJ) -o $(BIN_DIR)/testRunner $(LDFLAGS) $(LIBS)
$(BIN_DIR)/testRunner
format:
clang-format -i src/*.cpp src/*.h