aboutsummaryrefslogtreecommitdiff
path: root/src/z/AppBundle.zig
blob: 3fec9fbb96e9ec2f2eb52b17dbcb682e8ea9f73c (plain)
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
const std = @import("std");

pub const Options = struct {
    root_source_file: std.Build.LazyPath,
};

mod: *std.Build.Module,
wasm: *std.Build.Step.Compile,

pub fn init(b: *std.Build, options: Options) @This() {
    const module = b.createModule(.{
        .root_source_file = options.root_source_file,
        .target = b.resolveTargetQuery(.{
            .cpu_arch = .wasm32,
            .os_tag = .freestanding,
        }),
    });

    const exe = b.addExecutable(.{
        .name = "runtime",
        .root_module = module,
    });

    exe.rdynamic = true;
    exe.entry = .disabled;

    return .{
        .wasm = exe,
        .mod = module,
    };
}

pub fn getEmittedWasm(self: *const @This()) std.Build.LazyPath {
    return self.wasm.getEmittedBin();
}