Skip to content

Commit c5f1944

Browse files
authored
CI: Bundle arm64 libraries with Windows multilib package (#4846)
1 parent ae47998 commit c5f1944

File tree

4 files changed

+52
-4
lines changed

4 files changed

+52
-4
lines changed

.github/actions/merge-windows/action.yml

+44-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ runs:
3131
$conf32 = "`r`n""i[3-6]86-.*-windows-msvc"":" + $conf32.Substring($conf32.IndexOf("`r`ndefault:") + 10)
3232
$conf32 = $conf32.Substring(0, $conf32.IndexOf("`r`n};`r`n") + 6)
3333
$conf32 = $conf32.Replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib32')
34-
Add-Content etc\ldc2.conf $conf32
34+
Add-Content etc\ldc2.conf $conf32 -NoNewline
3535
cat etc\ldc2.conf
3636
3737
- name: Generate hello.d
@@ -63,6 +63,49 @@ runs:
6363
set PATH=%CD%\ldc2-multilib\lib32;%PATH%
6464
ldc2-multilib\bin\ldc2 -link-defaultlib-shared -m32 -run hello.d || exit /b
6565
66+
# preliminary arm64 cross-compilation support
67+
- name: Install ninja v1.12.1
68+
uses: Ahajha/gha-setup-ninja@69595b0cf872acdad8ce599142fbdc88724b9a2b
69+
- name: Set VSDIR env variable
70+
shell: bash
71+
run: echo "VSDIR=$(vswhere -latest -property installationPath)" >> $GITHUB_ENV
72+
- name: Cross-compile arm64 libraries
73+
shell: cmd
74+
run: |
75+
echo on
76+
call "%VSDIR%\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=x64 || exit /b
77+
echo on
78+
ldc2-multilib\bin\ldc-build-runtime --ninja ^
79+
--buildDir=build-libs-arm64 ^
80+
--dFlags=-mtriple=aarch64-windows-msvc ^
81+
"--ldcSrcDir=%CD%" ^
82+
BUILD_LTO_LIBS=ON
83+
- name: Copy arm64 libraries
84+
shell: bash
85+
run: |
86+
set -eux
87+
cp -R build-libs-arm64/lib ldc2-multilib/libarm64
88+
rm ldc2-multilib/libarm64/*.{exp,ilk}
89+
rm ldc2-multilib/libarm64/{druntime,phobos2}-ldc-shared.pdb
90+
- name: Add arm64 section to ldc2.conf
91+
shell: pwsh
92+
run: |
93+
cd ldc2-multilib
94+
$conf64 = cat etc\ldc2.conf -Raw
95+
$conf64 = "`r`n""(aarch|arm)64-.*-windows-msvc"":" + $conf64.Substring($conf64.IndexOf("`r`ndefault:") + 10)
96+
$conf64 = $conf64.Substring(0, $conf64.IndexOf("`r`n};`r`n") + 6)
97+
$conf64 = $conf64.Replace('%%ldcbinarypath%%/../lib64', '%%ldcbinarypath%%/../libarm64')
98+
Add-Content etc\ldc2.conf $conf64 -NoNewline
99+
cat etc\ldc2.conf
100+
- name: Run arm64 hello-world cross-compilation smoke tests
101+
shell: cmd
102+
run: |
103+
echo on
104+
call "%VSDIR%\Common7\Tools\VsDevCmd.bat" -arch=arm64 -host_arch=x64 || exit /b
105+
echo on
106+
ldc2-multilib\bin\ldc2 -mtriple=aarch64-windows-msvc hello.d || exit /b
107+
ldc2-multilib\bin\ldc2 -mtriple=aarch64-windows-msvc -link-defaultlib-shared hello.d || exit /b
108+
66109
- name: Pack multilib package
67110
shell: bash
68111
run: |

.github/workflows/main.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,14 @@ jobs:
317317

318318
merge-windows:
319319
name: Windows multilib
320-
runs-on: windows-latest
320+
runs-on: windows-2022
321321
timeout-minutes: 30
322322
needs: build-native
323323
steps:
324324
- uses: actions/checkout@v4
325+
with:
326+
submodules: true
327+
fetch-depth: 50
325328
- name: Merge x64 & x86 packages to multilib one & build installer
326329
uses: ./.github/actions/merge-windows
327330

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#### Platform support
1010
- Supports LLVM 15 - 19.
1111
- 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)
12-
- 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)
12+
- 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)
1313

1414
#### Bug fixes
1515
- Building multi-file D applications with control-flow protection will no longer cause LDC to throw an internal compiler error. (#4828)

packaging/windows_installer.iss

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@ SolidCompression=yes
2929
Name: "english"; MessagesFile: "compiler:Default.isl"
3030

3131
[Files]
32-
Source: "{#LDCDir}\*"; Excludes: "\lib32,\lib64"; DestDir: "{app}"; Components: core; Flags: ignoreversion recursesubdirs
32+
Source: "{#LDCDir}\*"; Excludes: "\lib32,\lib64,\libarm64"; DestDir: "{app}"; Components: core; Flags: ignoreversion recursesubdirs
3333
Source: "{#LDCDir}\lib64\*"; DestDir: "{app}\lib64"; Components: lib64; Flags: ignoreversion recursesubdirs
3434
Source: "{#LDCDir}\lib32\*"; DestDir: "{app}\lib32"; Components: lib32; Flags: ignoreversion recursesubdirs
35+
Source: "{#LDCDir}\libarm64\*"; DestDir: "{app}\libarm64"; Components: libarm64; Flags: ignoreversion recursesubdirs
3536

3637
[Components]
3738
Name: core; Description: "Executables, config file and imports"; Types: full compact custom; Flags: fixed
3839
Name: lib64; Description: "x64 libraries"; Types: full compact
3940
Name: lib32; Description: "x86 libraries"; Types: full
41+
Name: libarm64; Description: "arm64 libraries"; Types: full
4042

4143
[Run]
4244
; note: not added to PATH for silent installs with /SILENT or /VERYSILENT

0 commit comments

Comments
 (0)