~mil/mepo

ref: 2d98a3a6ad81ed0fb6894ab376561e180f067ba9 mepo/build.zig -rw-r--r-- 1.3 KiB
2d98a3a6Miles Alan Fix download mode; download_request wasn't being passed properly 4 months ago
                                                                                
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
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;

fn setDependencies(step: *std.build.LibExeObjStep) void {
    step.linkSystemLibrary("c");
    step.linkSystemLibrary("SDL2");
    step.linkSystemLibrary("SDL2_gfx");
    step.linkSystemLibrary("SDL2_image");
    step.linkSystemLibrary("SDL2_ttf");
    step.linkSystemLibrary("curl");
}

pub fn build(b: *Builder) void {
    b.installDirectory(.{
        .source_dir = "scripts",
        .install_dir = .{ .bin = .{} },
        .install_subdir = "",
    });
    b.installFile("assets/mepo.desktop", "share/applications/mepo.desktop");
    b.installFile("assets/mepo.png", "share/pixmaps/mepo.png");

    const exe = b.addExecutable("mepo", "src/main.zig");

    const target = b.standardTargetOptions(.{});
    const mode = b.standardReleaseOptions();
    exe.setTarget(target);
    exe.setBuildMode(mode);

    setDependencies(exe);

    exe.install();

    const run_cmd = exe.run();
    run_cmd.step.dependOn(b.getInstallStep());

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

    // Setup test
    const test_all_step = b.step("test", "Run all tests.");
    const run_tests = b.addTest("./src/test.zig");
    setDependencies(run_tests);
    test_all_step.dependOn(&run_tests.step);
}