Last active
April 21, 2019 20:55
-
-
Save hikiko/eac31eb9b02567d6e75afecacf4df0cb to your computer and use it in GitHub Desktop.
name it MakefileSimple, put it in VKDF_HOME/demos/sponza
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src = $(wildcard *.cpp) | |
obj = $(src:.cpp=.o) | |
dep = $(obj.o=.d) | |
bin = sponza | |
vkdf_root = ../.. | |
spv = $(patsubst %.input,%.spv,$(wildcard *.input)) \ | |
$(patsubst %.frag,%.frag.spv,$(wildcard *.frag)) \ | |
$(patsubst %.vert,%.vert.spv,$(wildcard *.vert)) | |
dbg = -g | |
opt = -O0 | |
inc = -I$(vkdf_root)/framework | |
def = -DVKDF_PLATFORM_SDL | |
CXX = g++ | |
CXXFLAGS = -Wall $(dbg) $(opt) $(inc) $(def) `pkg-config --cflags glm glib-2.0 sdl2` | |
LDFLAGS = -L$(vkdf_root) -lvkdf -lvulkan -lassimp -lSDL2_image \ | |
`pkg-config --libs glm glib-2.0 sdl2` | |
GLSLANG = glslangValidator | |
FIXUP_GLSL := python $(vkdf_root)/scripts/fixup-glsl.py | |
$(bin): $(obj) $(vkdf_root)/libvkdf.so $(spv) | |
$(CXX) -o $@ $(obj) -Wl,-rpath=$(vkdf_root) $(LDFLAGS) | |
%.frag: %.frag.input | |
$(FIXUP_GLSL) $< $@ | |
%.vert: %.vert.input | |
$(FIXUP_GLSL) $< $@ | |
%.vert.spv: %.vert | |
$(GLSLANG) -V $< -o $@ | |
%.frag.spv: %.frag | |
$(GLSLANG) -V $< -o $@ | |
-include $(dep) | |
%.d: %.cpp | |
@echo "Generating depfile: $@" | |
@$(CPP) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@ | |
.PHONY: clean | |
clean: | |
rm -f $(obj) $(bin) $(dep) *.spv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you either run
make -f MakefileSimple sponza
in VKDF_HOME or cd to demos/sponza and runmake -f MakefileSimple
(make sure vkdf is up to date and you have a VKDF_HOME/libvkdf.so)