mach: improve compatibility with self-hosted compiler (thisDir() -> comptime thisDir())
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
fe4e721508
commit
8ec53c7446
1 changed files with 10 additions and 10 deletions
20
build.zig
20
build.zig
|
|
@ -86,7 +86,7 @@ pub fn build(b: *std.build.Builder) void {
|
||||||
.src = "examples/" ++ example.name ++ "/main.zig",
|
.src = "examples/" ++ example.name ++ "/main.zig",
|
||||||
.target = target,
|
.target = target,
|
||||||
.deps = example.packages,
|
.deps = example.packages,
|
||||||
.res_dirs = &.{thisDir() ++ "/examples/assets"},
|
.res_dirs = &.{(comptime thisDir()) ++ "/examples/assets"},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
example_app.setBuildMode(mode);
|
example_app.setBuildMode(mode);
|
||||||
|
|
@ -229,25 +229,25 @@ pub const App = struct {
|
||||||
|
|
||||||
const step = blk: {
|
const step = blk: {
|
||||||
if (platform == .web) {
|
if (platform == .web) {
|
||||||
const lib = b.addSharedLibrary(options.name, thisDir() ++ "/src/platform/wasm.zig", .unversioned);
|
const lib = b.addSharedLibrary(options.name, (comptime thisDir()) ++ "/src/platform/wasm.zig", .unversioned);
|
||||||
lib.addPackage(gpu.pkg);
|
lib.addPackage(gpu.pkg);
|
||||||
lib.addPackage(sysjs.pkg);
|
lib.addPackage(sysjs.pkg);
|
||||||
|
|
||||||
break :blk lib;
|
break :blk lib;
|
||||||
} else {
|
} else {
|
||||||
const exe = b.addExecutable(options.name, thisDir() ++ "/src/platform/native.zig");
|
const exe = b.addExecutable(options.name, (comptime thisDir()) ++ "/src/platform/native.zig");
|
||||||
exe.addPackage(gpu.pkg);
|
exe.addPackage(gpu.pkg);
|
||||||
exe.addPackage(glfw.pkg);
|
exe.addPackage(glfw.pkg);
|
||||||
|
|
||||||
if (target.os.tag == .linux) {
|
if (target.os.tag == .linux) {
|
||||||
exe.addPackagePath("gamemode", thisDir() ++ "/gamemode/gamemode.zig");
|
exe.addPackagePath("gamemode", (comptime thisDir()) ++ "/gamemode/gamemode.zig");
|
||||||
}
|
}
|
||||||
|
|
||||||
break :blk exe;
|
break :blk exe;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
step.main_pkg_path = thisDir() ++ "/src";
|
step.main_pkg_path = (comptime thisDir()) ++ "/src";
|
||||||
step.addPackage(app_pkg);
|
step.addPackage(app_pkg);
|
||||||
step.setTarget(options.target);
|
step.setTarget(options.target);
|
||||||
|
|
||||||
|
|
@ -271,15 +271,15 @@ pub const App = struct {
|
||||||
|
|
||||||
inline for (.{ "/src/platform/mach.js", "/sysjs/src/mach-sysjs.js" }) |js| {
|
inline for (.{ "/src/platform/mach.js", "/sysjs/src/mach-sysjs.js" }) |js| {
|
||||||
const install_js = app.b.addInstallFileWithDir(
|
const install_js = app.b.addInstallFileWithDir(
|
||||||
.{ .path = thisDir() ++ js },
|
.{ .path = (comptime thisDir()) ++ js },
|
||||||
web_install_dir,
|
web_install_dir,
|
||||||
std.fs.path.basename(js),
|
std.fs.path.basename(js),
|
||||||
);
|
);
|
||||||
app.getInstallStep().?.step.dependOn(&install_js.step);
|
app.getInstallStep().?.step.dependOn(&install_js.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
const html_generator = app.b.addExecutable("html-generator", thisDir() ++ "/tools/html-generator.zig");
|
const html_generator = app.b.addExecutable("html-generator", (comptime thisDir()) ++ "/tools/html-generator.zig");
|
||||||
html_generator.main_pkg_path = thisDir();
|
html_generator.main_pkg_path = (comptime thisDir());
|
||||||
const run_html_generator = html_generator.run();
|
const run_html_generator = html_generator.run();
|
||||||
run_html_generator.addArgs(&.{ std.mem.concat(
|
run_html_generator.addArgs(&.{ std.mem.concat(
|
||||||
app.b.allocator,
|
app.b.allocator,
|
||||||
|
|
@ -324,7 +324,7 @@ pub const App = struct {
|
||||||
if (app.platform == .web) {
|
if (app.platform == .web) {
|
||||||
ensureDependencySubmodule(app.b.allocator, "tools/libs/apple_pie") catch unreachable;
|
ensureDependencySubmodule(app.b.allocator, "tools/libs/apple_pie") catch unreachable;
|
||||||
|
|
||||||
const http_server = app.b.addExecutable("http-server", thisDir() ++ "/tools/http-server.zig");
|
const http_server = app.b.addExecutable("http-server", (comptime thisDir()) ++ "/tools/http-server.zig");
|
||||||
http_server.addPackage(.{
|
http_server.addPackage(.{
|
||||||
.name = "apple_pie",
|
.name = "apple_pie",
|
||||||
.source = .{ .path = "tools/libs/apple_pie/src/apple_pie.zig" },
|
.source = .{ .path = "tools/libs/apple_pie/src/apple_pie.zig" },
|
||||||
|
|
@ -374,7 +374,7 @@ fn ensureDependencySubmodule(allocator: std.mem.Allocator, path: []const u8) !vo
|
||||||
if (std.mem.eql(u8, no_ensure_submodules, "true")) return;
|
if (std.mem.eql(u8, no_ensure_submodules, "true")) return;
|
||||||
} else |_| {}
|
} else |_| {}
|
||||||
var child = std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", path }, allocator);
|
var child = std.ChildProcess.init(&.{ "git", "submodule", "update", "--init", path }, allocator);
|
||||||
child.cwd = thisDir();
|
child.cwd = (comptime thisDir());
|
||||||
child.stderr = std.io.getStdErr();
|
child.stderr = std.io.getStdErr();
|
||||||
child.stdout = std.io.getStdOut();
|
child.stdout = std.io.getStdOut();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue