aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Module.zig
diff options
context:
space:
mode:
authorGalaxyShard <galaxyshard.tech@proton.me>2024-10-09 01:27:42 -0400
committerAlex Rønne Petersen <alex@alexrp.com>2025-03-27 09:47:42 +0100
commitb5a5260546ddd8953e493f75c5ee12c5a853263b (patch)
tree4da4f332b4077ad7d28af72635e6cf5fd60e7c7b /lib/std/Build/Module.zig
parentfb188c3d18a744cb98fc361aeeb8e8796066868b (diff)
downloadzig-b5a5260546ddd8953e493f75c5ee12c5a853263b.tar.gz
zig-b5a5260546ddd8953e493f75c5ee12c5a853263b.zip
std.Build: implement addEmbedPath for adding C #embed search directories
Diffstat (limited to 'lib/std/Build/Module.zig')
-rw-r--r--lib/std/Build/Module.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/std/Build/Module.zig b/lib/std/Build/Module.zig
index f299946731..0bc77b0741 100644
--- a/lib/std/Build/Module.zig
+++ b/lib/std/Build/Module.zig
@@ -164,6 +164,7 @@ pub const IncludeDir = union(enum) {
framework_path_system: LazyPath,
other_step: *Step.Compile,
config_header_step: *Step.ConfigHeader,
+ embed_path: LazyPath,
pub fn appendZigProcessFlags(
include_dir: IncludeDir,
@@ -200,6 +201,9 @@ pub const IncludeDir = union(enum) {
const header_dir_path = full_file_path[0 .. full_file_path.len - config_header.include_path.len];
try zig_args.appendSlice(&.{ "-I", header_dir_path });
},
+ .embed_path => |embed_path| {
+ try zig_args.append(try std.mem.concat(b.allocator, u8, &.{ "--embed-dir=", embed_path.getPath2(b, asking_step) }));
+ },
}
}
};
@@ -511,6 +515,11 @@ pub fn addFrameworkPath(m: *Module, directory_path: LazyPath) void {
@panic("OOM");
}
+pub fn addEmbedPath(m: *Module, lazy_path: LazyPath) void {
+ const b = m.owner;
+ m.include_dirs.append(b.allocator, .{ .embed_path = lazy_path.dupe(b) }) catch @panic("OOM");
+}
+
pub fn addLibraryPath(m: *Module, directory_path: LazyPath) void {
const b = m.owner;
m.lib_paths.append(b.allocator, directory_path.dupe(b)) catch @panic("OOM");