diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6264163..e6a2e8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,3 +120,11 @@ jobs: run: swift build --build-tests - name: Test run: swift test --skip-build + + android: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build and Test + uses: skiptools/swift-android-action@v2 diff --git a/CommandLine/main.swift b/CommandLine/main.swift index a58fdab..d47a098 100644 --- a/CommandLine/main.swift +++ b/CommandLine/main.swift @@ -31,6 +31,8 @@ #if canImport(Darwin) import Darwin.POSIX +#elseif canImport(Android) +import Android #else import Glibc #endif diff --git a/SwiftDraw/LayerTree.Transform.swift b/SwiftDraw/LayerTree.Transform.swift index 51cc040..2c157fa 100644 --- a/SwiftDraw/LayerTree.Transform.swift +++ b/SwiftDraw/LayerTree.Transform.swift @@ -31,6 +31,8 @@ #if canImport(Darwin) import Darwin +#elseif canImport(Android) +import Android #else import Glibc #endif @@ -114,3 +116,15 @@ extension Array where Element == LayerTree.Transform { } } } + +#if os(Android) +// The Android module does not have Float overloads for the various math functions +func tan(_ value: Float) -> Float { tanf(value) } +func atan(_ value: Float) -> Float { atanf(value) } +func cos(_ value: Float) -> Float { cosf(value) } +func acos(_ value: Float) -> Float { acosf(value) } +func sin(_ value: Float) -> Float { sinf(value) } +func asin(_ value: Float) -> Float { asinf(value) } +func ceil(_ value: Float) -> Float { ceilf(value) } +#endif +