Implemented wayland initialization code

This commit is contained in:
Lorenzo Torres 2025-08-03 23:23:03 +02:00
parent f43e03d6f3
commit f894fb317d
10 changed files with 244 additions and 155 deletions

View file

@ -6,58 +6,6 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const glfw_module = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
});
const glfw = b.addLibrary(.{
.name = "glfw",
.root_module = glfw_module,
});
glfw_module.addCSourceFiles(.{ .files = &[_][]const u8{
"ext/glfw/src/cocoa_init.m",
"ext/glfw/src/cocoa_joystick.m",
"ext/glfw/src/cocoa_monitor.m",
"ext/glfw/src/cocoa_time.c",
"ext/glfw/src/cocoa_window.m",
"ext/glfw/src/context.c",
"ext/glfw/src/egl_context.c",
"ext/glfw/src/glx_context.c",
"ext/glfw/src/init.c",
"ext/glfw/src/input.c",
"ext/glfw/src/linux_joystick.c",
"ext/glfw/src/monitor.c",
"ext/glfw/src/nsgl_context.m",
"ext/glfw/src/null_init.c",
"ext/glfw/src/null_joystick.c",
"ext/glfw/src/null_monitor.c",
"ext/glfw/src/null_window.c",
"ext/glfw/src/osmesa_context.c",
"ext/glfw/src/platform.c",
"ext/glfw/src/posix_module.c",
"ext/glfw/src/posix_poll.c",
"ext/glfw/src/posix_thread.c",
"ext/glfw/src/posix_time.c",
"ext/glfw/src/vulkan.c",
"ext/glfw/src/wgl_context.c",
"ext/glfw/src/win32_init.c",
"ext/glfw/src/win32_joystick.c",
"ext/glfw/src/win32_module.c",
"ext/glfw/src/win32_monitor.c",
"ext/glfw/src/win32_thread.c",
"ext/glfw/src/win32_time.c",
"ext/glfw/src/win32_window.c",
"ext/glfw/src/window.c",
"ext/glfw/src/wl_init.c",
"ext/glfw/src/wl_monitor.c",
"ext/glfw/src/wl_window.c",
"ext/glfw/src/x11_init.c",
"ext/glfw/src/x11_monitor.c",
"ext/glfw/src/x11_window.c",
"ext/glfw/src/xkb_unicode.c",
}, .flags = &[_][]const u8{ "-D_GLFW_X11", "-Wall", "-Wextra" } });
const sideros = b.createModule(.{
.root_source_file = b.path("src/sideros.zig"),
.target = target,
@ -88,7 +36,6 @@ pub fn build(b: *std.Build) void {
renderer.addImport("ecs", ecs);
ecs.addImport("renderer", renderer);
renderer.addIncludePath(b.path("ext/glfw/include"));
compileAllShaders(b, renderer);
sideros.addImport("mods", mods);
@ -104,10 +51,11 @@ pub fn build(b: *std.Build) void {
}),
});
exe.root_module.addImport("sideros", sideros);
exe.root_module.addCSourceFile(.{ .file = b.path("ext/xdg-shell.c") });
exe.root_module.addIncludePath(b.path("ext"));
exe.linkSystemLibrary("vulkan");
exe.linkSystemLibrary("wayland-client");
exe.linkLibrary(glfw);
exe.linkLibC();
b.installArtifact(exe);