aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-01-01 18:47:42 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-01-01 19:49:08 -0700
commiteae6d45cded76dd027569c86a7cdd5bc9039664b (patch)
treec08ca87ed0d8b59154d2ce321ab8cfcf8be72a0d /src/main.zig
parent7cec11a66bfd9d38bd355ba55aca4fa0e61ba4b5 (diff)
downloadzig-eae6d45cded76dd027569c86a7cdd5bc9039664b.tar.gz
zig-eae6d45cded76dd027569c86a7cdd5bc9039664b.zip
CLI: introduce global -I args for C include paths
This isn't technically needed since per-module -I args can suffice, but this can produce very long CLI invocations when several --mod args are combined with --search-prefix args since the -I args have to be repeated for each module. This is a partial revert of ecbe8bbf2df2ed4d473efbc32e0b6d7091fba76f.
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig
index 091e4b2668..4442234bd2 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -3244,6 +3244,10 @@ fn buildOutputType(
.pdb_out_path = pdb_out_path,
.error_limit = error_limit,
.native_system_include_paths = create_module.native_system_include_paths,
+ // Any leftover C compilation args (such as -I) apply globally rather
+ // than to any particular module. This feature can greatly reduce CLI
+ // noise when --search-prefix and --mod are combined.
+ .global_cc_argv = try cc_argv.toOwnedSlice(arena),
}) catch |err| switch (err) {
error.LibCUnavailable => {
const triple_name = try target.zigTriple(arena);
@@ -3421,9 +3425,9 @@ const CreateModule = struct {
c_source_files: std.ArrayListUnmanaged(Compilation.CSourceFile),
rc_source_files: std.ArrayListUnmanaged(Compilation.RcSourceFile),
- // e.g. -m3dnow or -mno-outline-atomics. They correspond to std.Target llvm cpu feature names.
- // This array is populated by zig cc frontend and then has to be converted to zig-style
- // CPU features.
+ /// e.g. -m3dnow or -mno-outline-atomics. They correspond to std.Target llvm cpu feature names.
+ /// This array is populated by zig cc frontend and then has to be converted to zig-style
+ /// CPU features.
llvm_m_args: std.ArrayListUnmanaged([]const u8),
sysroot: ?[]const u8,
lib_dirs: std.ArrayListUnmanaged([]const u8),