-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.zig
68 lines (57 loc) · 2.74 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const std = @import("std");
const Builder = std.build.Builder;
const builtin = @import("builtin");
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
// const windows = b.option(bool, "windows", "create windows build") orelse false;
// {
// var t = b.addTest("test.zig");
// t.linkSystemLibrary("c");
// const test_step = b.step("test", "Run all tests");
// test_step.dependOn(&t.step);
// }
// var raycol = b.addStaticLibrary("raycolor", "raycolor.zig");
{
var exe = b.addExecutable("selfie-invaders", "selfie-invaders/main.zig");
exe.setBuildMode(mode);
exe.addIncludeDir("raylib/src");
exe.addPackagePath("ray", "ray.zig");
exe.addPackagePath("puffy", "puffy/src/puffy.zig");
// if (windows) {
// exe.setTarget(builtin.Arch.x86_64, builtin.Os.windows, builtin.Abi.gnu);
// }
// exe.addPackagePath("zang", "zang/src/zang.zig");
const raylibFlags = [_][]const u8{"-std=c99",
"-DPLATFORM=DESKTOP",
"-DPLATFORM_DESKTOP",
"-DGRAPHICS=GRAPHICS_API_OPENGL_33",
"-D_GLFW_X11",
"-D_DEFAULT_SOURCE",
"-Iraylib/src",
"-Iraylib/src/external/glfw/include",
"-Iraylib/src/external/glfw/deps"};
exe.addCSourceFile("raylib/src/core.c", raylibFlags);
exe.addCSourceFile("raylib/src/models.c", raylibFlags);
exe.addCSourceFile("raylib/src/raudio.c", raylibFlags);
exe.addCSourceFile("raylib/src/rglfw.c", raylibFlags);
exe.addCSourceFile("raylib/src/shapes.c", raylibFlags);
exe.addCSourceFile("raylib/src/text.c", raylibFlags);
exe.addCSourceFile("raylib/src/textures.c", raylibFlags);
exe.addCSourceFile("raylib/src/utils.c", raylibFlags);
exe.linkSystemLibrary("X11");
exe.linkSystemLibrary("GL");
exe.linkSystemLibrary("m");
exe.linkSystemLibrary("pthread");
exe.linkSystemLibrary("dl");
exe.linkSystemLibrary("rt");
exe.linkSystemLibrary("c");
// const assets_path = std.fs.path.join(b.allocator, [][]const u8{b.build_root, "assets"});
// exe.addBuildOption([]const u8, "assets_path", b.fmt("\"{}\"", assets_path));
// exe.setOutputDir("zig-cache");
b.default_step.dependOn(&exe.step);
b.installArtifact(exe);
const play = b.step("selfie", "Play Selfie Invaders");
const run = exe.run();
play.dependOn(&run.step);
}
}