-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.zig
40 lines (32 loc) · 925 Bytes
/
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
// SPDX-FileCopyrightText: NONE
// SPDX-License-Identifier: CC0-1.0
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "snake",
.target = target,
.optimize = optimize,
});
exe.addCSourceFiles(.{
.files = &.{
"snake.c",
},
.flags = &.{
"-Wall",
"-Werror",
},
});
const sdl_dep = b.dependency("sdl", .{
.target = target,
.optimize = optimize,
});
const sdl_lib = sdl_dep.artifact("SDL3");
exe.root_module.linkLibrary(sdl_lib);
b.installArtifact(exe);
const run_exe = b.addRunArtifact(exe);
run_exe.step.dependOn(b.getInstallStep());
const run = b.step("run", "Run the game");
run.dependOn(&run_exe.step);
}