forked from Not-Nik/raylib-zig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
executable file
·93 lines (84 loc) · 2.73 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// build
// Zig version: 0.9.0
// Author: Nikolas Wipper
// Date: 2020-02-15
//
const std = @import("std");
const Builder = std.build.Builder;
const raylib = @import("lib.zig");
const Program = struct {
name: []const u8,
path: []const u8,
desc: []const u8,
};
pub fn build(b: *Builder) void {
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const examples = [_]Program{
.{
.name = "basic_window",
.path = "examples/core/basic_window.zig",
.desc = "Creates a basic window with text",
},
.{
.name = "input_keys",
.path = "examples/core/input_keys.zig",
.desc = "Simple keyboard input",
},
.{
.name = "input_mouse",
.path = "examples/core/input_mouse.zig",
.desc = "Simple mouse input",
},
.{
.name = "input_mouse_wheel",
.path = "examples/core/input_mouse_wheel.zig",
.desc = "Mouse wheel input",
},
.{
.name = "input_multitouch",
.path = "examples/core/input_multitouch.zig",
.desc = "Multitouch input",
},
.{
.name = "2d_camera",
.path = "examples/core/2d_camera.zig",
.desc = "Shows the functionality of a 2D camera",
},
.{
.name = "sprite_anim",
.path = "examples/textures/sprite_anim.zig",
.desc = "Animate a sprite",
},
.{
.name = "texture_outline",
.path = "examples/shaders/texture_outline.zig",
.desc = "Uses a shader to create an outline around a sprite",
}
// .{
// .name = "models_loading",
// .path = "examples/models/models_loading.zig",
// .desc = "Loads a model and renders it",
// },
// .{
// .name = "shaders_basic_lighting",
// .path = "examples/shaders/shaders_basic_lighting.zig",
// .desc = "Loads a model and renders it",
// },
};
const examples_step = b.step("examples", "Builds all the examples");
const system_lib = b.option(bool, "system-raylib", "link to preinstalled raylib libraries") orelse false;
for (examples) |ex| {
const exe = b.addExecutable(ex.name, ex.path);
exe.setBuildMode(mode);
exe.setTarget(target);
raylib.link(exe, system_lib);
raylib.addAsPackage("raylib", exe);
raylib.math.addAsPackage("raylib-math", exe);
const run_cmd = exe.run();
const run_step = b.step(ex.name, ex.desc);
run_step.dependOn(&run_cmd.step);
examples_step.dependOn(&exe.step);
}
}