Makefile with task for updating glad

This commit is contained in:
Mitchell Hashimoto
2022-04-04 14:52:47 -07:00
parent 17be18dead
commit 27f3e89316
9 changed files with 23 additions and 5 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
zig-cache/
zig-out/
/result*
glad.zip

17
Makefile Normal file
View File

@ -0,0 +1,17 @@
# glad updates the GLAD loader. To use this, place the generated glad.zip
# in this directory next to the Makefile, remove vendor/glad and run this target.
#
# Generator: https://gen.glad.sh/
glad: vendor/glad
.PHONY: glad
vendor/glad: vendor/glad/include/glad/gl.h vendor/glad/include/glad/glad.h
vendor/glad/include/glad/gl.h: glad.zip
rm -rf vendor/glad
mkdir -p vendor/glad
unzip glad.zip -dvendor/glad
find vendor/glad -type f -exec touch '{}' +
vendor/glad/include/glad/glad.h: vendor/glad/include/glad/gl.h
@echo "#include <glad/gl.h>" > $@

View File

@ -20,8 +20,8 @@ pub fn build(b: *std.build.Builder) !void {
try ftgl.link(exe, b, target, mode, .{});
// GLAD
exe.addIncludeDir("glad/include/");
exe.addCSourceFile("glad/src/gl.c", &.{});
exe.addIncludeDir("vendor/glad/include/");
exe.addCSourceFile("vendor/glad/src/gl.c", &.{});
const ftlib = try ft.create(b, target, mode, .{});
ftlib.link(exe);

View File

@ -1,2 +0,0 @@
// Backwards compatibility
#include <glad/gl.h>

View File

@ -30,7 +30,7 @@ pub fn link(
// C files
ret.addCSourceFiles(srcs, flags.items);
ret.addIncludeDir(root());
ret.addIncludeDir(thisDir() ++ "../../glad/include");
ret.addIncludeDir(thisDir() ++ "../../vendor/glad/include");
ret.linkLibC();
// For config.h

View File

0
glad/include/glad/gl.h → vendor/glad/include/glad/gl.h vendored Executable file → Normal file
View File

1
vendor/glad/include/glad/glad.h vendored Normal file
View File

@ -0,0 +1 @@
#include <glad/gl.h>

0
glad/src/gl.c → vendor/glad/src/gl.c vendored Executable file → Normal file
View File