Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: fix and enable wayland #1268

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,32 @@ pub fn build(b: *std.Build) !void {
if (want_examples) try buildExamples(b, optimize, target, module);
}
if (want_core) {
if (Platform.fromTarget(target.result) == .linux) {
const lib = b.addStaticLibrary(.{
.name = "core-wayland",
.target = target,
.optimize = optimize,
});
lib.addCSourceFile(.{
.file = b.path("src/core/linux/wayland.c"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed because translate-c can't handle some of the types in the header, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #1269 as a follow-up issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure that's the issue, yeah.

});
lib.linkLibC();
module.linkLibrary(lib);

if (b.lazyDependency("wayland_headers", .{
.target = target,
.optimize = optimize,
})) |dep| {
lib.linkLibrary(dep.artifact("wayland-headers"));
module.linkLibrary(dep.artifact("wayland-headers"));
}
if (b.lazyDependency("x11_headers", .{
.target = target,
.optimize = optimize,
})) |dep| {
module.linkLibrary(dep.artifact("x11-headers"));
}
}
if (target.result.isDarwin()) {
if (b.lazyDependency("mach_objc", .{
.target = target,
Expand Down
5 changes: 3 additions & 2 deletions src/Core.zig
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,15 @@ fn init(core: *Mod, entities: *mach.Entities.Mod) !void {
var events = EventQueue.init(allocator);
try events.ensureTotalCapacity(8192);

// TODO: remove undefined initialization (disgusting!)
const platform: Platform = undefined;
core.init(.{
.allocator = allocator,
.main_window = main_window,
.events = events,
.input_state = .{},

// TODO: remove undefined initialization (disgusting!)
.platform = undefined,
joshua-holmes marked this conversation as resolved.
Show resolved Hide resolved
.platform = platform,

// TODO: these should not be state, they should be components.
.title = title,
Expand Down
Loading
Loading