From 11098066463876bdc783c778838ad9e313093816 Mon Sep 17 00:00:00 2001 From: Qijia Liu Date: Sun, 8 Dec 2024 22:04:46 -0500 Subject: [PATCH] lua addon (#31) --- .gitmodules | 3 +++ README.md | 3 ++- engines/CMakeLists.txt | 11 ++++++++--- engines/fcitx5-lua | 1 + src/CMakeLists.txt | 8 +++++++- 5 files changed, 21 insertions(+), 5 deletions(-) create mode 160000 engines/fcitx5-lua diff --git a/.gitmodules b/.gitmodules index 755fbb4..cb15888 100644 --- a/.gitmodules +++ b/.gitmodules @@ -16,3 +16,6 @@ [submodule "engines/libime"] path = engines/libime url = https://github.com/fcitx/libime +[submodule "engines/fcitx5-lua"] + path = engines/fcitx5-lua + url = https://github.com/fcitx/fcitx5-lua diff --git a/README.md b/README.md index 599801a..f2274a2 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ git apply --directory=engines/fcitx5-rime patches/rime.patch # if building with ```sh cmake -B build -G Xcode \ -DURL_SCHEME=fcitx \ + -DCHINESE_ADDONS=ON \ + -DHALLELUJAH=ON \ -DRIME=ON \ - -DCMAKE_TOOLCHAIN_FILE=cmake/ios.cmake \ -DIOS_PLATFORM=SIMULATOR cmake --build build --config Debug ``` diff --git a/engines/CMakeLists.txt b/engines/CMakeLists.txt index 2cfcb64..bf321d9 100644 --- a/engines/CMakeLists.txt +++ b/engines/CMakeLists.txt @@ -1,16 +1,21 @@ set(DEFAULT_INPUT_METHODS) if (CHINESE_ADDONS) - option(ENABLE_GUI OFF) - option(ENABLE_CLOUDPINYIN OFF) - option(ENABLE_DATA OFF) add_definitions(-DCHINESE_ADDONS) set(_Fcitx5Macro_SELF_DIR "${PROJECT_SOURCE_DIR}/fcitx5/src/lib/fcitx-utils") + + option(USE_DLOPEN "" OFF) + add_subdirectory(fcitx5-lua) + + option(ENABLE_DATA OFF) set(HAS_STD_FILESYSTEM 1) set(ENABLE_TOOLS OFF) add_subdirectory(libime) # suppress configure error install(TARGETS kenlm EXPORT LibIMECoreTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib) + + option(ENABLE_GUI OFF) + option(ENABLE_CLOUDPINYIN OFF) add_subdirectory(fcitx5-chinese-addons) list(APPEND DEFAULT_INPUT_METHODS pinyin shuangpin wbx) endif() diff --git a/engines/fcitx5-lua b/engines/fcitx5-lua new file mode 160000 index 0000000..1d28eb3 --- /dev/null +++ b/engines/fcitx5-lua @@ -0,0 +1 @@ +Subproject commit 1d28eb32951dac0a32e76b5196455ee6385bcffe diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 17c0351..4408c95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,12 +55,18 @@ copy_to_keyboard(copy "${FCITX5_MODULE_BINARY_DIR}/spell/spell.conf" "${ADDON_PR copy_share_to_keyboard(copy fcitx5/spell/en_dict.fscd "share/fcitx5/spell/en_dict.fscd") if (CHINESE_ADDONS) + set(LUA_BINARY_DIR "${PROJECT_BINARY_DIR}/engines/fcitx5-lua") + copy_to_keyboard(copy "${LUA_BINARY_DIR}/src/addonloader/luaaddonloader.conf" "${ADDON_PREFIX}/luaaddonloader.conf") + copy_to_keyboard(copy "${LUA_BINARY_DIR}/src/imeapi/imeapi.conf" "${ADDON_PREFIX}/imeapi.conf") + copy_to_keyboard(copy "${PROJECT_SOURCE_DIR}/engines/fcitx5-lua/src/imeapi/imeapi.lua" "share/fcitx5/lua/imeapi/imeapi.lua") + set(CHINESE_ADDONS_BINARY_DIR "${PROJECT_BINARY_DIR}/engines/fcitx5-chinese-addons") - # Pinyin addon and im + # Pinyin addon, im and lua copy_to_keyboard(copy "${CHINESE_ADDONS_BINARY_DIR}/im/pinyin/pinyin-addon.conf" "${ADDON_PREFIX}/pinyin.conf") copy_to_keyboard(copy "${CHINESE_ADDONS_BINARY_DIR}/im/pinyin/pinyin.conf" "${IM_PREFIX}/pinyin.conf") copy_to_keyboard(copy "${CHINESE_ADDONS_BINARY_DIR}/im/pinyin/shuangpin.conf" "${IM_PREFIX}/shuangpin.conf") + copy_to_keyboard(copy "${PROJECT_SOURCE_DIR}/engines/fcitx5-chinese-addons/im/pinyin/pinyin.lua" "share/fcitx5/lua/imeapi/extensions/pinyin.lua") # Table addon, im and dict copy_to_keyboard(copy "${CHINESE_ADDONS_BINARY_DIR}/im/table/table.conf" "share/fcitx5/addon/table.conf")