i think we cracked the code on getting some linux builds working
This commit is contained in:
parent
ea14d8941d
commit
a7505acf8b
|
|
@ -11,7 +11,7 @@ pub const revision = formatted_version ++ " (" ++ vendor_info ++ ")";
|
|||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
var preferred_linkage: std.builtin.LinkMode = b.option(
|
||||
const preferred_linkage: std.builtin.LinkMode = b.option(
|
||||
std.builtin.LinkMode,
|
||||
"preferred_linkage",
|
||||
"Prefer building statically or dynamically linked libraries (default: static)",
|
||||
|
|
@ -21,7 +21,6 @@ pub fn build(b: *std.Build) void {
|
|||
"Deprecated; use 'preferred_linkage' instead",
|
||||
) orelse .static;
|
||||
|
||||
preferred_linkage = .dynamic;
|
||||
const strip = b.option(
|
||||
bool,
|
||||
"strip",
|
||||
|
|
@ -546,7 +545,7 @@ pub fn build(b: *std.Build) void {
|
|||
.pic = pic,
|
||||
});
|
||||
const sdl_lib = b.addLibrary(.{
|
||||
.linkage = .dynamic, //if (emscripten) .static else preferred_linkage,
|
||||
.linkage = if (emscripten) .static else preferred_linkage,
|
||||
.name = "SDL3",
|
||||
.root_module = sdl_mod,
|
||||
.version = .{
|
||||
|
|
|
|||
|
|
@ -42,9 +42,28 @@ pub fn build(b: *std.Build) void {
|
|||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
var linux = false;
|
||||
var windows = false;
|
||||
var macos = false;
|
||||
switch (target.result.os.tag) {
|
||||
.windows => {
|
||||
windows = true;
|
||||
},
|
||||
.linux => {
|
||||
linux = true;
|
||||
},
|
||||
.macos => {
|
||||
macos = true;
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
const preferred_linkage: std.builtin.LinkMode = if (linux) .static else .dynamic;
|
||||
|
||||
const sdl_dep = b.dependency("sdl", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.preferred_linkage = preferred_linkage,
|
||||
});
|
||||
|
||||
const sdl3_lib = sdl_dep.artifact("SDL3");
|
||||
|
|
|
|||
Loading…
Reference in New Issue