build: remove App (not CoreApp)
This removes the old `App` builder, leaving only `CoreApp` as something to resolve/remove. Helps hexops/mach#1186 Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
7a1efdaa69
commit
2889468c6b
1 changed files with 0 additions and 73 deletions
73
build.zig
73
build.zig
|
|
@ -316,79 +316,6 @@ pub fn build(b: *std.Build) !void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const App = struct {
|
|
||||||
b: *std.Build,
|
|
||||||
mach_builder: *std.Build,
|
|
||||||
name: []const u8,
|
|
||||||
compile: *std.Build.Step.Compile,
|
|
||||||
install: *std.Build.Step.InstallArtifact,
|
|
||||||
run: *std.Build.Step.Run,
|
|
||||||
platform: CoreApp.Platform,
|
|
||||||
core: CoreApp,
|
|
||||||
|
|
||||||
pub fn init(
|
|
||||||
app_builder: *std.Build,
|
|
||||||
options: struct {
|
|
||||||
name: []const u8,
|
|
||||||
src: []const u8,
|
|
||||||
target: std.Build.ResolvedTarget,
|
|
||||||
optimize: std.builtin.OptimizeMode,
|
|
||||||
custom_entrypoint: ?[]const u8 = null,
|
|
||||||
deps: ?[]const std.Build.Module.Import = null,
|
|
||||||
res_dirs: ?[]const []const u8 = null,
|
|
||||||
watch_paths: ?[]const []const u8 = null,
|
|
||||||
mach_builder: ?*std.Build = null,
|
|
||||||
mach_mod: ?*std.Build.Module = null,
|
|
||||||
},
|
|
||||||
) !App {
|
|
||||||
const mach_builder = options.mach_builder orelse app_builder.dependency("mach", .{
|
|
||||||
.target = options.target,
|
|
||||||
.optimize = options.optimize,
|
|
||||||
}).builder;
|
|
||||||
const mach_mod = options.mach_mod orelse app_builder.dependency("mach", .{
|
|
||||||
.target = options.target,
|
|
||||||
.optimize = options.optimize,
|
|
||||||
}).module("mach");
|
|
||||||
|
|
||||||
var deps = std.ArrayList(std.Build.Module.Import).init(app_builder.allocator);
|
|
||||||
if (options.deps) |v| try deps.appendSlice(v);
|
|
||||||
try deps.append(.{ .name = "mach", .module = mach_mod });
|
|
||||||
|
|
||||||
const app = try CoreApp.init(app_builder, mach_builder, .{
|
|
||||||
.name = options.name,
|
|
||||||
.src = options.src,
|
|
||||||
.target = options.target,
|
|
||||||
.optimize = options.optimize,
|
|
||||||
.custom_entrypoint = options.custom_entrypoint,
|
|
||||||
.deps = deps.items,
|
|
||||||
.res_dirs = options.res_dirs,
|
|
||||||
.watch_paths = options.watch_paths,
|
|
||||||
.mach_mod = mach_mod,
|
|
||||||
});
|
|
||||||
return .{
|
|
||||||
.core = app,
|
|
||||||
.b = app.b,
|
|
||||||
.mach_builder = mach_builder,
|
|
||||||
.name = app.name,
|
|
||||||
.compile = app.compile,
|
|
||||||
.install = app.install,
|
|
||||||
.run = app.run,
|
|
||||||
.platform = app.platform,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn link(app: *const App) !void {
|
|
||||||
// TODO: basisu support in wasm
|
|
||||||
if (app.platform != .web) {
|
|
||||||
app.compile.linkLibrary(app.mach_builder.dependency("mach_basisu", .{
|
|
||||||
.target = app.compile.root_module.resolved_target.?,
|
|
||||||
.optimize = app.compile.root_module.optimize.?,
|
|
||||||
}).artifact("mach-basisu"));
|
|
||||||
addPaths(&app.compile.root_module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
pub const CoreApp = struct {
|
pub const CoreApp = struct {
|
||||||
b: *std.Build,
|
b: *std.Build,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue