summary refs log tree commit diff
path: root/build.zig
blob: 7294e1a448b413f6d03ce25fa956b3f1deb956f7 (plain) (blame)
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
const std = @import("std");

pub fn build(b: *std.build.Builder) void {
    const exe = b.addExecutable("blackshades", "src/main.zig");
    exe.addIncludeDir("src");

    const cxxflags = [_][]const u8{ "--std=c++17" };
    exe.addCSourceFile("src/Camera.cpp", &cxxflags);
    exe.addCSourceFile("src/Decals.cpp", &cxxflags);
    exe.addCSourceFile("src/Fog.cpp", &cxxflags);
    exe.addCSourceFile("src/Frustum.cpp", &cxxflags);
    exe.addCSourceFile("src/GameDraw.cpp", &cxxflags);
    exe.addCSourceFile("src/GameInitDispose.cpp", &cxxflags);
    exe.addCSourceFile("src/GameLoop.cpp", &cxxflags);
    exe.addCSourceFile("src/GameTick.cpp", &cxxflags);
    exe.addCSourceFile("src/Globals.cpp", &cxxflags);
    exe.addCSourceFile("src/Models.cpp", &cxxflags);
    exe.addCSourceFile("src/Person.cpp", &cxxflags);
    exe.addCSourceFile("src/Quaternions.cpp", &cxxflags);
    exe.addCSourceFile("src/Serialize.cpp", &cxxflags);
    exe.addCSourceFile("src/Skeleton.cpp", &cxxflags);
    exe.addCSourceFile("src/Sprites.cpp", &cxxflags);
    exe.addCSourceFile("src/Support.cpp", &cxxflags);
    exe.addCSourceFile("src/Text.cpp", &cxxflags);
    exe.addCSourceFile("src/Textures.cpp", &cxxflags);

    exe.addPackage(.{ .name = "gfz", .path = "lib/gfz/src/gfz.zig" });
    exe.linkSystemLibrary("glfw");
    exe.addPackage(.{ .name = "ini", .path = "lib/ini/src/ini.zig" });
    exe.addPackage(.{ .name = "loca", .path = "lib/loca/src/main.zig" });
    exe.addPackage(.{ .name = "zeal", .path = "lib/zeal/src/zeal.zig" });
    exe.linkSystemLibrary("openal");

    exe.linkSystemLibrary("GL");
    exe.linkSystemLibrary("GLU");
    exe.linkSystemLibrary("c++");
    exe.linkSystemLibrary("vorbisfile");

    // Standard target options allows the person running `zig build` to choose
    // what target to build for. Here we do not override the defaults, which
    // means any target is allowed, and the default is native. Other options
    // for restricting supported target set are available.
    exe.setTarget(b.standardTargetOptions(.{}));

    // Standard release options allow the person running `zig build` to select
    // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
    exe.setBuildMode(b.standardReleaseOptions());

    exe.install();

    const run_cmd = exe.run();
    run_cmd.step.dependOn(b.getInstallStep());
    if (b.args) |args| {
        run_cmd.addArgs(args);
    }

    const run_step = b.step("run", "Run the app");
    run_step.dependOn(&run_cmd.step);
}