Skip to content

Instantly share code, notes, and snippets.

@hikiko hikiko/Makefile
Last active Apr 21, 2019

What would you like to do?
name it MakefileSimple, put it in VKDF_HOME/demos/sponza
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
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/
$(bin): $(obj) $(vkdf_root)/ $(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
rm -f $(obj) $(bin) $(dep) *.spv

This comment has been minimized.

Copy link
Owner Author

commented Apr 21, 2019

you either run make -f MakefileSimple sponza in VKDF_HOME or cd to demos/sponza and run make -f MakefileSimple (make sure vkdf is up to date and you have a VKDF_HOME/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.