I want to spend some time studying the basics with some vulkan tutorials in Linux, but my makefile knowledge is a bit rusted (wasnt good to start). Can somebody give me some examples of cmake or scons files to build a little project with vulkan and SDL 2?
cmake or scons file to build little vulkan samples
SDL2 is pretty easy, and I have some examples. No clue about vulkan, though.
Assuming you have SDL2 dev libs installed on your system:
- “Find” files (used by cmake to find the libs on your system)
- Pointing cmake to the Find files
- Using find_package to bring the source files into the project
- Adding SDL2 includes to a target
- Adding SDL2 libs to a target
For an example of how to do a minimal C++ executable target, this might be useful.
By far the simplest for small projects is not to bother building incrementally, but instead do a full build each and every time. That is, make a script that simply performs all build steps, one at a time, using hard-coded paths and library names, eg
#!/usr/bin/env sh
set -e -u -x
CCFLAGS="-Wall -g"
FLEXFLAGS=
bison --defines=tokens.h --output=parser.cpp parser.y
flex $FLEXFLAGS --outfile=scanner.cpp scanner.l
g++ $CCFLAGS -c -o parser.o parser.cpp
g++ $CCFLAGS -c -o scanner.o scanner.cpp
g++ $CCFLAGS -c -o encode.o encode.cpp
g++ $CCFLAGS -c -o ast.o ast.cpp
g++ $CCFLAGS -c -o image.o image.cpp
g++ $CCFLAGS -c -o output.o output.cpp
g++ $CCFLAGS -o encoder parser.o scanner.o encode.o ast.o image.o output.o -lpng
I name these files typically mk.sh, and besides building the program, they also function as a reference what to do.
Only when you want to be portable, or when you want to build incrementally, it becomes really useful to invest time in some kind of build system.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement