diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-06 14:12:03 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2026-10-06 14:12:03 +0200 |
| commit | a4b2398aba2211ce5901ceb46f73057864bd1707 (patch) | |
| tree | 99c3d277ad991c189bf342238509be59b36b7889 /src/z/AppBundle.zig | |
| parent | dccd1987b418e47b4b82eda3aeaed40be18d9e45 (diff) | |
add global registry
Diffstat (limited to 'src/z/AppBundle.zig')
| -rw-r--r-- | src/z/AppBundle.zig | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/z/AppBundle.zig b/src/z/AppBundle.zig index 3fec9fb..a99de2c 100644 --- a/src/z/AppBundle.zig +++ b/src/z/AppBundle.zig @@ -2,34 +2,48 @@ const std = @import("std"); pub const Options = struct { root_source_file: std.Build.LazyPath, + target: std.Build.ResolvedTarget, }; mod: *std.Build.Module, -wasm: *std.Build.Step.Compile, +wasm: struct { + mod: *std.Build.Module, + exe: *std.Build.Step.Compile, +}, -pub fn init(b: *std.Build, options: Options) @This() { - const module = b.createModule(.{ +pub fn init(b: *std.Build, options: Options, z_mod: anytype) @This() { + const module = b.addModule("site", .{ + .root_source_file = options.root_source_file, + .target = options.target, + .imports = &.{ .{ .name = "z", .module = z_mod } }, + }); + + const wasm_module = b.createModule(.{ .root_source_file = options.root_source_file, .target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding, }), + .imports = &.{ .{ .name = "z", .module = z_mod } }, }); const exe = b.addExecutable(.{ .name = "runtime", - .root_module = module, + .root_module = wasm_module, }); exe.rdynamic = true; exe.entry = .disabled; return .{ - .wasm = exe, .mod = module, + .wasm = .{ + .exe = exe, + .mod = wasm_module, + }, }; } pub fn getEmittedWasm(self: *const @This()) std.Build.LazyPath { - return self.wasm.getEmittedBin(); + return self.wasm.exe.getEmittedBin(); } |