Skip to content

Mozc #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Mozc #667

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@
[submodule "plugin/thai/src/main/cpp/fcitx5-libthai"]
path = plugin/thai/src/main/cpp/fcitx5-libthai
url = https://github.com/fcitx/fcitx5-libthai
[submodule "plugin/mozc/src/main/cpp/fcitx5-mozc"]
path = plugin/mozc/src/main/cpp/fcitx5-mozc
url = https://github.com/fcitx-contrib/fcitx5-mozc
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GitHub: [![release version](https://img.shields.io/github/v/release/fcitx5-andro
- Zhuyin/Bopomofo (via [Chewing Plugin](./plugin/chewing))
- Jyutping (via [Jyutping Plugin](./plugin/jyutping/), powered by [libime-jyutping](https://github.com/fcitx/libime-jyutping))
- Vietnamese (via [UniKey Plugin](./plugin/unikey), supports Telex, VNI and VIQR)
- Japanese (via [Anthy Plugin](./plugin/anthy))
- Japanese (via [Mozc Plugin](./plugin/mozc) and [Anthy Plugin](./plugin/anthy))
- Korean (via [Hangul Plugin](./plugin/hangul))
- Sinhala (via [Sayura Plugin](./plugin/sayura))
- Thai (via [Thai Plugin](./plugin/thai))
Expand Down Expand Up @@ -94,6 +94,7 @@ First, clone this repository and fetch all submodules:
```shell
git clone git@github.com:fcitx5-android/fcitx5-android.git
git submodule update --init --recursive
git clone git@github.com:google/mozc plugin/mozc/src/main/cpp/fcitx5-mozc/mozc --depth=1 --recurse-submodules
```

Install `extra-cmake-modules` and `gettext` with your system package manager:
Expand Down
52 changes: 52 additions & 0 deletions plugin/mozc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
id("org.fcitx.fcitx5.android.app-convention")
id("org.fcitx.fcitx5.android.plugin-app-convention")
id("org.fcitx.fcitx5.android.native-app-convention")
id("org.fcitx.fcitx5.android.build-metadata")
id("org.fcitx.fcitx5.android.data-descriptor")
id("org.fcitx.fcitx5.android.fcitx-component")
}

android {
namespace = "org.fcitx.fcitx5.android.plugin.mozc"

defaultConfig {
applicationId = "org.fcitx.fcitx5.android.plugin.mozc"

@Suppress("UnstableApiUsage")
externalNativeBuild {
cmake {
targets(
"mozc"
)
}
}
}

buildTypes {
release {
resValue("string", "app_name", "@string/app_name_release")
}
debug {
resValue("string", "app_name", "@string/app_name_debug")
}
}

packaging {
jniLibs {
excludes += setOf(
"**/libc++_shared.so",
"**/libFcitx5*"
)
}
}
}

fcitxComponent {
installPrebuiltAssets = true
}

dependencies {
implementation(project(":lib:fcitx5"))
implementation(project(":lib:plugin-base"))
}
11 changes: 11 additions & 0 deletions plugin/mozc/licenses/libraries/fcitx5-mozc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"uniqueId": "fcitx/mozc",
"artifactVersion": "2.30.5618.101",
"description": "Mozc for Fcitx",
"name": "fcitx/mozc",
"website": "https://github.com/fcitx/mozc",
"tag": "native",
"licenses": [
"BSD-3-Clause"
]
}
6 changes: 6 additions & 0 deletions plugin/mozc/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:label="@string/app_name" />
</manifest>
30 changes: 30 additions & 0 deletions plugin/mozc/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.18)

project(fcitx5-android-plugin-mozc VERSION ${VERSION_NAME})

# For reproducible build
add_link_options("LINKER:--hash-style=gnu,--build-id=none")

# prefab dependency
find_package(fcitx5 REQUIRED CONFIG)
get_target_property(FCITX5_CMAKE_MODULES fcitx5::cmake INTERFACE_INCLUDE_DIRECTORIES)
set(CMAKE_MODULE_PATH ${FCITX5_CMAKE_MODULES} ${CMAKE_MODULE_PATH})

find_package(ECM MODULE)
find_package(Fcitx5Core MODULE)
find_package(Fcitx5Module MODULE)

add_library(Mozc_static STATIC IMPORTED)
set_target_properties(Mozc_static PROPERTIES
IMPORTED_LOCATION "${PREBUILT_DIR}/libmozc/${ANDROID_ABI}/lib/libmozc-static.a"
INTERFACE_INCLUDE_DIRECTORIES "${PREBUILT_DIR}/libmozc/${ANDROID_ABI}/include/mozc"
INTERFACE_LINK_LIBRARIES "-llog -L${PREBUILT_DIR}/libmozc/${ANDROID_ABI}/lib -labsl -lprotobuf -lutf8_validity"
)

set(MOZC_TARGET Mozc_static)
add_subdirectory(fcitx5-mozc)

target_include_directories(mozc PRIVATE
"${PROJECT_SOURCE_DIR}/../../../../../lib/fcitx5/build/headers/usr/include"
"${PROJECT_SOURCE_DIR}/../../../../../lib/fcitx5/build/headers/usr/include/Fcitx5/Module"
)
1 change: 1 addition & 0 deletions plugin/mozc/src/main/cpp/fcitx5-mozc
Submodule fcitx5-mozc added at 5580d5
6 changes: 6 additions & 0 deletions plugin/mozc/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name_debug">Fcitx5 (Mozc Plugin | Debug)</string>
<string name="app_name_release">Fcitx5 (Mozc Plugin)</string>
<string name="description">Mozc (Japanese input method) engine support for Fcitx5</string>
</resources>
6 changes: 6 additions & 0 deletions plugin/mozc/src/main/res/xml/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin xmlns="../../../../../pluginSchema.xsd">
<apiVersion>0.1</apiVersion>
<domain>fcitx5-mozc</domain>
<description>@string/description</description>
</plugin>
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ include(":plugin:chewing")
include(":plugin:sayura")
include(":plugin:jyutping")
include(":plugin:thai")
include(":plugin:mozc")