Skip to content

Commit

Permalink
Add UnicodeEnvironment property.
Browse files Browse the repository at this point in the history
Closes #127.
  • Loading branch information
alexrp committed Jul 11, 2024
1 parent e9e32f2 commit d6b3ccb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/configuration/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ historical reasons.
Microsoft C/C++ extensions. Defaults to `false`, but note that the compiler
itself always enables some parts of this when targeting Windows as Win32
headers require it.
* `UnicodeEnvironment` (`true`, `false`): Enable/disable compiling for a Unicode
environment when targeting Windows in C/C++ projects. This causes the
`UNICODE` macro to be defined, and makes it so that
[`wmain`](https://learn.microsoft.com/en-us/cpp/c-language/using-wmain) and
[`wWinMain`](https://learn.microsoft.com/en-us/windows/win32/learnwin32/winmain--the-application-entry-point)
entry point functions must be used when building executables. Defaults to
`false`.

## Static Analysis

Expand Down
6 changes: 6 additions & 0 deletions src/sdk/ZigCompile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ public string SymbolVisibility
[Required]
public bool TrustAnalysis { get; set; }

[Required]
public bool UnicodeEnvironment { get; set; }

[Required]
public int WarningLevel { get; set; }

Expand Down Expand Up @@ -317,6 +320,9 @@ protected override string GenerateCommandLineCommands()
else if (CxxExceptions)
builder.AppendSwitch("-fexceptions");

if (UnicodeEnvironment)
builder.AppendSwitch("-municode");

builder.AppendSwitch("-fno-strict-aliasing");

if (FastMath)
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 @@ -95,6 +95,7 @@
ToolExe="$(ZigExePath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
TrustAnalysis="$(TrustAnalysis)"
UnicodeEnvironment="$(UnicodeEnvironment)"
WarningLevel="$(WarningLevel)" />

<CallTarget Targets="_GatherCompileCommands" />
Expand Down
1 change: 1 addition & 0 deletions src/sdk/build/Vezel.Zig.Sdk.Defaults.targets
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<CxxExceptions Condition="'$(CxxExceptions)' == ''">true</CxxExceptions>
<CxxReflection Condition="'$(CxxReflection)' == ''">true</CxxReflection>
<MicrosoftExtensions Condition="'$(MicrosoftExtensions)' == ''">false</MicrosoftExtensions>
<UnicodeEnvironment Condition="'$(UnicodeEnvironment)' == ''">false</UnicodeEnvironment>
<ZigVersion Condition="'$(ZigVersion)' == ''">0.13.0</ZigVersion>
</PropertyGroup>

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 @@ -67,6 +67,7 @@
ToolExe="$(ZigExePath)"
TreatWarningsAsErrors="$(TreatWarningsAsErrors)"
TrustAnalysis="$(TrustAnalysis)"
UnicodeEnvironment="$(UnicodeEnvironment)"
WarningLevel="$(WarningLevel)" />

<Message Text="Running tests natively..."
Expand Down

0 comments on commit d6b3ccb

Please sign in to comment.