Skip to content

Commit

Permalink
Mozc
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Dec 30, 2024
1 parent 4aa7b8b commit 14f84bb
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
build:
needs: lint
runs-on: ${{ matrix.os }}
env:
MOZC_SHA: ad0e97b8b8dcfd4c841a02c5d6a043fb5e741405
strategy:
fail-fast: false
matrix:
Expand All @@ -34,6 +36,13 @@ jobs:
with:
submodules: recursive

- uses: actions/checkout@v4
with:
submodules: recursive
repository: google/mozc
path: engines/fcitx5-mozc/mozc
ref: ${{ env.MOZC_SHA }}

- name: Install dependencies
run: |
brew install \
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "engines/fcitx5-lua"]
path = engines/fcitx5-lua
url = https://github.com/fcitx/fcitx5-lua
[submodule "engines/fcitx5-mozc"]
path = engines/fcitx5-mozc
url = https://github.com/fcitx-contrib/fcitx5-mozc
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{
"type": "shell",
"label": "Configure",
"command": "cmake -B build -G Xcode -DURL_SCHEME=fcitx -DCHINESE_ADDONS=ON -DHALLELUJAH=ON -DRIME=ON -DIOS_PLATFORM=SIMULATOR",
"command": "cmake -B build -G Xcode -DURL_SCHEME=fcitx -DCHINESE_ADDONS=ON -DHALLELUJAH=ON -DMOZC=ON -DRIME=ON -DIOS_PLATFORM=SIMULATOR",
"group": {
"kind": "build"
}
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ add_subdirectory(ipc)

option(CHINESE_ADDONS "" ON)
option(HALLELUJAH "" OFF)
option(MOZC "" OFF)
option(RIME "" OFF)

function(copy_to_keyboard cmd file relative_path)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IOS_PLATFORM=SIMULATOR ./scripts/install-deps.sh
git apply --directory=fcitx5 patches/fcitx5.patch
git apply --directory=engines/libime/src/libime/core/kenlm patches/kenlm.patch
git apply --directory=engines/fcitx5-rime patches/rime.patch # if building with Rime
git clone https://github.com/google/mozc engines/fcitx5-mozc/mozc --depth=1 --recurse-submodules # if building with Mozc
```

### Build with CMake
Expand Down
16 changes: 16 additions & 0 deletions engines/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ if (HALLELUJAH)
list(APPEND DEFAULT_INPUT_METHODS hallelujah)
endif()

if (MOZC)
set(MOZC_TARGET
"-L${PREBUILDER_LIB_DIR}"
"-lmozc-static"
"-lutf8_validity"
"-lprotobuf"
"-labsl"
)
add_subdirectory(fcitx5-mozc)
target_include_directories(mozc PRIVATE
"${PREBUILDER_INCLUDE_DIR}/mozc"
"${PROJECT_SOURCE_DIR}/include"
)
list(APPEND DEFAULT_INPUT_METHODS mozc)
endif()

if (RIME)
# RIME_DATA_DIR is not actually used but must exist.
set(RIME_DATA_DIR "/usr/share/rime-data")
Expand Down
2 changes: 1 addition & 1 deletion engines/fcitx5-chinese-addons
Submodule fcitx5-chinese-addons updated 11 files
+53 −47 im/pinyin/pinyin.cpp
+235 −224 po/ca.po
+235 −224 po/da.po
+235 −224 po/de.po
+235 −224 po/fcitx5-chinese-addons.pot
+235 −224 po/he.po
+235 −224 po/ja.po
+237 −226 po/ko.po
+229 −210 po/ru.po
+222 −211 po/zh_CN.po
+220 −209 po/zh_TW.po
1 change: 1 addition & 0 deletions engines/fcitx5-mozc
Submodule fcitx5-mozc added at 5580d5
2 changes: 1 addition & 1 deletion fcitx5
Submodule fcitx5 updated 137 files
1 change: 1 addition & 0 deletions include/Fcitx5/Utils/fcitx-utils/macros.h
1 change: 1 addition & 0 deletions include/fcitx-module/clipboard/clipboard_public.h
1 change: 1 addition & 0 deletions scripts/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ deps=(
json-c
leveldb
libintl
libmozc
librime
libuv
lua
Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ if (HALLELUJAH)
copy_to_keyboard(copy "${HALLELUJAH_BINARY_DIR}/src/hallelujah.conf" "${IM_PREFIX}/hallelujah.conf")
endif()

if (MOZC)
set(MOZC_BINARY_DIR "${PROJECT_BINARY_DIR}/engines/fcitx5-mozc")
copy_to_keyboard(copy "${MOZC_BINARY_DIR}/src/unix/fcitx5/mozc-addon.conf" "${ADDON_PREFIX}/mozc.conf")
copy_to_keyboard(copy "${PROJECT_SOURCE_DIR}/engines/fcitx5-mozc/src/unix/fcitx5/mozc.conf" "${IM_PREFIX}/mozc.conf")
endif()

if (RIME)
set(RIME_BINARY_DIR "${PROJECT_BINARY_DIR}/engines/fcitx5-rime")
copy_to_keyboard(copy "${RIME_BINARY_DIR}/src/rime-addon.conf" "${ADDON_PREFIX}/rime.conf")
Expand Down

0 comments on commit 14f84bb

Please sign in to comment.