{core, build}: remove glfw
This commit is contained in:
parent
539aadf664
commit
c254337e4b
6 changed files with 2 additions and 1474 deletions
18
.github/ISSUE_TEMPLATE/dev_zig_nomination.md
vendored
18
.github/ISSUE_TEMPLATE/dev_zig_nomination.md
vendored
|
|
@ -23,7 +23,6 @@ You may have been linked to this issue because you sent a pull request to update
|
||||||
* [ ] #wrench automation (`!wrench script-all install-zig`) has updated the Zig version used by self-hosted GitHub actions runners.
|
* [ ] #wrench automation (`!wrench script-all install-zig`) has updated the Zig version used by self-hosted GitHub actions runners.
|
||||||
* [ ] "First-order projects" below (which have zero build.zig.zon dependencies) have been updated, their CI is passing/green using the new version.
|
* [ ] "First-order projects" below (which have zero build.zig.zon dependencies) have been updated, their CI is passing/green using the new version.
|
||||||
* [ ] "Second-order projects" below (which have build.zig.zon dependencies) have been updated, their CI is passing/green using the new version.
|
* [ ] "Second-order projects" below (which have build.zig.zon dependencies) have been updated, their CI is passing/green using the new version.
|
||||||
* [ ] The mach-glfw build.zig version check has been updated: https://github.com/hexops/mach-glfw/blob/main/build.zig
|
|
||||||
* [ ] https://machengine.org/core/migrations/ has a new entry for Core users looking to update, or changes are not needed.
|
* [ ] https://machengine.org/core/migrations/ has a new entry for Core users looking to update, or changes are not needed.
|
||||||
* [ ] The `.zigversion` file https://github.com/hexops/mach/blob/main/.zigversion has been updated.
|
* [ ] The `.zigversion` file https://github.com/hexops/mach/blob/main/.zigversion has been updated.
|
||||||
* [ ] The mach build.zig version check has been updated: https://github.com/hexops/mach/blob/main/build.zig#L187-L192
|
* [ ] The mach build.zig version check has been updated: https://github.com/hexops/mach/blob/main/build.zig#L187-L192
|
||||||
|
|
@ -78,13 +77,6 @@ These projects have dependencies on other projects. We update them in the exact
|
||||||
* [ ] harfbuzz, which depends on:
|
* [ ] harfbuzz, which depends on:
|
||||||
* freetype
|
* freetype
|
||||||
* brotli
|
* brotli
|
||||||
* [ ] glfw, which depends on:
|
|
||||||
* xcode-frameworks
|
|
||||||
* vulkan-headers
|
|
||||||
* wayland-headers
|
|
||||||
* x11-headers
|
|
||||||
* [ ] mach-glfw, which depends on:
|
|
||||||
* glfw
|
|
||||||
* [ ] mach-dxcompiler, which depends on:
|
* [ ] mach-dxcompiler, which depends on:
|
||||||
* [ ] mach-objc, which depends on:
|
* [ ] mach-objc, which depends on:
|
||||||
* xcode-frameworks
|
* xcode-frameworks
|
||||||
|
|
@ -101,21 +93,11 @@ These projects have dependencies on other projects. We update them in the exact
|
||||||
* opusenc
|
* opusenc
|
||||||
* mach-sysaudio
|
* mach-sysaudio
|
||||||
* linux-audio-headers
|
* linux-audio-headers
|
||||||
* [ ] mach-gpu-dawn, which depends on:
|
|
||||||
* xcode-frameworks
|
|
||||||
* direct3d-headers
|
|
||||||
* vulkan-headers
|
|
||||||
* x11-headers
|
|
||||||
* [ ] mach-gpu, which depends on:
|
|
||||||
* mach-glfw
|
|
||||||
* mach-gpu-dawn
|
|
||||||
* [ ] mach, which depends on:
|
* [ ] mach, which depends on:
|
||||||
* .zigversion
|
* .zigversion
|
||||||
* build.zig version check
|
* build.zig version check
|
||||||
* mach-freetype
|
* mach-freetype
|
||||||
* font-assets
|
* font-assets
|
||||||
* mach-gpu
|
|
||||||
* mach-glfw
|
|
||||||
* mach-objc
|
* mach-objc
|
||||||
* mach-example-assets
|
* mach-example-assets
|
||||||
* spirv-cross
|
* spirv-cross
|
||||||
|
|
|
||||||
10
build.zig
10
build.zig
|
|
@ -1,6 +1,5 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const glfw = @import("mach_glfw");
|
|
||||||
|
|
||||||
pub const SysgpuBackend = enum {
|
pub const SysgpuBackend = enum {
|
||||||
default,
|
default,
|
||||||
|
|
@ -118,15 +117,11 @@ pub fn build(b: *std.Build) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = b.path("src/core/platform/wayland/wayland.c"),
|
.file = b.path("src/core/wayland/wayland.c"),
|
||||||
});
|
});
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
module.linkLibrary(lib);
|
module.linkLibrary(lib);
|
||||||
|
|
||||||
if (b.lazyDependency("mach_glfw", .{
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
})) |dep| module.addImport("mach-glfw", dep.module("mach-glfw"));
|
|
||||||
if (b.lazyDependency("x11_headers", .{
|
if (b.lazyDependency("x11_headers", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
|
@ -278,14 +273,13 @@ pub fn build(b: *std.Build) !void {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const Platform = enum {
|
pub const Platform = enum {
|
||||||
glfw,
|
|
||||||
x11,
|
x11,
|
||||||
wayland,
|
wayland,
|
||||||
web,
|
web,
|
||||||
|
|
||||||
pub fn fromTarget(target: std.Target) Platform {
|
pub fn fromTarget(target: std.Target) Platform {
|
||||||
if (target.cpu.arch == .wasm32) return .web;
|
if (target.cpu.arch == .wasm32) return .web;
|
||||||
return .glfw;
|
return .x11;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,6 @@
|
||||||
.hash = "12202b816e7c31c516bd87218fd56f9b1f93671e4ab42a2a98110d586c4b3bdd2730",
|
.hash = "12202b816e7c31c516bd87218fd56f9b1f93671e4ab42a2a98110d586c4b3bdd2730",
|
||||||
.lazy = true,
|
.lazy = true,
|
||||||
},
|
},
|
||||||
.mach_glfw = .{
|
|
||||||
.url = "https://pkg.machengine.org/mach-glfw/8da44b719e345097664ff2e0a7620474eb11db5f.tar.gz",
|
|
||||||
.hash = "1220e5343c2fe2a490aa90dc52d92fd34ebfd7d0ffc7d246dd4720bb5c339ead4d7b",
|
|
||||||
.lazy = true,
|
|
||||||
},
|
|
||||||
.mach_objc = .{
|
.mach_objc = .{
|
||||||
.url = "https://pkg.machengine.org/mach-objc/055619a732ae50ba24eb04399613be87f8432f0f.tar.gz",
|
.url = "https://pkg.machengine.org/mach-objc/055619a732ae50ba24eb04399613be87f8432f0f.tar.gz",
|
||||||
.hash = "1220211475420584a552b461dd569f891d29cb8e9e485b97053be604680c8d6e2a3e",
|
.hash = "1220211475420584a552b461dd569f891d29cb8e9e485b97053be604680c8d6e2a3e",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
const std = @import("std");
|
|
||||||
|
|
||||||
pub const Core = @import("glfw/Core.zig");
|
|
||||||
pub const Timer = std.time.Timer;
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,57 +0,0 @@
|
||||||
const builtin = @import("builtin");
|
|
||||||
|
|
||||||
// Extracted from `zig translate-c tmp.c` with `#include <objc/message.h>` in the file.
|
|
||||||
pub const SEL = opaque {};
|
|
||||||
pub const Class = opaque {};
|
|
||||||
|
|
||||||
pub extern fn sel_getUid(str: [*c]const u8) ?*SEL;
|
|
||||||
pub extern fn objc_getClass(name: [*c]const u8) ?*Class;
|
|
||||||
pub extern fn objc_msgSend() void;
|
|
||||||
|
|
||||||
pub const AutoReleasePool = if (!builtin.target.isDarwin()) opaque {
|
|
||||||
pub fn init() error{OutOfMemory}!?*AutoReleasePool {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn release(pool: ?*AutoReleasePool) void {
|
|
||||||
_ = pool;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else opaque {
|
|
||||||
pub fn init() error{OutOfMemory}!?*AutoReleasePool {
|
|
||||||
// pool = [NSAutoreleasePool alloc];
|
|
||||||
var pool = msgSend(objc_getClass("NSAutoreleasePool"), "alloc", .{}, ?*AutoReleasePool);
|
|
||||||
if (pool == null) return error.OutOfMemory;
|
|
||||||
|
|
||||||
// pool = [pool init];
|
|
||||||
pool = msgSend(pool, "init", .{}, ?*AutoReleasePool);
|
|
||||||
if (pool == null) unreachable;
|
|
||||||
|
|
||||||
return pool;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn release(pool: ?*AutoReleasePool) void {
|
|
||||||
// [pool release];
|
|
||||||
msgSend(pool, "release", .{}, void);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Borrowed from https://github.com/hazeycode/zig-objcrt
|
|
||||||
pub fn msgSend(obj: anytype, sel_name: [:0]const u8, args: anytype, comptime ReturnType: type) ReturnType {
|
|
||||||
const args_meta = @typeInfo(@TypeOf(args)).Struct.fields;
|
|
||||||
|
|
||||||
const FnType = switch (args_meta.len) {
|
|
||||||
0 => *const fn (@TypeOf(obj), ?*SEL) callconv(.C) ReturnType,
|
|
||||||
1 => *const fn (@TypeOf(obj), ?*SEL, args_meta[0].type) callconv(.C) ReturnType,
|
|
||||||
2 => *const fn (@TypeOf(obj), ?*SEL, args_meta[0].type, args_meta[1].type) callconv(.C) ReturnType,
|
|
||||||
3 => *const fn (@TypeOf(obj), ?*SEL, args_meta[0].type, args_meta[1].type, args_meta[2].type) callconv(.C) ReturnType,
|
|
||||||
4 => *const fn (@TypeOf(obj), ?*SEL, args_meta[0].type, args_meta[1].type, args_meta[2].type, args_meta[3].type) callconv(.C) ReturnType,
|
|
||||||
else => @compileError("Unsupported number of args"),
|
|
||||||
};
|
|
||||||
|
|
||||||
// NOTE: func is a var because making it const causes a compile error which I believe is a compiler bug
|
|
||||||
const func = @as(FnType, @ptrCast(&objc_msgSend));
|
|
||||||
const sel = sel_getUid(@as([*c]const u8, @ptrCast(sel_name)));
|
|
||||||
|
|
||||||
return @call(.auto, func, .{ obj, sel } ++ args);
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue