[build.zig] GLFW Platform Detection Support (#4150)
* Zig Both Linux Desktop Platform Support * Formating and Default Fix Made formating fit within raylib standards and changed the default option to support both X11 and wayland on Linux. * caught one hiding tab
This commit is contained in:
parent
74680748b9
commit
44c6cd2d37
1 changed files with 20 additions and 21 deletions
|
@ -117,13 +117,13 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
|
|
||||||
raylib.addLibraryPath(.{ .cwd_relative = "/usr/lib" });
|
raylib.addLibraryPath(.{ .cwd_relative = "/usr/lib" });
|
||||||
raylib.addIncludePath(.{ .cwd_relative = "/usr/include" });
|
raylib.addIncludePath(.{ .cwd_relative = "/usr/include" });
|
||||||
|
if (options.linux_display_backend == .X11 or options.linux_display_backend == .Both) {
|
||||||
|
|
||||||
switch (options.linux_display_backend) {
|
|
||||||
.X11 => {
|
|
||||||
raylib.defineCMacro("_GLFW_X11", null);
|
raylib.defineCMacro("_GLFW_X11", null);
|
||||||
raylib.linkSystemLibrary("X11");
|
raylib.linkSystemLibrary("X11");
|
||||||
},
|
}
|
||||||
.Wayland => {
|
|
||||||
|
if (options.linux_display_backend == .Wayland or options.linux_display_backend == .Both) {
|
||||||
raylib.defineCMacro("_GLFW_WAYLAND", null);
|
raylib.defineCMacro("_GLFW_WAYLAND", null);
|
||||||
raylib.linkSystemLibrary("wayland-client");
|
raylib.linkSystemLibrary("wayland-client");
|
||||||
raylib.linkSystemLibrary("wayland-cursor");
|
raylib.linkSystemLibrary("wayland-cursor");
|
||||||
|
@ -139,9 +139,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
|
||||||
waylandGenerate(b, raylib, "fractional-scale-v1.xml", "fractional-scale-v1-client-protocol");
|
waylandGenerate(b, raylib, "fractional-scale-v1.xml", "fractional-scale-v1-client-protocol");
|
||||||
waylandGenerate(b, raylib, "xdg-activation-v1.xml", "xdg-activation-v1-client-protocol");
|
waylandGenerate(b, raylib, "xdg-activation-v1.xml", "xdg-activation-v1-client-protocol");
|
||||||
waylandGenerate(b, raylib, "idle-inhibit-unstable-v1.xml", "idle-inhibit-unstable-v1-client-protocol");
|
waylandGenerate(b, raylib, "idle-inhibit-unstable-v1.xml", "idle-inhibit-unstable-v1-client-protocol");
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
raylib.defineCMacro("PLATFORM_DESKTOP", null);
|
||||||
} else {
|
} else {
|
||||||
if (options.opengl_version == .auto) {
|
if (options.opengl_version == .auto) {
|
||||||
|
@ -253,7 +251,7 @@ pub const Options = struct {
|
||||||
raygui: bool = false,
|
raygui: bool = false,
|
||||||
platform_drm: bool = false,
|
platform_drm: bool = false,
|
||||||
shared: bool = false,
|
shared: bool = false,
|
||||||
linux_display_backend: LinuxDisplayBackend = .X11,
|
linux_display_backend: LinuxDisplayBackend = .Both,
|
||||||
opengl_version: OpenglVersion = .auto,
|
opengl_version: OpenglVersion = .auto,
|
||||||
|
|
||||||
raygui_dependency_name: []const u8 = "raygui",
|
raygui_dependency_name: []const u8 = "raygui",
|
||||||
|
@ -284,6 +282,7 @@ pub const OpenglVersion = enum {
|
||||||
pub const LinuxDisplayBackend = enum {
|
pub const LinuxDisplayBackend = enum {
|
||||||
X11,
|
X11,
|
||||||
Wayland,
|
Wayland,
|
||||||
|
Both,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue