aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@random-projects.net>2023-07-19 10:49:34 +0200
committerAndrew Kelley <andrew@ziglang.org>2023-07-30 11:18:50 -0700
commitce95a3b153e9f3e83232e641c26a41e7dbd01165 (patch)
treed2bd5a15abfb77cbb8d79539767cdccbde1e79d3 /build.zig
parent235e6ac05df95e5dc2656cfb1a33d7b18c45a603 (diff)
downloadzig-ce95a3b153e9f3e83232e641c26a41e7dbd01165.tar.gz
zig-ce95a3b153e9f3e83232e641c26a41e7dbd01165.zip
Build.zig rename orgy (aka: #16353). Renames FileSource to LazyPath and removes functions that take literal paths instead of LazyPath.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig35
1 files changed, 17 insertions, 18 deletions
diff --git a/build.zig b/build.zig
index 9e6e863867..b7db2d7aa8 100644
--- a/build.zig
+++ b/build.zig
@@ -45,9 +45,9 @@ pub fn build(b: *std.Build) !void {
const docgen_cmd = b.addRunArtifact(docgen_exe);
docgen_cmd.addArgs(&.{ "--zig", b.zig_exe });
if (b.zig_lib_dir) |p| {
- docgen_cmd.addArgs(&.{ "--zig-lib-dir", p });
+ docgen_cmd.addArgs(&.{ "--zig-lib-dir", b.pathFromRoot(p) });
}
- docgen_cmd.addFileSourceArg(.{ .path = "doc/langref.html.in" });
+ docgen_cmd.addFileArg(.{ .path = "doc/langref.html.in" });
const langref_file = docgen_cmd.addOutputFileArg("langref.html");
const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html");
if (!skip_install_langref) {
@@ -58,7 +58,7 @@ pub fn build(b: *std.Build) !void {
.root_source_file = .{ .path = "lib/std/std.zig" },
.target = target,
});
- autodoc_test.overrideZigLibDir("lib");
+ autodoc_test.overrideZigLibDir(.{ .path = "lib" });
autodoc_test.emit_bin = .no_emit; // https://github.com/ziglang/zig/issues/16351
const install_std_docs = b.addInstallDirectory(.{
.source_dir = autodoc_test.getEmittedDocs(),
@@ -89,7 +89,7 @@ pub fn build(b: *std.Build) !void {
.root_source_file = .{ .path = "test/src/Cases.zig" },
.optimize = optimize,
});
- check_case_exe.main_pkg_path = ".";
+ check_case_exe.setMainPkgPath(.{ .path = "." });
check_case_exe.stack_size = stack_size;
check_case_exe.single_threaded = single_threaded;
@@ -352,10 +352,9 @@ pub fn build(b: *std.Build) !void {
exe_options.addOption(bool, "enable_tracy_allocation", tracy_allocation);
exe_options.addOption(bool, "value_tracing", value_tracing);
if (tracy) |tracy_path| {
- const client_cpp = fs.path.join(
- b.allocator,
+ const client_cpp = b.pathJoin(
&[_][]const u8{ tracy_path, "public", "TracyClient.cpp" },
- ) catch unreachable;
+ );
// On mingw, we need to opt into windows 7+ to get some features required by tracy.
const tracy_c_flags: []const []const u8 = if (target.isWindows() and target.getAbi() == .gnu)
@@ -363,8 +362,8 @@ pub fn build(b: *std.Build) !void {
else
&[_][]const u8{ "-DTRACY_ENABLE=1", "-fno-sanitize=undefined" };
- exe.addIncludePath(tracy_path);
- exe.addCSourceFile(client_cpp, tracy_c_flags);
+ exe.addIncludePath(.{ .path = tracy_path });
+ exe.addCSourceFile(.{ .file = .{ .path = client_cpp }, .flags = tracy_c_flags });
if (!enable_llvm) {
exe.linkSystemLibraryName("c++");
}
@@ -554,7 +553,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
});
run_opt.addArtifactArg(exe);
run_opt.addArg("-o");
- run_opt.addFileSourceArg(.{ .path = "stage1/zig1.wasm" });
+ run_opt.addFileArg(.{ .path = "stage1/zig1.wasm" });
const copy_zig_h = b.addWriteFiles();
copy_zig_h.addCopyFileToSource(.{ .path = "lib/zig.h" }, "stage1/zig.h");
@@ -603,7 +602,7 @@ fn addCmakeCfgOptionsToExe(
// useful for package maintainers
exe.headerpad_max_install_names = true;
}
- exe.addObjectFile(fs.path.join(b.allocator, &[_][]const u8{
+ exe.addObjectFile(.{ .path = b.pathJoin(&[_][]const u8{
cfg.cmake_binary_dir,
"zigcpp",
b.fmt("{s}{s}{s}", .{
@@ -611,11 +610,11 @@ fn addCmakeCfgOptionsToExe(
"zigcpp",
cfg.cmake_static_library_suffix,
}),
- }) catch unreachable);
+ }) });
assert(cfg.lld_include_dir.len != 0);
- exe.addIncludePath(cfg.lld_include_dir);
- exe.addIncludePath(cfg.llvm_include_dir);
- exe.addLibraryPath(cfg.llvm_lib_dir);
+ exe.addIncludePath(.{ .path = cfg.lld_include_dir });
+ exe.addIncludePath(.{ .path = cfg.llvm_include_dir });
+ exe.addLibraryPath(.{ .path = cfg.llvm_lib_dir });
addCMakeLibraryList(exe, cfg.clang_libraries);
addCMakeLibraryList(exe, cfg.lld_libraries);
addCMakeLibraryList(exe, cfg.llvm_libraries);
@@ -671,7 +670,7 @@ fn addCmakeCfgOptionsToExe(
}
if (cfg.dia_guids_lib.len != 0) {
- exe.addObjectFile(cfg.dia_guids_lib);
+ exe.addObjectFile(.{ .path = cfg.dia_guids_lib });
}
}
@@ -732,7 +731,7 @@ fn addCxxKnownPath(
}
return error.RequiredLibraryNotFound;
}
- exe.addObjectFile(path_unpadded);
+ exe.addObjectFile(.{ .path = path_unpadded });
// TODO a way to integrate with system c++ include files here
// c++ -E -Wp,-v -xc++ /dev/null
@@ -752,7 +751,7 @@ fn addCMakeLibraryList(exe: *std.Build.Step.Compile, list: []const u8) void {
} else if (exe.target.isWindows() and mem.endsWith(u8, lib, ".lib") and !fs.path.isAbsolute(lib)) {
exe.linkSystemLibrary(lib[0 .. lib.len - ".lib".len]);
} else {
- exe.addObjectFile(lib);
+ exe.addObjectFile(.{ .path = lib });
}
}
}