Skip to content

Commit bcdffd6

Browse files
committed
Add a LibraryIncludeDirectory for library headers that should be passed with -isystem.
1 parent d10d814 commit bcdffd6

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

doc/configuration/items.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ are used by the Zig SDK:
1010
every C/C++ source file by way of Clang's `-include` flag.
1111
* `IncludeDirectory`: Header include directories passed to the compiler with the
1212
`-I` flag. Note that this applies to Zig as well, not just C/C++.
13+
* `LibraryIncludeDirectory`: Header include directories passed to the compiler
14+
with the `-isystem` flag. Note that this applies to Zig as well, not just
15+
C/C++.
1316
* `LibraryReference`: Native libraries that should be linked to. These can be
1417
either static or dynamic. For multi-platform projects, additions to this item
1518
should be conditioned on the value of `RuntimeIdentifier` (or similar).

src/sdk/ZigCompile.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ public string Configuration
6666
[Required]
6767
public string LanguageStandard { get; set; } = null!;
6868

69+
[Required]
70+
public ITaskItem[] LibraryIncludeDirectories { get; set; } = null!;
71+
6972
[Required]
7073
public ITaskItem[] LibraryReferences { get; set; } = null!;
7174

@@ -542,6 +545,9 @@ void TryAppendWarningSwitch(string name)
542545
builder.AppendSwitchIfNotNull("-I ", GetWorkingDirectory() ?? ".");
543546
builder.AppendSwitchIfNotNull("-I ", PublicIncludeDirectory);
544547

548+
foreach (var include in LibraryIncludeDirectories)
549+
builder.AppendSwitchIfNotNull("-isystem ", include);
550+
545551
foreach (var include in IncludeDirectories)
546552
builder.AppendSwitchIfNotNull("-I ", include);
547553

src/sdk/build/Vezel.Zig.Sdk.Build.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
FastMath="$(FastMath)"
5858
IncludeDirectories="@(IncludeDirectory)"
5959
LanguageStandard="$(LanguageStandard)"
60+
LibraryIncludeDirectories="@(LibraryIncludeDirectory)"
6061
LibraryReferences="@(LibraryReference)"
6162
LinkTimeOptimization="$(LinkTimeOptimization)"
6263
MicrosoftExtensions="$(MicrosoftExtensions)"

src/sdk/build/Vezel.Zig.Sdk.Test.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
FastMath="$(FastMath)"
3434
IncludeDirectories="@(IncludeDirectory)"
3535
LanguageStandard="$(LanguageStandard)"
36+
LibraryIncludeDirectories="@(LibraryIncludeDirectory)"
3637
LibraryReferences="@(LibraryReference)"
3738
LinkTimeOptimization="$(LinkTimeOptimization)"
3839
MicrosoftExtensions="$(MicrosoftExtensions)"

0 commit comments

Comments
 (0)