Skip to content

Commit c42e2d9

Browse files
authored
feat: Add Android support (#72)
1 parent a3a8348 commit c42e2d9

30 files changed

Lines changed: 1505 additions & 26 deletions

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@ jobs:
2727
with:
2828
clang-format-version: 15
2929

30+
- uses: actions/setup-java@v5
31+
with:
32+
distribution: 'temurin'
33+
java-version: '21'
34+
35+
- name: check Java formatting
36+
uses: axel-op/googlejavaformat-action@v4
37+
with:
38+
args: "--aosp --set-exit-if-changed"
39+
3040
clippy:
3141
runs-on: ${{ matrix.os }}
3242
strategy:
@@ -70,6 +80,8 @@ jobs:
7080
- target: x86_64-pc-windows-msvc
7181
- target: x86_64-unknown-linux-gnu
7282
- target: x86_64-unknown-linux-musl
83+
- target: aarch64-linux-android
84+
- target: x86_64-linux-android
7385

7486
name: cargo-deny ${{ matrix.target }}
7587
runs-on: ubuntu-22.04

.github/workflows/publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ jobs:
5151
- os: ubuntu-latest
5252
target: x86_64-unknown-linux-gnu
5353
path: linux/x86_64
54+
- os: ubuntu-latest
55+
target: aarch64-linux-android
56+
cmake-options: -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-28
57+
path: android/arm64-v8a
58+
- os: ubuntu-latest
59+
target: x86_64-linux-android
60+
cmake-options: -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=x86_64 -DANDROID_PLATFORM=android-28
61+
path: android/x86_64
5462

5563
name: Build
5664
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build
22
lib
33
target
4+
.cxx

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ project(accesskit-c)
44

55
option(ACCESSKIT_BUILD_HEADERS "Whether to build header files" OFF)
66
option(ACCESSKIT_BUILD_LIBRARIES "Whether to build libraries" ON)
7+
option(ACCESSKIT_ANDROID_EMBEDDED_DEX "Whether to embed the classes.dex file in the library (Android only)" OFF)
78

89
if (ACCESSKIT_BUILD_LIBRARIES)
910
include(FetchContent)
@@ -19,6 +20,9 @@ if (ACCESSKIT_BUILD_LIBRARIES)
1920
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
2021
set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
2122
corrosion_import_crate(MANIFEST_PATH Cargo.toml)
23+
if (ACCESSKIT_ANDROID_EMBEDDED_DEX)
24+
corrosion_set_features(accesskit FEATURES android-embedded-dex)
25+
endif()
2226
endif()
2327

2428
if (ACCESSKIT_BUILD_HEADERS)

0 commit comments

Comments
 (0)