Skip to content

Commit 33f3eba

Browse files
committed
Be able to build AAR package
Signed-off-by: Hui-Hong You <hiroshi@ghostsinthelab.org>
1 parent ac63c85 commit 33f3eba

7 files changed

Lines changed: 874 additions & 29 deletions

File tree

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libchewing-android-module/build.gradle.kts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ plugins {
33
alias(libs.plugins.jetbrains.kotlin.android)
44
}
55

6+
val versionName: String = "0.8.1"
7+
68
android {
79
namespace = "com.miyabi_hiroshi.app.libchewing_android_module"
810
compileSdk = 34
@@ -14,34 +16,40 @@ android {
1416
consumerProguardFiles("consumer-rules.pro")
1517
externalNativeBuild {
1618
cmake {
19+
cFlags("-Wno-unused-function", "-Wno-unused-but-set-variable")
1720
cppFlags("")
21+
targets("libchewing", "libchewing_android_module")
1822
}
1923
}
2024

2125
targetSdk = 34
26+
setProperty("archivesBaseName", "${project.name}_${versionName}")
2227
}
2328

2429
buildTypes {
2530
release {
26-
isMinifyEnabled = false
31+
isMinifyEnabled = true
2732
proguardFiles(
2833
getDefaultProguardFile("proguard-android-optimize.txt"),
2934
"proguard-rules.pro"
3035
)
3136
}
37+
debug {
38+
isMinifyEnabled = false
39+
}
3240
}
3341
externalNativeBuild {
3442
cmake {
3543
path("src/main/cpp/CMakeLists.txt")
36-
version = "3.22.1"
44+
version = "3.24.0+"
3745
}
3846
}
3947
compileOptions {
40-
sourceCompatibility = JavaVersion.VERSION_1_8
41-
targetCompatibility = JavaVersion.VERSION_1_8
48+
sourceCompatibility = JavaVersion.VERSION_17
49+
targetCompatibility = JavaVersion.VERSION_17
4250
}
4351
kotlinOptions {
44-
jvmTarget = "1.8"
52+
jvmTarget = "17"
4553
}
4654
ndkVersion = "26.1.10909125"
4755
buildToolsVersion = "34.0.0"

libchewing-android-module/src/main/cpp/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33
# For more examples on how to use CMake, see https://github.com/android/ndk-samples.
44

55
# Sets the minimum CMake version required for this project.
6-
cmake_minimum_required(VERSION 3.22.1)
6+
# Keep same with libchewing (upstream):
7+
cmake_minimum_required(VERSION 3.24.0)
78

89
# Declares the project name. The project name can be accessed via ${ PROJECT_NAME},
910
# Since this is the top level CMakeLists.txt, the project name is also accessible
1011
# with ${CMAKE_PROJECT_NAME} (both CMake variables are in-sync within the top level
1112
# build script scope).
12-
project("libchewing_android_module")
13+
project("libchewing_android_module" LANGUAGES C CXX)
14+
15+
# Import libchewing here:
16+
SET(BUILD_INFO true)
17+
SET(WITH_RUST false)
18+
SET(WITH_SQLITE3 true)
19+
SET(BUILD_SHARED_LIBS OFF)
20+
add_subdirectory(${CMAKE_SOURCE_DIR}/libs/libchewing EXCLUDE_FROM_ALL)
1321

1422
# Creates and names a library, sets it as either STATIC
1523
# or SHARED, and provides the relative paths to its source code.
@@ -33,5 +41,6 @@ add_library(${CMAKE_PROJECT_NAME} SHARED
3341
# build script, prebuilt third-party libraries, or Android system libraries.
3442
target_link_libraries(${CMAKE_PROJECT_NAME}
3543
# List libraries link to the target library
44+
libchewing
3645
android
3746
log)

0 commit comments

Comments
 (0)