Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine all library files into a single lib.zig #54

Merged
merged 5 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,7 @@ pub fn build(b: *Build) void {

// Zig module
const ziglua = b.addModule("ziglua", .{
.root_source_file = switch (lang) {
.lua51 => .{ .path = "src/lib51.zig" },
.lua52 => .{ .path = "src/lib52.zig" },
.lua53 => .{ .path = "src/lib53.zig" },
.lua54 => .{ .path = "src/lib54.zig" },
.luajit => .{ .path = "src/lib51.zig" },
.luau => .{ .path = "src/libluau.zig" },
},
.root_source_file = .{ .path = "src/lib.zig" },
});

// Expose build configuration to the ziglua module
Expand Down Expand Up @@ -116,14 +109,7 @@ pub fn build(b: *Build) void {
}

const docs = b.addTest(.{
.root_source_file = switch (lang) {
.lua51 => .{ .path = "src/lib51.zig" },
.lua52 => .{ .path = "src/lib52.zig" },
.lua53 => .{ .path = "src/lib53.zig" },
.lua54 => .{ .path = "src/lib54.zig" },
.luajit => .{ .path = "src/lib51.zig" },
.luau => .{ .path = "src/libluau.zig" },
},
.root_source_file = .{ .path = "src/lib.zig" },
});
docs.root_module.addOptions("config", config);

Expand Down Expand Up @@ -271,7 +257,7 @@ fn buildLuaJIT(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.Op
});
minilua.linkLibC();
minilua.root_module.sanitize_c = false;
minilua.addCSourceFile(.{.file = upstream.path("src/host/minilua.c")});
minilua.addCSourceFile(.{ .file = upstream.path("src/host/minilua.c") });

// Generate the buildvm_arch.h file using minilua
const dynasm_run = b.addRunArtifact(minilua);
Expand All @@ -296,7 +282,7 @@ fn buildLuaJIT(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.Op
dynasm_run.addArg("-o");
const buildvm_arch_h = dynasm_run.addOutputFileArg("buildvm_arch.h");

dynasm_run.addFileArg(upstream.path(switch(target.result.cpu.arch) {
dynasm_run.addFileArg(upstream.path(switch (target.result.cpu.arch) {
.x86 => "src/vm_x86.dasc",
.x86_64 => "src/vm_x64.dasc",
.arm, .armeb => "src/vm_arm.dasc",
Expand Down Expand Up @@ -483,7 +469,7 @@ const lua_54_source_files = lua_base_source_files ++ [_][]const u8{
"src/lutf8lib.c",
};

const luajit_lib = [_][]const u8 {
const luajit_lib = [_][]const u8{
"src/lib_base.c",
"src/lib_math.c",
"src/lib_bit.c",
Expand Down
Loading
Loading