@@ -211,8 +211,8 @@ protected override string GenerateCommandLineCommands()
211211 {
212212 ( ZigCompilerMode . C , _ ) => "cc" ,
213213 ( ZigCompilerMode . Cxx , _ ) => "c++" ,
214- ( ZigCompilerMode . Zig , ZigOutputType . Exe ) => "build-exe" ,
215214 ( ZigCompilerMode . Zig , ZigOutputType . Library ) => "build-lib" ,
215+ ( ZigCompilerMode . Zig , _ ) => "build-exe" ,
216216 ( ZigCompilerMode . Test , _ ) => "test" ,
217217 _ => throw new Exception ( ) ,
218218 } ) ;
@@ -224,14 +224,7 @@ protected override string GenerateCommandLineCommands()
224224
225225 builder . AppendSwitch ( $ "-target { TargetTriple . ToLowerInvariant ( ) } ") ;
226226
227- if ( _outputType == ZigOutputType . Exe )
228- {
229- builder . AppendSwitch ( "-fPIE" ) ;
230-
231- if ( _symbolExports == ZigSymbolExports . All )
232- builder . AppendSwitch ( "-rdynamic" ) ;
233- }
234- else
227+ if ( _outputType == ZigOutputType . Library )
235228 {
236229 builder . AppendSwitch ( "-fPIC" ) ;
237230
@@ -247,6 +240,13 @@ protected override string GenerateCommandLineCommands()
247240 builder . AppendSwitch ( isZig ? $ "-z { un } defs" : $ "-Wl,-z,{ un } defs") ;
248241 builder . AppendSwitch ( isZig ? $ "-f{ no } allow-shlib-undefined" : $ "-Wl,--{ no } allow-shlib-undefined") ;
249242 }
243+ else
244+ {
245+ builder . AppendSwitch ( "-fPIE" ) ;
246+
247+ if ( _symbolExports == ZigSymbolExports . All )
248+ builder . AppendSwitch ( "-rdynamic" ) ;
249+ }
250250
251251 if ( isZig )
252252 {
@@ -604,6 +604,9 @@ void TryAppendWarningSwitch(string name)
604604 builder . AppendSwitch ( isZig ? "-z origin" : "-Wl,-z,origin" ) ;
605605 builder . AppendSwitchIfNotNull ( isZig ? "-rpath " : "-Wl,-rpath," , "$ORIGIN" ) ;
606606
607+ builder . AppendSwitchIfNotNull (
608+ isZig ? "--subsystem " : "-Wl,--subsystem," , _outputType == ZigOutputType . WinExe ? "windows" : "console" ) ;
609+
607610 // TODO: https://github.com/vezel-dev/zig-sdk/issues/8
608611
609612 builder . AppendFileNamesIfNotNull ( Sources , delimiter : " " ) ;
0 commit comments