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
|
||||
.vim.local/data/*
|
||||
.vim.local/signature
|
||||
output/
|
||||
|
|
59
Makefile
59
Makefile
|
@ -1,38 +1,45 @@
|
|||
OUTDIR = output
|
||||
|
||||
CXXFLAGS += $(shell sdl2-config --cflags) -std=c++14 -Wall -g
|
||||
CFLAGS += $(shell sdl2-config --cflags)
|
||||
CPPFLAGS += -I. -Iimgui -Iglm \
|
||||
CPPFLAGS += -I. -I$(OUTDIR) -Iimgui -Iglm \
|
||||
-DREAL_BUILD -DGLM_ENABLE_EXPERIMENTAL
|
||||
LIBS += $(shell sdl2-config --libs) -lGL -lGLEW -ldl
|
||||
|
||||
FILEDUMPS =
|
||||
|
||||
IMGUI = imgui.o imgui_demo.o imgui_draw.o
|
||||
IMGUI = imgui.cpp imgui_draw.cpp
|
||||
DEMO = \
|
||||
main.o \
|
||||
imgui_impl_sdl.o \
|
||||
main.cc \
|
||||
imgui_impl_sdl.cc \
|
||||
\
|
||||
utilities.o \
|
||||
texture.o \
|
||||
rendertarget.o \
|
||||
programs.o \
|
||||
utilities.cc \
|
||||
texture.cc \
|
||||
rendertarget.cc \
|
||||
programs.cc \
|
||||
\
|
||||
raymarcher.o \
|
||||
raymarcher.cc \
|
||||
\
|
||||
bloom.o \
|
||||
dof.o \
|
||||
combine.o \
|
||||
bloom.cc \
|
||||
dof.cc \
|
||||
combine.cc \
|
||||
\
|
||||
profiling.o
|
||||
|
||||
DEMO_DEPS = $(DEMO:%.o=.%.d)
|
||||
profiling.cc
|
||||
|
||||
|
||||
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 \
|
||||
$(DEMO) $(IMGUI) $(LIBS)
|
||||
$(OBJS) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(IMGUI) $(DEMO) $(FILEDUMPS) demo externals.hh.gch
|
||||
rm -f $(OBJS) $(FILEDUMPS) demo $(PCH)
|
||||
|
||||
fullclean: clean
|
||||
rm -f $(DEMO_DEPS)
|
||||
|
@ -44,20 +51,18 @@ $(FILEDUMPS): fd-%.h: %
|
|||
xxd -i $< $@
|
||||
|
||||
|
||||
imgui.o: imgui/imgui.cpp
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
outdir:
|
||||
@if ! [ -d "$(OUTDIR)" ]; then mkdir "$(OUTDIR)"; fi
|
||||
.PHONY: outdir
|
||||
|
||||
imgui_demo.o: imgui/imgui_demo.cpp
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
imgui_draw.o: imgui/imgui_draw.cpp
|
||||
$(IMGUI_OBJS): $(OUTDIR)/%.o: imgui/%.cpp | outdir
|
||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
|
||||
|
||||
-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) -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 $@ $<
|
||||
|
|
Loading…
Reference in a new issue