Skip to content

Commit 315b7f2

Browse files
authored
Merge pull request #183 from natecraddock/push-kwyolnyrkptk
fix(build): define LUAJIT_OS for windows to build PE Object
2 parents af97085 + e464ce9 commit 315b7f2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build/luajit.zig

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,22 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
127127

128128
const buildvm_c_flags: []const []const u8 = switch (target.result.cpu.arch) {
129129
.aarch64, .aarch64_be => &.{ "-DLUAJIT_TARGET=LUAJIT_ARCH_arm64", "-DLJ_ARCH_HASFPU=1", "-DLJ_ABI_SOFTFP=0" },
130-
.x86_64 => &.{ "-DLUAJIT_TARGET=LUAJIT_ARCH_X64" },
130+
.x86_64 => &.{"-DLUAJIT_TARGET=LUAJIT_ARCH_X64"},
131131
else => &.{},
132132
};
133133

134+
const buildvm_windows_c_flags: []const []const u8 = if (target.result.os.tag == .windows)
135+
&.{"-DLUAJIT_OS=1"}
136+
else
137+
&.{};
138+
134139
buildvm.addCSourceFiles(.{
135140
.root = .{ .dependency = .{
136141
.dependency = upstream,
137142
.sub_path = "",
138143
} },
139144
.files = &.{ "src/host/buildvm_asm.c", "src/host/buildvm_fold.c", "src/host/buildvm_lib.c", "src/host/buildvm_peobj.c", "src/host/buildvm.c" },
140-
.flags = buildvm_c_flags,
145+
.flags = std.mem.concat(b.allocator, []const u8, &.{ buildvm_c_flags, buildvm_windows_c_flags }) catch @panic("OOM!"),
141146
});
142147

143148
buildvm.addIncludePath(upstream.path("src"));

0 commit comments

Comments
 (0)