Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
fel1x-developer committed Jan 15, 2025
1 parent b3dbc14 commit f6c8def
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ pub fn build(b: *Build) !void {
{
var step = b.step("windows-shim", "Build the Windows shim (bun_shim_impl.exe + bun_shim_debug.exe)");
var windows_shim = build_options.windowsShim(b);
// step.addOption(bool, "is_standalone", true);
step.dependOn(&b.addInstallFile(windows_shim.exe.getEmittedBin(), "bun_shim_impl.exe").step);
step.dependOn(&b.addInstallFile(windows_shim.dbg.getEmittedBin(), "bun_shim_debug.exe").step);
}
Expand Down Expand Up @@ -628,6 +629,12 @@ const WindowsShim = struct {
.link_libc = false,
});

const options = b.addOptions();
options.addOption(bool, "is_standalone", true);

exe.root_module.addOptions("windows_shim", options);
dbg.root_module.addOptions("windows_shim", options);

return .{ .exe = exe, .dbg = dbg };
}
};
2 changes: 1 addition & 1 deletion src/install/windows-shim/bun_shim_impl.zig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const w = std.os.windows;
const assert = std.debug.assert;
const fmt16 = std.unicode.fmtUtf16le;

const is_standalone = !@hasDecl(@import("root"), "JavaScriptCore");
const is_standalone = !@hasDecl(@import("windows_shim"), "is_standalone");
const bun = if (!is_standalone) @import("root").bun else @compileError("cannot use 'bun' in standalone build of bun_shim_impl");
const bunDebugMessage = bun.Output.scoped(.bun_shim_impl, true);
const callmod_inline = if (is_standalone) std.builtin.CallModifier.always_inline else bun.callmod_inline;
Expand Down

0 comments on commit f6c8def

Please sign in to comment.