8000 Update Ziglua to support the latest commit of Zig master by darltrash · Pull Request #119 · natecraddock/ziglua · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update Ziglua to support the latest commit of Zig master #119

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

Merged
merged 2 commits into from
Nov 9, 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
32 changes: 19 additions & 13 deletions build/lua.zig
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,28 @@ pub const Language = enum {
};

pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, upstream: *Build.Dependency, lang: Language, shared: bool) *Step.Compile {
const lib_opts = .{
.name = "lua",
.target = target,
.optimize = optimize,
.version = switch (lang) {
.lua51 => std.SemanticVersion{ .major = 5, .minor = 1, .patch = 5 },
.lua52 => std.SemanticVersion{ .major = 5, .minor = 2, .patch = 4 },
.lua53 => std.SemanticVersion{ .major = 5, .minor = 3, .patch = 6 },
.lua54 => std.SemanticVersion{ .major = 5, .minor = 4, .patch = 6 },
else => unreachable,
},
const version = switch (lang) {
.lua51 => std.SemanticVersion{ .major = 5, .minor = 1, .patch = 5 },
.lua52 => std.SemanticVersion{ .major = 5, .minor = 2, .patch = 4 },
.lua53 => std.SemanticVersion{ .major = 5, .minor = 3, .patch = 6 },
.lua54 => std.SemanticVersion{ .major = 5, .minor = 4, .patch = 6 },
else => unreachable,
};

const lib = if (shared)
b.addSharedLibrary(lib_opts)
b.addSharedLibrary(.{
.name = "lua",
.target = target,
.optimize = optimize,
.version = version,
})
else
b.addStaticLibrary(lib_opts);
b.addStaticLibrary(.{
.name = "lua",
.target = target,
.optimize = optimize,
.version = version,
});

lib.addIncludePath(upstream.path("src"));

Expand Down
18 changes: 11 additions & 7 deletions build/luajit.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ const Step = std.Build.Step;

pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, upstream: *Build.Dependency, shared: bool) *Step.Compile {
// TODO: extract this to the main build function because it is shared between all specialized build functions
const lib_opts = .{
.name = "lua",
.target = target,
.optimize = optimize,
};

const lib: *Step.Compile = if (shared)
b.addSharedLibrary(lib_opts)
b.addSharedLibrary(.{
.name = "lua",
.target = target,
.optimize = optimize,
})
else
b.addStaticLibrary(lib_opts);
b.addStaticLibrary(.{
.name = "lua",
.target = target,
.optimize = optimize,
});

// Compile minilua interpreter used at build time to generate files
const minilua = b.addExecutable(.{
Expand Down
Loading
0