Skip to content

Commit 2c94a9e

Browse files
committed
build: add -Dx86 option to enable x86 backend
see https://ziglang.org/download/0.12.0/release-notes.html#x86-Backend
1 parent 6e5f67c commit 2c94a9e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

build.zig

+12
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pub fn build(b: *std.Build) !void {
4747

4848
const options = try jsruntime.buildOptions(b);
4949

50+
const x86 = b.option(bool, "x86", "Use x86 backend") orelse false;
51+
5052
// browser
5153
// -------
5254

@@ -56,6 +58,8 @@ pub fn build(b: *std.Build) !void {
5658
.root_source_file = b.path("src/main.zig"),
5759
.target = target,
5860
.optimize = mode,
61+
.use_llvm = !x86,
62+
.use_lld = !x86,
5963
});
6064
try common(b, exe, options);
6165
b.installArtifact(exe);
@@ -79,6 +83,8 @@ pub fn build(b: *std.Build) !void {
7983
.root_source_file = b.path("src/main_shell.zig"),
8084
.target = target,
8185
.optimize = mode,
86+
.use_llvm = !x86,
87+
.use_lld = !x86,
8288
});
8389
try common(b, shell, options);
8490
try jsruntime_pkgs.add_shell(shell);
@@ -102,6 +108,8 @@ pub fn build(b: *std.Build) !void {
102108
.test_runner = b.path("src/test_runner.zig"),
103109
.target = target,
104110
.optimize = mode,
111+
.use_llvm = !x86,
112+
.use_lld = !x86,
105113
});
106114
try common(b, tests, options);
107115

@@ -128,6 +136,8 @@ pub fn build(b: *std.Build) !void {
128136
.root_source_file = b.path("src/main_wpt.zig"),
129137
.target = target,
130138
.optimize = mode,
139+
.use_llvm = !x86,
140+
.use_lld = !x86,
131141
});
132142
try common(b, wpt, options);
133143

@@ -149,6 +159,8 @@ pub fn build(b: *std.Build) !void {
149159
.root_source_file = b.path("src/main_get.zig"),
150160
.target = target,
151161
.optimize = mode,
162+
.use_llvm = !x86,
163+
.use_lld = !x86,
152164
});
153165
try common(b, get, options);
154166
b.installArtifact(get);

0 commit comments

Comments
 (0)