glfw: eliminate system-sdk for linux and windows
use the package manager instead Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
4c7824fc75
commit
6ee026ff5e
3 changed files with 42 additions and 10 deletions
39
build.zig
39
build.zig
|
@ -83,14 +83,7 @@ pub fn link(b: *Build, step: *std.build.CompileStep, options: Options) !void {
|
|||
step.linkLibrary(lib);
|
||||
addGLFWIncludes(step);
|
||||
linkGLFWDependencies(b, step, options);
|
||||
if (step.target_info.target.os.tag != .windows) system_sdk.include(b, step, options.system_sdk);
|
||||
if (step.target_info.target.os.tag == .windows) {
|
||||
step.linkLibrary(b.dependency("direct3d_headers", .{
|
||||
.target = step.target,
|
||||
.optimize = step.optimize,
|
||||
}).artifact("direct3d-headers"));
|
||||
@import("direct3d_headers").addLibraryPath(step);
|
||||
}
|
||||
if (step.target_info.target.os.tag == .macos) system_sdk.include(b, step, options.system_sdk);
|
||||
}
|
||||
|
||||
fn buildLibrary(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.CrossTarget, options: Options) !*std.build.CompileStep {
|
||||
|
@ -117,7 +110,6 @@ fn buildLibrary(b: *Build, optimize: std.builtin.OptimizeMode, target: std.zig.C
|
|||
|
||||
fn addGLFWIncludes(step: *std.build.CompileStep) void {
|
||||
step.addIncludePath(sdkPath("/upstream/glfw/include"));
|
||||
step.addIncludePath(sdkPath("/upstream/vulkan_headers/include"));
|
||||
step.addIncludePath(sdkPath("/src"));
|
||||
}
|
||||
|
||||
|
@ -162,8 +154,35 @@ fn addGLFWSources(b: *Build, lib: *std.build.CompileStep, options: Options) std.
|
|||
}
|
||||
|
||||
fn linkGLFWDependencies(b: *Build, step: *std.build.CompileStep, options: Options) void {
|
||||
if (step.target_info.target.os.tag == .windows) {
|
||||
step.linkLibrary(b.dependency("direct3d_headers", .{
|
||||
.target = step.target,
|
||||
.optimize = step.optimize,
|
||||
}).artifact("direct3d-headers"));
|
||||
}
|
||||
if (options.x11) {
|
||||
step.linkLibrary(b.dependency("x11_headers", .{
|
||||
.target = step.target,
|
||||
.optimize = step.optimize,
|
||||
}).artifact("x11-headers"));
|
||||
}
|
||||
if (options.vulkan) {
|
||||
step.linkLibrary(b.dependency("vulkan_headers", .{
|
||||
.target = step.target,
|
||||
.optimize = step.optimize,
|
||||
}).artifact("vulkan-headers"));
|
||||
}
|
||||
if (options.wayland) {
|
||||
step.defineCMacro("WL_MARSHAL_FLAG_DESTROY", null);
|
||||
step.linkLibrary(b.dependency("wayland_headers", .{
|
||||
.target = step.target,
|
||||
.optimize = step.optimize,
|
||||
}).artifact("wayland-headers"));
|
||||
}
|
||||
if (step.target_info.target.os.tag == .windows) @import("direct3d_headers").addLibraryPath(step);
|
||||
|
||||
step.linkLibC();
|
||||
if (step.target_info.target.os.tag != .windows) system_sdk.include(b, step, options.system_sdk);
|
||||
if (step.target_info.target.os.tag == .macos) system_sdk.include(b, step, options.system_sdk);
|
||||
switch (step.target_info.target.os.tag) {
|
||||
.windows => {
|
||||
step.linkSystemLibraryName("gdi32");
|
||||
|
|
|
@ -6,5 +6,17 @@
|
|||
.url = "https://github.com/hexops/direct3d-headers/archive/773dce3f079eecdccc7c71d1318a0741649d568b.tar.gz",
|
||||
.hash = "12200d2155216c5eb5f111282cd355b5433cad6a68fd040294e695149cba329f7c12",
|
||||
},
|
||||
.vulkan_headers = .{
|
||||
.url = "https://github.com/hexops/vulkan-headers/archive/e1b061ff624531e82a7daea5dbd56c07e08bf0be.tar.gz",
|
||||
.hash = "12204967f9d07fda3af6a21d6ab71fb832da2186176c530a7a14aa96043537399e6b",
|
||||
},
|
||||
.wayland_headers = .{
|
||||
.url = "https://github.com/hexops/wayland-headers/archive/7bf46f3d60edab2171643ff85770c392ef62704d.tar.gz",
|
||||
.hash = "1220689912c40c0880b094f748199c490810d4fa4c58ce1ef9058ce97f46ee28496a",
|
||||
},
|
||||
.x11_headers = .{
|
||||
.url = "https://github.com/hexops/x11-headers/archive/1db4df130531c6889df664541bc62161510b9189.tar.gz",
|
||||
.hash = "12208b3ccaec785e9344472c08bada6137d60666f0d52fc8cf62aae4251056db7737",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
pub const c = @cImport({
|
||||
@cDefine("GLFW_INCLUDE_VULKAN", "1");
|
||||
@cDefine("GLFW_INCLUDE_NONE", "1");
|
||||
@cInclude("GLFW/glfw3.h");
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue