Skip to content

Commit

Permalink
CI: Bundle arm64 libraries with Windows multilib package
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Feb 26, 2025
1 parent ae47998 commit e30de7e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/actions/merge-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,45 @@ 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 || 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: cp -R build-libs-arm64/lib ldc2-multilib/libarm64
- 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
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 || 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: |
Expand Down
4 changes: 3 additions & 1 deletion packaging/windows_installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e30de7e

Please sign in to comment.