Skip to content

Commit

Permalink
Add a LibraryIncludeDirectory for library headers that should be pass…
Browse files Browse the repository at this point in the history
…ed with -isystem.
  • Loading branch information
alexrp committed Jun 21, 2022
1 parent d10d814 commit bcdffd6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/configuration/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ are used by the Zig SDK:
every C/C++ source file by way of Clang's `-include` flag.
* `IncludeDirectory`: Header include directories passed to the compiler with the
`-I` flag. Note that this applies to Zig as well, not just C/C++.
* `LibraryIncludeDirectory`: Header include directories passed to the compiler
with the `-isystem` flag. Note that this applies to Zig as well, not just
C/C++.
* `LibraryReference`: Native libraries that should be linked to. These can be
either static or dynamic. For multi-platform projects, additions to this item
should be conditioned on the value of `RuntimeIdentifier` (or similar).
Expand Down
6 changes: 6 additions & 0 deletions src/sdk/ZigCompile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public string Configuration
[Required]
public string LanguageStandard { get; set; } = null!;

[Required]
public ITaskItem[] LibraryIncludeDirectories { get; set; } = null!;

[Required]
public ITaskItem[] LibraryReferences { get; set; } = null!;

Expand Down Expand Up @@ -542,6 +545,9 @@ void TryAppendWarningSwitch(string name)
builder.AppendSwitchIfNotNull("-I ", GetWorkingDirectory() ?? ".");
builder.AppendSwitchIfNotNull("-I ", PublicIncludeDirectory);

foreach (var include in LibraryIncludeDirectories)
builder.AppendSwitchIfNotNull("-isystem ", include);

foreach (var include in IncludeDirectories)
builder.AppendSwitchIfNotNull("-I ", include);

Expand Down
1 change: 1 addition & 0 deletions src/sdk/build/Vezel.Zig.Sdk.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
FastMath="$(FastMath)"
IncludeDirectories="@(IncludeDirectory)"
LanguageStandard="$(LanguageStandard)"
LibraryIncludeDirectories="@(LibraryIncludeDirectory)"
LibraryReferences="@(LibraryReference)"
LinkTimeOptimization="$(LinkTimeOptimization)"
MicrosoftExtensions="$(MicrosoftExtensions)"
Expand Down
1 change: 1 addition & 0 deletions src/sdk/build/Vezel.Zig.Sdk.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
FastMath="$(FastMath)"
IncludeDirectories="@(IncludeDirectory)"
LanguageStandard="$(LanguageStandard)"
LibraryIncludeDirectories="@(LibraryIncludeDirectory)"
LibraryReferences="@(LibraryReference)"
LinkTimeOptimization="$(LinkTimeOptimization)"
MicrosoftExtensions="$(MicrosoftExtensions)"
Expand Down

0 comments on commit bcdffd6

Please sign in to comment.