mach: expose build step/etc info from App
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
3ff4bcc2a3
commit
b497a1bbeb
1 changed files with 22 additions and 12 deletions
22
build.zig
22
build.zig
|
|
@ -115,6 +115,11 @@ fn testStep(b: *std.build.Builder, mode: std.builtin.Mode, target: std.zig.Cross
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const App = struct {
|
pub const App = struct {
|
||||||
|
b: *std.build.Builder,
|
||||||
|
name: []const u8,
|
||||||
|
step: *std.build.LibExeObjStep,
|
||||||
|
platform: core.App.Platform,
|
||||||
|
|
||||||
core: core.App,
|
core: core.App,
|
||||||
use_freetype: ?[]const u8 = null,
|
use_freetype: ?[]const u8 = null,
|
||||||
use_model3d: bool = false,
|
use_model3d: bool = false,
|
||||||
|
|
@ -146,8 +151,7 @@ pub const App = struct {
|
||||||
try deps.append(sysaudio.pkg);
|
try deps.append(sysaudio.pkg);
|
||||||
if (options.use_freetype) |_| try deps.append(freetype.pkg);
|
if (options.use_freetype) |_| try deps.append(freetype.pkg);
|
||||||
|
|
||||||
return .{
|
const app = try core.App.init(b, .{
|
||||||
.core = try core.App.init(b, .{
|
|
||||||
.name = options.name,
|
.name = options.name,
|
||||||
.src = options.src,
|
.src = options.src,
|
||||||
.target = options.target,
|
.target = options.target,
|
||||||
|
|
@ -155,7 +159,13 @@ pub const App = struct {
|
||||||
.deps = deps.items,
|
.deps = deps.items,
|
||||||
.res_dirs = options.res_dirs,
|
.res_dirs = options.res_dirs,
|
||||||
.watch_paths = options.watch_paths,
|
.watch_paths = options.watch_paths,
|
||||||
}),
|
});
|
||||||
|
return .{
|
||||||
|
.core = app,
|
||||||
|
.b = app.b,
|
||||||
|
.name = app.name,
|
||||||
|
.step = app.step,
|
||||||
|
.platform = app.platform,
|
||||||
.use_freetype = options.use_freetype,
|
.use_freetype = options.use_freetype,
|
||||||
.use_model3d = options.use_model3d,
|
.use_model3d = options.use_model3d,
|
||||||
};
|
};
|
||||||
|
|
@ -163,10 +173,10 @@ pub const App = struct {
|
||||||
|
|
||||||
pub fn link(app: *const App, options: Options) LinkError!void {
|
pub fn link(app: *const App, options: Options) LinkError!void {
|
||||||
try app.core.link(options.core);
|
try app.core.link(options.core);
|
||||||
sysaudio.link(app.core.b, app.core.step, options.sysaudio);
|
sysaudio.link(app.b, app.step, options.sysaudio);
|
||||||
if (app.use_freetype) |_| freetype.link(app.core.b, app.core.step, options.freetype);
|
if (app.use_freetype) |_| freetype.link(app.b, app.step, options.freetype);
|
||||||
if (app.use_model3d) {
|
if (app.use_model3d) {
|
||||||
model3d.link(app.core.b, app.core.step, app.core.step.target);
|
model3d.link(app.b, app.step, app.step.target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue