Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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