Build in separate directory
This commit is contained in:
parent
3dd641c8c1
commit
e6e8b2c935
2 changed files with 33 additions and 27 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ imgui.ini
|
||||||
.*.d
|
.*.d
|
||||||
.vim.local/data/*
|
.vim.local/data/*
|
||||||
.vim.local/signature
|
.vim.local/signature
|
||||||
|
output/
|
||||||
|
|
59
Makefile
59
Makefile
|
@ -1,38 +1,45 @@
|
||||||
|
OUTDIR = output
|
||||||
|
|
||||||
CXXFLAGS += $(shell sdl2-config --cflags) -std=c++14 -Wall -g
|
CXXFLAGS += $(shell sdl2-config --cflags) -std=c++14 -Wall -g
|
||||||
CFLAGS += $(shell sdl2-config --cflags)
|
CFLAGS += $(shell sdl2-config --cflags)
|
||||||
CPPFLAGS += -I. -Iimgui -Iglm \
|
CPPFLAGS += -I. -I$(OUTDIR) -Iimgui -Iglm \
|
||||||
-DREAL_BUILD -DGLM_ENABLE_EXPERIMENTAL
|
-DREAL_BUILD -DGLM_ENABLE_EXPERIMENTAL
|
||||||
LIBS += $(shell sdl2-config --libs) -lGL -lGLEW -ldl
|
LIBS += $(shell sdl2-config --libs) -lGL -lGLEW -ldl
|
||||||
|
|
||||||
FILEDUMPS =
|
FILEDUMPS =
|
||||||
|
|
||||||
IMGUI = imgui.o imgui_demo.o imgui_draw.o
|
IMGUI = imgui.cpp imgui_draw.cpp
|
||||||
DEMO = \
|
DEMO = \
|
||||||
main.o \
|
main.cc \
|
||||||
imgui_impl_sdl.o \
|
imgui_impl_sdl.cc \
|
||||||
\
|
\
|
||||||
utilities.o \
|
utilities.cc \
|
||||||
texture.o \
|
texture.cc \
|
||||||
rendertarget.o \
|
rendertarget.cc \
|
||||||
programs.o \
|
programs.cc \
|
||||||
\
|
\
|
||||||
raymarcher.o \
|
raymarcher.cc \
|
||||||
\
|
\
|
||||||
bloom.o \
|
bloom.cc \
|
||||||
dof.o \
|
dof.cc \
|
||||||
combine.o \
|
combine.cc \
|
||||||
\
|
\
|
||||||
profiling.o
|
profiling.cc
|
||||||
|
|
||||||
DEMO_DEPS = $(DEMO:%.o=.%.d)
|
|
||||||
|
|
||||||
|
|
||||||
demo: $(DEMO) $(IMGUI)
|
IMGUI_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(IMGUI))))
|
||||||
|
DEMO_OBJS = $(addprefix $(OUTDIR)/, $(addsuffix .o, $(basename $(DEMO))))
|
||||||
|
OBJS = $(IMGUI_OBJS) $(DEMO_OBJS)
|
||||||
|
PCH=externals.hh.gch
|
||||||
|
|
||||||
|
DEMO_DEPS = $(DEMO_OBJS:$(OUTDIR)/%.o=$(OUTDIR)/%.d)
|
||||||
|
|
||||||
|
demo: $(OBJS)
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o demo \
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -o demo \
|
||||||
$(DEMO) $(IMGUI) $(LIBS)
|
$(OBJS) $(LIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(IMGUI) $(DEMO) $(FILEDUMPS) demo externals.hh.gch
|
rm -f $(OBJS) $(FILEDUMPS) demo $(PCH)
|
||||||
|
|
||||||
fullclean: clean
|
fullclean: clean
|
||||||
rm -f $(DEMO_DEPS)
|
rm -f $(DEMO_DEPS)
|
||||||
|
@ -44,20 +51,18 @@ $(FILEDUMPS): fd-%.h: %
|
||||||
xxd -i $< $@
|
xxd -i $< $@
|
||||||
|
|
||||||
|
|
||||||
imgui.o: imgui/imgui.cpp
|
outdir:
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
@if ! [ -d "$(OUTDIR)" ]; then mkdir "$(OUTDIR)"; fi
|
||||||
|
.PHONY: outdir
|
||||||
|
|
||||||
imgui_demo.o: imgui/imgui_demo.cpp
|
$(IMGUI_OBJS): $(OUTDIR)/%.o: imgui/%.cpp | outdir
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
imgui_draw.o: imgui/imgui_draw.cpp
|
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
-include $(DEMO_DEPS)
|
-include $(DEMO_DEPS)
|
||||||
|
|
||||||
$(DEMO): %.o: %.cc externals.hh.gch | $(FILEDUMPS)
|
$(DEMO_OBJS): $(OUTDIR)/%.o: %.cc $(PCH) | outdir $(FILEDUMPS)
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=.%.d) -MT $@ $<
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -M -MF $(@:%.o=%.d) -MT $@ $<
|
||||||
|
|
||||||
externals.hh.gch: externals.hh
|
$(PCH): externals.hh
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||||
|
|
Loading…
Reference in a new issue