Skip to content

Commit e1f6992

Browse files
Add support for non-x86_64 Ubuntu (closes #244)
1 parent 2be4683 commit e1f6992

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ jobs:
2222
run: .\tests\test.ps1
2323

2424
build-and-test-ubuntu:
25-
runs-on: ubuntu-22.04
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: [ubuntu-22.04, ubuntu-22.04-arm64]
2630

2731
steps:
2832
- name: Checkout code

build.ps1

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ if ($runningOnWindows) {
4141
$exeName = "prefix"
4242
}
4343

44+
$marchArg = "-march=x86-64"
45+
if (-not $runningOnWindows) {
46+
$marchArg = $null
47+
}
48+
4449
$runtimeDllDest = Join-Path $script $runtimeDllName
4550
$runtimeLibDest = if ($runtimeLibName) { Join-Path $script $runtimeLibName } else { $null }
4651
$runtimePdbDest = if ($runtimePdbName) { Join-Path $script $runtimePdbName } else { $null }
@@ -76,7 +81,7 @@ if (-not $clangTarget) {
7681
exit 1
7782
}
7883

79-
if ($clangTarget -notmatch '^x86_64-') {
84+
if ($runningOnWindows -and $clangTarget -notmatch '^x86_64-') {
8085
Write-Error "$clangCmd must target baseline x64. Found target '$clangTarget'."
8186
Remove-Item -Recurse -Force $buildDir -ErrorAction SilentlyContinue
8287
exit 1
@@ -115,7 +120,7 @@ try {
115120
# MSVC-compatible driver mode for Windows
116121
$clangArgs = @(
117122
"--driver-mode=cl",
118-
"/clang:-march=x86-64",
123+
"/clang:$marchArg",
119124
"/clang:-fuse-ld=lld",
120125
"/clang:-flto=full",
121126
"/clang:-ffunction-sections",
@@ -129,12 +134,14 @@ try {
129134
} else {
130135
# GCC-compatible flags for Linux/macOS
131136
$clangArgs = @(
132-
"-march=x86-64",
133137
"-flto=full",
134138
"-ffunction-sections",
135139
"-fdata-sections",
136140
"-fPIC"
137141
)
142+
if ($marchArg) {
143+
$clangArgs = @($marchArg) + $clangArgs
144+
}
138145
$releaseCompileArgs = @(
139146
"-std=c17", "-O2", "-Wall", "-Wextra", "-Werror",
140147
"-D_GNU_SOURCE"

0 commit comments

Comments
 (0)