diff --git a/.github/actions/merge-windows/action.yml b/.github/actions/merge-windows/action.yml index adfdd3d4c76..cec5f458491 100644 --- a/.github/actions/merge-windows/action.yml +++ b/.github/actions/merge-windows/action.yml @@ -31,7 +31,7 @@ runs: $conf32 = "`r`n""i[3-6]86-.*-windows-msvc"":" + $conf32.Substring($conf32.IndexOf("`r`ndefault:") + 10) $conf32 = $conf32.Substring(0, $conf32.IndexOf("`r`n};`r`n") + 6) $conf32 = $conf32.Replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib32') - Add-Content etc\ldc2.conf $conf32 + Add-Content etc\ldc2.conf $conf32 -NoNewline cat etc\ldc2.conf - name: Generate hello.d @@ -63,6 +63,49 @@ runs: set PATH=%CD%\ldc2-multilib\lib32;%PATH% ldc2-multilib\bin\ldc2 -link-defaultlib-shared -m32 -run hello.d || exit /b + # preliminary arm64 cross-compilation support + - name: Install ninja v1.12.1 + uses: Ahajha/gha-setup-ninja@69595b0cf872acdad8ce599142fbdc88724b9a2b + - name: Set VSDIR env variable + shell: bash + run: echo "VSDIR=$(vswhere -latest -property installationPath)" >> $GITHUB_ENV + - name: Cross-compile arm64 libraries + shell: cmd + run: | + echo on + call "%VSDIR%\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=x64 || exit /b + echo on + ldc2-multilib\bin\ldc-build-runtime --ninja ^ + --buildDir=build-libs-arm64 ^ + --dFlags=-mtriple=aarch64-windows-msvc ^ + "--ldcSrcDir=%CD%" ^ + BUILD_LTO_LIBS=ON + - name: Copy arm64 libraries + shell: bash + run: | + set -eux + cp -R build-libs-arm64/lib ldc2-multilib/libarm64 + rm ldc2-multilib/libarm64/*.{exp,ilk} + rm ldc2-multilib/libarm64/{druntime,phobos2}-ldc-shared.pdb + - name: Add arm64 section to ldc2.conf + shell: pwsh + run: | + cd ldc2-multilib + $conf64 = cat etc\ldc2.conf -Raw + $conf64 = "`r`n""(aarch|arm)64-.*-windows-msvc"":" + $conf64.Substring($conf64.IndexOf("`r`ndefault:") + 10) + $conf64 = $conf64.Substring(0, $conf64.IndexOf("`r`n};`r`n") + 6) + $conf64 = $conf64.Replace('%%ldcbinarypath%%/../lib64', '%%ldcbinarypath%%/../libarm64') + Add-Content etc\ldc2.conf $conf64 -NoNewline + cat etc\ldc2.conf + - name: Run arm64 hello-world cross-compilation smoke tests + shell: cmd + run: | + echo on + call "%VSDIR%\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=x64 || exit /b + echo on + ldc2-multilib\bin\ldc2 -mtriple=aarch64-windows-msvc hello.d || exit /b + ldc2-multilib\bin\ldc2 -mtriple=aarch64-windows-msvc -link-defaultlib-shared hello.d || exit /b + - name: Pack multilib package shell: bash run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7abdcaa0500..cf26b34f9ee 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -317,11 +317,14 @@ jobs: merge-windows: name: Windows multilib - runs-on: windows-latest + runs-on: windows-2022 timeout-minutes: 30 needs: build-native steps: - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 50 - name: Merge x64 & x86 packages to multilib one & build installer uses: ./.github/actions/merge-windows diff --git a/CHANGELOG.md b/CHANGELOG.md index fb6b67625da..f5e0a2a93fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ #### Platform support - Supports LLVM 15 - 19. - Initial compiler and runtime support for ppc64 and ppc64le systems that use IEEE 754R 128-bit floating-point as the default 128-bit floating-point format. (#4833) -- Added support for building for Windows on ARM64. Use option '-march=arm64' to compile, 'ldc-build-runtime.exe --dFlags -march=arm64' to build the runtime libraries. (#4835) +- Initial support for Windows on ARM64. The prebuilt Windows multilib package/installer bundles prebuilt arm64 druntime and Phobos; cross-compiling works out of the box via `-mtriple=aarch64-windows-msvc`, but you currently need to set up a suited MSVC arm64 build environment before yourself (e.g., by running `vsdevcmd.bat -arch=arm64 -host_arch=x64`). There's no bundled libcurl either yet. (#4835, #4846) #### Bug fixes - Building multi-file D applications with control-flow protection will no longer cause LDC to throw an internal compiler error. (#4828) diff --git a/packaging/windows_installer.iss b/packaging/windows_installer.iss index 69f50fe1bcf..c1dc469a544 100644 --- a/packaging/windows_installer.iss +++ b/packaging/windows_installer.iss @@ -29,14 +29,16 @@ SolidCompression=yes Name: "english"; MessagesFile: "compiler:Default.isl" [Files] -Source: "{#LDCDir}\*"; Excludes: "\lib32,\lib64"; DestDir: "{app}"; Components: core; Flags: ignoreversion recursesubdirs +Source: "{#LDCDir}\*"; Excludes: "\lib32,\lib64,\libarm64"; DestDir: "{app}"; Components: core; Flags: ignoreversion recursesubdirs Source: "{#LDCDir}\lib64\*"; DestDir: "{app}\lib64"; Components: lib64; Flags: ignoreversion recursesubdirs Source: "{#LDCDir}\lib32\*"; DestDir: "{app}\lib32"; Components: lib32; Flags: ignoreversion recursesubdirs +Source: "{#LDCDir}\libarm64\*"; DestDir: "{app}\libarm64"; Components: libarm64; Flags: ignoreversion recursesubdirs [Components] Name: core; Description: "Executables, config file and imports"; Types: full compact custom; Flags: fixed Name: lib64; Description: "x64 libraries"; Types: full compact Name: lib32; Description: "x86 libraries"; Types: full +Name: libarm64; Description: "arm64 libraries"; Types: full [Run] ; note: not added to PATH for silent installs with /SILENT or /VERYSILENT