mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 03:06:55 -04:00
Link Cubyz more correctly. (#461)
* Do not add cubyz_deps rpath. * link deps as object file; add macos rpaths
This commit is contained in:
parent
eabfa32dfe
commit
6ca702b67d
15
build.zig
15
build.zig
@ -27,6 +27,10 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.windows => "gnu",
|
.windows => "gnu",
|
||||||
else => "none",
|
else => "none",
|
||||||
}});
|
}});
|
||||||
|
const artifactName = switch(t.os.tag) {
|
||||||
|
.windows => b.fmt("{s}.lib", .{depsLib}),
|
||||||
|
else => b.fmt("lib{s}.a", .{depsLib}),
|
||||||
|
};
|
||||||
|
|
||||||
var depsName: []const u8 = b.fmt("cubyz_deps_{s}_{s}", .{@tagName(t.cpu.arch), @tagName(t.os.tag)});
|
var depsName: []const u8 = b.fmt("cubyz_deps_{s}_{s}", .{@tagName(t.cpu.arch), @tagName(t.os.tag)});
|
||||||
const useLocalDeps = b.option(bool, "local", "Use local cubyz_deps") orelse false;
|
const useLocalDeps = b.option(bool, "local", "Use local cubyz_deps") orelse false;
|
||||||
@ -47,10 +51,8 @@ pub fn build(b: *std.Build) !void {
|
|||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
exe.addLibraryPath(libsDeps.path("lib"));
|
|
||||||
exe.addIncludePath(headersDeps.path("include"));
|
exe.addIncludePath(headersDeps.path("include"));
|
||||||
exe.linkSystemLibrary(depsLib);
|
exe.addObjectFile(libsDeps.path("lib").path(b, artifactName));
|
||||||
exe.addRPath(libsDeps.path("lib")); // TODO: Maybe move the library next to the executable, to make this more portable?
|
|
||||||
|
|
||||||
if(t.os.tag == .windows) {
|
if(t.os.tag == .windows) {
|
||||||
exe.linkSystemLibrary("ole32");
|
exe.linkSystemLibrary("ole32");
|
||||||
@ -72,10 +74,9 @@ pub fn build(b: *std.Build) !void {
|
|||||||
exe.linkFramework("IOKit");
|
exe.linkFramework("IOKit");
|
||||||
exe.linkFramework("Cocoa");
|
exe.linkFramework("Cocoa");
|
||||||
exe.linkFramework("QuartzCore");
|
exe.linkFramework("QuartzCore");
|
||||||
exe.linkSystemLibrary("X11");
|
exe.addRPath(.{.cwd_relative = "/usr/local/GL/lib"});
|
||||||
exe.addLibraryPath(b.path("/usr/local/GL/lib"));
|
exe.root_module.addRPathSpecial("@executable_path/../Library");
|
||||||
exe.addLibraryPath(b.path("/opt/X11/lib"));
|
exe.addRPath(.{.cwd_relative = "/opt/X11/lib"});
|
||||||
exe.addRPath(b.path("../Library"));
|
|
||||||
} else {
|
} else {
|
||||||
std.log.err("Unsupported target: {}\n", .{t.os.tag});
|
std.log.err("Unsupported target: {}\n", .{t.os.tag});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user