const std = @import("std"); pub const Options = struct { root_source_file: std.Build.LazyPath, target: std.Build.ResolvedTarget, }; mod: *std.Build.Module, wasm: struct { mod: *std.Build.Module, exe: *std.Build.Step.Compile, }, 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 = wasm_module, }); exe.rdynamic = true; exe.entry = .disabled; return .{ .mod = module, .wasm = .{ .exe = exe, .mod = wasm_module, }, }; } pub fn getEmittedWasm(self: *const @This()) std.Build.LazyPath { return self.wasm.exe.getEmittedBin(); }