aboutsummaryrefslogtreecommitdiff
path: root/src/main.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 /src/main.zig
parentfb188c3d18a744cb98fc361aeeb8e8796066868b (diff)
downloadzig-b5a5260546ddd8953e493f75c5ee12c5a853263b.tar.gz
zig-b5a5260546ddd8953e493f75c5ee12c5a853263b.zip
std.Build: implement addEmbedPath for adding C #embed search directories
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main.zig b/src/main.zig
index 2687546e41..a377b38494 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -541,6 +541,7 @@ const usage_build_generic =
\\ -idirafter [dir] Add directory to AFTER include search path
\\ -isystem [dir] Add directory to SYSTEM include search path
\\ -I[dir] Add directory to include search path
+ \\ --embed-dir=[dir] Add directory to embed search path
\\ -D[macro]=[value] Define C [macro] to [value] (1 if [value] omitted)
\\ -cflags [flags] -- Set extra flags for the next positional C source files
\\ -rcflags [flags] -- Set extra flags for the next positional .rc source files
@@ -1287,6 +1288,8 @@ fn buildOutputType(
try cc_argv.appendSlice(arena, &.{ arg, args_iter.nextOrFatal() });
} else if (mem.eql(u8, arg, "-I")) {
try cssan.addIncludePath(arena, &cc_argv, .I, arg, args_iter.nextOrFatal(), false);
+ } else if (mem.startsWith(u8, arg, "--embed-dir=")) {
+ try cssan.addIncludePath(arena, &cc_argv, .embed_dir, arg, arg["--embed-dir=".len..], true);
} else if (mem.eql(u8, arg, "-isystem")) {
try cssan.addIncludePath(arena, &cc_argv, .isystem, arg, args_iter.nextOrFatal(), false);
} else if (mem.eql(u8, arg, "-iwithsysroot")) {
@@ -6974,13 +6977,17 @@ const ClangSearchSanitizer = struct {
m.iframeworkwithsysroot = true;
if (m.iwithsysroot) warn(wtxt, .{ dir, "iframeworkwithsysroot", "iwithsysroot" });
},
+ .embed_dir => {
+ if (m.embed_dir) return;
+ m.embed_dir = true;
+ },
}
try argv.ensureUnusedCapacity(ally, 2);
argv.appendAssumeCapacity(arg);
if (!joined) argv.appendAssumeCapacity(dir);
}
- const Group = enum { I, isystem, iwithsysroot, idirafter, iframework, iframeworkwithsysroot };
+ const Group = enum { I, isystem, iwithsysroot, idirafter, iframework, iframeworkwithsysroot, embed_dir };
const Membership = packed struct {
I: bool = false,
@@ -6989,6 +6996,7 @@ const ClangSearchSanitizer = struct {
idirafter: bool = false,
iframework: bool = false,
iframeworkwithsysroot: bool = false,
+ embed_dir: bool = false,
};
};