Skip to content

Commit 88591f7

Browse files
authored
Merge pull request #86 from mansbernhardt/android-support
Add Android (aarch64) cross-compile support to SwiftTimecodeCore
2 parents e224d8a + 9718b19 commit 88591f7

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,17 @@ jobs:
116116
run: swift build
117117
- name: Unit Tests
118118
run: swift test
119+
120+
android:
121+
name: Build (Android)
122+
runs-on: ubuntu-latest
123+
timeout-minutes: 30
124+
env:
125+
TARGET_TRIPLE: aarch64-unknown-linux-android28
126+
steps:
127+
- uses: actions/checkout@main
128+
- uses: orchetect/setup-swift-android-sdk@v1
129+
with:
130+
target-triple: ${{ env.TARGET_TRIPLE }}
131+
- name: Build
132+
run: swift build --swift-sdk "$TARGET_TRIPLE" --static-swift-stdlib

Sources/SwiftTimecodeCore/Timecode/Protocol Adoptions/Strideable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import Darwin
1010
import Glibc
1111
#elseif canImport(Musl)
1212
import Musl
13+
#elseif canImport(Android)
14+
import Android
1315
#endif
1416

1517
extension Timecode: Strideable {

Sources/SwiftTimecodeCore/Utilities/Outsourced/FloatingPoint and Darwin.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import Darwin
1515
import Glibc
1616
#elseif canImport(Musl)
1717
import Musl
18+
#elseif canImport(Android)
19+
import Android
1820
#endif
1921

2022
// MARK: - ceiling / floor
@@ -30,6 +32,8 @@ extension FloatingPoint {
3032
Glibc.ceil(self)
3133
#elseif canImport(Musl)
3234
Musl.ceil(self)
35+
#elseif canImport(Android)
36+
Android.ceil(self)
3337
#endif
3438
}
3539

@@ -43,6 +47,8 @@ extension FloatingPoint {
4347
Glibc.floor(self)
4448
#elseif canImport(Musl)
4549
Musl.floor(self)
50+
#elseif canImport(Android)
51+
Android.floor(self)
4652
#endif
4753
}
4854
}

0 commit comments

Comments
 (0)