Skip to content

Commit 24ad69e

Browse files
authored
Merge branch 'hexops:main' into vulkan-clear-fix
2 parents 37788bf + aae6ab3 commit 24ad69e

23 files changed

Lines changed: 107 additions & 207 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github: slimsag
1+
github: emidoots

.github/ISSUE_TEMPLATE/dev_release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: (dev) Release checklist
33
about: The checklist we follow to perform a Mach release
44
title: 'all: Mach 0.3 release checklist'
55
labels: all, zig-update
6-
assignees: 'slimsag'
6+
assignees: 'emidoots'
77

88
---
99

.github/ISSUE_TEMPLATE/dev_zig_nomination.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: (dev) Zig version update
33
about: The process we follow to perform a Zig version update
44
title: 'all: nominate Zig YYYY.MM.0-mach'
55
labels: all, zig-update
6-
assignees: 'slimsag'
6+
assignees: 'emidoots'
77

88
---
99

@@ -29,7 +29,7 @@ You may have been linked to this issue because you sent a pull request to update
2929
* [ ] https://machengine.org/docs/zig-version has been updated
3030
* [ ] In `machengine.org` repository `static/zig` folder, `wrench script nominate-zig-index-update finalize 2024.1.0-mach-wip` has been ran and the [`index.json`](https://machengine.org/zig/index.json) has had `-wip` removed and the `mach-latest` entry has been updated.
3131
* [ ] The `**IN-PROGRESS**` warning in the _Nomination history_ has been removed.
32-
* [ ] A [new issue](https://github.com/hexops/mach/issues/new?assignees=slimsag&labels=all%2C+zig-update&projects=&template=dev_zig_nomination.md&title=all%3A+nominate+Zig+YYYY.MM) has been filed for the next nomination.
32+
* [ ] A [new issue](https://github.com/hexops/mach/issues/new?assignees=emidoots&labels=all%2C+zig-update&projects=&template=dev_zig_nomination.md&title=all%3A+nominate+Zig+YYYY.MM) has been filed for the next nomination.
3333
* [ ] A #progress announcement has been made:
3434

3535
> We've just finalized nominating and updating to Zig 2024.1.0-mach. We encourage you to update your projects to that Zig version now. :)

build.zig

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,34 @@ const Example = struct {
389389
run_step: *std.Build.Step = undefined,
390390
};
391391

392+
pub fn addExecutable(
393+
mach_builder: *std.Build,
394+
options: struct {
395+
name: []const u8,
396+
app: *std.Build.Module,
397+
target: std.Build.ResolvedTarget,
398+
optimize: std.builtin.OptimizeMode,
399+
},
400+
) *std.Build.Step.Compile {
401+
const entrypoint_mod = mach_builder.addModule(
402+
mach_builder.fmt("{s}-entrypoint", .{options.name}),
403+
.{
404+
.root_source_file = mach_builder.path("src/entrypoint/main.zig"),
405+
.optimize = options.optimize,
406+
.target = options.target,
407+
},
408+
);
409+
entrypoint_mod.addImport("app", options.app);
410+
411+
return mach_builder.addExecutable(.{
412+
.name = options.name,
413+
.root_module = entrypoint_mod,
414+
415+
// Win32 manifest file for DPI-awareness configuration
416+
.win32_manifest = mach_builder.path("src/core/windows/win32.manifest"),
417+
});
418+
}
419+
392420
fn buildExamples(
393421
b: *std.Build,
394422
optimize: std.builtin.OptimizeMode,
@@ -397,34 +425,36 @@ fn buildExamples(
397425
examples: []Example,
398426
) void {
399427
for (examples) |*example| {
400-
const exe = b.addExecutable(.{
428+
const app_mod = b.addModule(example.name, .{
429+
.root_source_file = b.path(b.fmt("examples/{s}/App.zig", .{example.name})),
430+
});
431+
app_mod.addImport("mach", mach_mod);
432+
const exe = addExecutable(b, .{
401433
.name = example.name,
402-
.root_source_file = b.path(b.fmt("examples/{s}/main.zig", .{example.name})),
434+
.app = app_mod,
403435
.target = target,
404436
.optimize = optimize,
405-
.win32_manifest = b.path("src/core/windows/win32.manifest"),
406437
});
407-
exe.root_module.addImport("mach", mach_mod);
408438

409439
for (example.deps) |d| {
410440
switch (d) {
411441
.assets => {
412442
if (b.lazyDependency("mach_example_assets", .{
413443
.target = target,
414444
.optimize = optimize,
415-
})) |dep| exe.root_module.addImport("assets", dep.module("mach-example-assets"));
445+
})) |dep| app_mod.addImport("assets", dep.module("mach-example-assets"));
416446
},
417447
.freetype => {
418448
if (b.lazyDependency("mach_freetype", .{
419449
.target = target,
420450
.optimize = optimize,
421-
})) |dep| exe.root_module.addImport("freetype", dep.module("mach-freetype"));
451+
})) |dep| app_mod.addImport("freetype", dep.module("mach-freetype"));
422452
},
423453
.zigimg => {
424454
if (b.lazyDependency("zigimg", .{
425455
.target = target,
426456
.optimize = optimize,
427-
})) |dep| exe.root_module.addImport("zigimg", dep.module("zigimg"));
457+
})) |dep| app_mod.addImport("zigimg", dep.module("zigimg"));
428458
},
429459
}
430460
}

examples/core-transparent-window/App.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ const gpu = mach.gpu;
44

55
const App = @This();
66

7+
// The set of Mach modules our application may use.
8+
pub const Modules = mach.Modules(.{
9+
mach.Core,
10+
@This(),
11+
});
12+
713
pub const mach_module = .app;
814

915
pub const mach_systems = .{ .main, .init, .tick, .deinit };

examples/core-triangle/App.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ const gpu = mach.gpu;
44

55
const App = @This();
66

7+
// The set of Mach modules our application may use.
8+
pub const Modules = mach.Modules(.{
9+
mach.Core,
10+
App,
11+
});
12+
713
pub const mach_module = .app;
814

915
pub const mach_systems = .{ .main, .init, .tick, .deinit };

examples/core-triangle/main.zig

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/custom-renderer/App.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ const Vec3 = math.Vec3;
99

1010
const App = @This();
1111

12+
// The set of Mach modules our application may use.
13+
pub const Modules = mach.Modules(.{
14+
mach.Core,
15+
App,
16+
@import("Renderer.zig"),
17+
});
18+
1219
pub const mach_module = .app;
1320

1421
pub const mach_systems = .{ .main, .init, .deinit, .tick };

examples/custom-renderer/main.zig

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/glyphs/App.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ const Mat4x4 = math.Mat4x4;
1616

1717
const App = @This();
1818

19+
// The set of Mach modules our application may use.
20+
pub const Modules = mach.Modules(.{
21+
mach.Core,
22+
mach.gfx.Sprite,
23+
App,
24+
});
25+
1926
pub const mach_module = .app;
2027

2128
pub const mach_systems = .{ .main, .init, .deinit, .tick };

0 commit comments

Comments
 (0)