hiroshiyui / GuilelessBopomofo

Guileless Bopomofo(樸實注音鍵盤)- A Bopomofo(注音符號)software keyboard (aka input method editor) on Android, which is utilizing libchewing for intelligent phonetic processing.
Other
91 stars 5 forks source link

Make libchewing as an AAR (Android Archive) / Android module #35

Closed hiroshiyui closed 1 month ago

hiroshiyui commented 1 month ago

Is your feature request related to a problem? Please describe.

Since libchewing is doing new Rust implementation, keep compatibility is a top level issue.

Describe the solution you'd like

I have to rewrite the existent CMakeLists.txt (the one in Guileless Bopomofo) in order to build chewing-jni share library correctly.

Describe alternatives you've considered

No, it's a MUST-DO TASK.

hiroshiyui commented 1 month ago

Currently, the cmake_minimum_required(VERSION 3.24.0) in libchewing is higher than cmake_minimum_required(VERSION 3.22.1) in Guileless Bopomofo. This stops the way to improve 'Don\'t Repeat Yourself' issue.

hiroshiyui commented 1 month ago

Also, the include() directive doesn't work well if I just do include another CMakeLists.txt directly, because they are different project() by design.

Perhaps the better policy is keeping the existent CMakeLists.txt as is, then add several Gradle tasks to utilize system-side CMake like what prepareChewing() do.

hiroshiyui commented 1 month ago

REMINDER:

cmake --preset c99-release -DBUILD_SHARED_LIBS=OFF . will make make to build static linked library (libchewing.a).

hiroshiyui commented 1 month ago

REMINDER:

CMakeLists.txt in Android NDK behaves like a build script (runs by Ninja implicitly), while in libchewing, is like a preprocessor/generator for build systems such as Make.

hiroshiyui commented 1 month ago

Mmm...

  1. Edit CMakeLists.txt in libchewing, force cmake_minimum_required() to VERSION 3.22.1 works, the building process is finished without any error.
  2. Edit CMakeLists.txt in Guileless Bopomofo, execute_process() will run without any CMake based environment variable (CFLAGS...), which is useless for me.
  3. Make libchewing as an AAR might be a better way to lower the dependency coupling.
hiroshiyui commented 1 month ago

It's a good lesson for me that learned "these ways are NO-WAY".

hiroshiyui commented 1 month ago

Done at https://github.com/hiroshiyui/libchewingAndroidAppModule

REMINDER: Initialization of Guileless Bopomofo needs data files, being copied from new location.

hiroshiyui commented 1 month ago

Done at 0a6b42e627001f79a4de4370a06d1e8e93171257