diff --git a/build-icu.ps1 b/build-icu.ps1 index 2ceca7608c55..338b3d368a96 100644 --- a/build-icu.ps1 +++ b/build-icu.ps1 @@ -76,11 +76,14 @@ if (-not (Test-Path $ICU_SOURCE_DIR)) { } if ($Platform -eq "x64") { - $ArchFlag = if ($Baseline) { "/arch:SSE2" } else { "/arch:AVX2" } + $ArchFlag = if ($Baseline) { "/clang:-march=nehalem" } else { "/clang:-march=haswell" } } else { $ArchFlag = "" } +# ClangCL for stage 2 so -march= limits codegen (MSVC /arch:SSE2 is a no-op on x64). +$ToolsetArg = if ($Platform -eq "x64") { @("/p:PlatformToolset=ClangCL") } else { @() } + # --- Function to patch vcxproj files for static library build with /MT --- function Patch-IcuVcxProj { param( @@ -125,6 +128,10 @@ function Patch-IcuVcxProj { $content = $content -replace '[^<]*\.(dll|DLL)', '' $content = $content -replace '[^<]*', '' + # Strip .rc — rc.exe cannot parse clang stddef.h and static libs do not need version resources. + $content = $content -replace "(?s)]*>.*?", "" + $content = $content -replace "]*/>", "" + # For stubdata - remove resource-only DLL settings if ($FilePath -match "stubdata") { $content = $content -replace 'true', '' @@ -235,6 +242,7 @@ foreach ($target in @("common", "i18n")) { "/v:minimal" ) + $buildArgs += $ToolsetArg & $msbuildPath $buildArgs if ($LASTEXITCODE -ne 0) {