Skip to content

Commit 2a12b66

Browse files
committed
CI: Add native Windows arm64 job/package
1 parent 9e8881a commit 2a12b66

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

.github/actions/1-setup/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ runs:
5959
run: |
6060
set -eux
6161
cd ..
62+
suffix='win64'
63+
if [[ '${{ inputs.arch }}' == arm64 ]]; then
64+
suffix='woa64'
65+
fi
6266
curl -fL --retry 3 --max-time 300 -o clang.exe \
63-
https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.3/LLVM-20.1.3-win64.exe
67+
https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.3/LLVM-20.1.3-$suffix.exe
6468
./clang.exe //S # double-slash for bash
6569
rm clang.exe
6670
# C:\Program Files\LLVM\bin should already be in PATH
@@ -163,7 +167,9 @@ runs:
163167
cd ..
164168
165169
url='https://curl.se/windows/latest.cgi?p=win64-mingw.zip'
166-
if [[ '${{ inputs.arch }}' == x86 ]]; then
170+
if [[ '${{ inputs.arch }}' == arm64 ]]; then
171+
url='https://curl.se/windows/latest.cgi?p=win64a-mingw.zip'
172+
elif [[ '${{ inputs.arch }}' == x86 ]]; then
167173
url='https://curl.se/windows/latest.cgi?p=win32-mingw.zip'
168174
fi
169175

.github/actions/5-install/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ runs:
6666
6767
cp libcurl/ldc2/* installed/bin/
6868
69+
if [[ '${{ inputs.arch }}' == arm64 ]]; then
70+
echo "No MinGW-based libraries available for arm64 yet."
71+
exit 0
72+
fi
73+
6974
curl -fL --retry 3 --max-time 60 -o mingw-w64-libs.7z \
7075
https://github.com/ldc-developers/mingw-w64-libs/releases/download/v8.0.0/mingw-w64-libs-v8.0.0.7z
7176
mkdir mingw-w64-libs

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ runs:
6767
set PATH=%CD%\ldc2-multilib\lib32;%PATH%
6868
ldc2-multilib\bin\ldc2 -link-defaultlib-shared -m32 -run hello.d || exit /b
6969
70+
# TODO
7071
# preliminary arm64 cross-compilation support
7172
- name: Install ninja v1.12.1
7273
uses: Ahajha/gha-setup-ninja@69595b0cf872acdad8ce599142fbdc88724b9a2b

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ jobs:
101101
-DEXTRA_CXXFLAGS=-flto=full
102102
with_pgo: true
103103

104+
- job_name: Windows arm64
105+
os: windows-11-arm
106+
arch: arm64
107+
base_cmake_flags: >-
108+
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
109+
#extra_cmake_flags: >-
110+
# "-DD_COMPILER_FLAGS=-O -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto"
111+
# -DEXTRA_CXXFLAGS=-flto=full
112+
#with_pgo: true
113+
104114
- job_name: Windows x86
105115
os: windows-2025
106116
arch: x86

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ if(NOT MSVC_IDE)
195195
endif()
196196

197197
if(MSVC)
198-
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
198+
if($ENV{VSCMD_ARG_TGT_ARCH} STREQUAL "arm64")
199+
message(STATUS "Let D host compiler output arm64 object files")
200+
append("-mtriple=aarch64-windows-msvc" DFLAGS_BASE)
201+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
199202
message(STATUS "Let D host compiler output 64-bit object files")
200203
append("-m64" DFLAGS_BASE)
201204
else()
@@ -300,7 +303,9 @@ endif()
300303
if(MSVC)
301304
separate_arguments(LLVM_LDFLAGS WINDOWS_COMMAND "${LLVM_LDFLAGS}")
302305
if(NOT MSVC_IDE) # apparently not needed for VS (and spaces in path are problematic)
303-
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
306+
if($ENV{VSCMD_ARG_TGT_ARCH} STREQUAL "arm64")
307+
list(APPEND LLVM_LDFLAGS "$ENV{VSINSTALLDIR}DIA SDK\\lib\\arm64\\diaguids.lib")
308+
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
304309
list(APPEND LLVM_LDFLAGS "$ENV{VSINSTALLDIR}DIA SDK\\lib\\amd64\\diaguids.lib")
305310
else()
306311
list(APPEND LLVM_LDFLAGS "$ENV{VSINSTALLDIR}DIA SDK\\lib\\diaguids.lib")

0 commit comments

Comments
 (0)