Skip to content

Commit

Permalink
Update build.ps1 (dotnet#97982)
Browse files Browse the repository at this point in the history
* Update build.ps1

* Update build.ps1
  • Loading branch information
ViktorHofer committed Feb 5, 2024
1 parent c772489 commit f28bcf1
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,26 @@ if ($os) {
$os = $os.ToLowerInvariant()
}

if ($os -eq "browser") {
# override default arch for Browser, we only support wasm
$arch = "wasm"

if ($msbuild -eq $True) {
Write-Error "Using the -msbuild option isn't supported when building for Browser on Windows, we need need ninja for Emscripten."
exit 1
}
}

if ($os -eq "wasi") {
# override default arch for wasi, we only support wasm
$arch = "wasm"

if ($msbuild -eq $True) {
Write-Error "Using the -msbuild option isn't supported when building for WASI on Windows, we need ninja for WASI-SDK."
exit 1
}
}

if ($vs) {
$archToOpen = $arch[0]
$configToOpen = $configuration[0]
Expand Down Expand Up @@ -247,6 +267,16 @@ if ($vs) {
$env:RUNTIMEFLAVOR=$runtimeFlavor
}

# Respect the TargetOS variable for building non AnyOS libraries
if ($os) {
$env:TARGETOS=$os
}

# Respect the TargetArchitecture variable for building non AnyCPU libraries
if ($arch) {
$env:TARGETARCHITECTURE=$arch
}

# Launch Visual Studio with the locally defined environment variables
."$vs"

Expand Down Expand Up @@ -301,26 +331,6 @@ $env:DOTNETSDK_ALLOW_TARGETING_PACK_CACHING=0

$failedBuilds = @()

if ($os -eq "browser") {
# override default arch for Browser, we only support wasm
$arch = "wasm"

if ($msbuild -eq $True) {
Write-Error "Using the -msbuild option isn't supported when building for Browser on Windows, we need need ninja for Emscripten."
exit 1
}
}

if ($os -eq "wasi") {
# override default arch for wasi, we only support wasm
$arch = "wasm"

if ($msbuild -eq $True) {
Write-Error "Using the -msbuild option isn't supported when building for WASI on Windows, we need ninja for WASI-SDK."
exit 1
}
}

foreach ($config in $configuration) {
$argumentsWithConfig = $arguments + " -configuration $((Get-Culture).TextInfo.ToTitleCase($config))";
foreach ($singleArch in $arch) {
Expand Down

0 comments on commit f28bcf1

Please sign in to comment.