From 6bd91429ad13652ce804b3cafc0c5bbf6798fc04 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 5 Feb 2024 15:43:29 +0100 Subject: [PATCH 1/2] Update build.ps1 --- eng/build.ps1 | 52 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index a874e5e828cb6d..d41bd66c78114a 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -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] @@ -235,7 +255,7 @@ if ($vs) { # Disable .NET runtime signature validation errors which errors for local builds $env:VSDebugger_ValidateDotnetDebugLibSignatures=0; - # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations + # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations if ($runtimeConfiguration) { $env:RUNTIMECONFIGURATION=$runtimeConfiguration @@ -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" @@ -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) { From ac07b94fe542fef2073e30deec58f9bb762903ce Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 5 Feb 2024 15:44:01 +0100 Subject: [PATCH 2/2] Update build.ps1 --- eng/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.ps1 b/eng/build.ps1 index d41bd66c78114a..db18267f33e1c5 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -255,7 +255,7 @@ if ($vs) { # Disable .NET runtime signature validation errors which errors for local builds $env:VSDebugger_ValidateDotnetDebugLibSignatures=0; - # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations + # Respect the RuntimeConfiguration variable for building inside VS with different runtime configurations if ($runtimeConfiguration) { $env:RUNTIMECONFIGURATION=$runtimeConfiguration