Skip to content

Commit

Permalink
Add Qt6 support (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt authored May 1, 2024
1 parent ed5d955 commit 0ffae71
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_pass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
cxx: g++
build-type: Release
run-test: false
configure-options: -DFCITX_INSTALL_USE_FCITX_SYS_PATHS=ON
configure-options: -DFCITX_INSTALL_USE_FCITX_SYS_PATHS=ON -DUSE_QT6=Off
build-options: --verbose
3 changes: 2 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ jobs:
with:
path: fcitx5-cskk
cmake-option: >-
-DENABLE_QT=Off
-DENABLE_QT=On
-DUSE_QT6=On
- name: Test
run: |
ctest --test-dir fcitx5-cskk/build
Expand Down
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ message ("CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")

find_package(ECM 1.0.0 REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
option(ENABLE_QT "Enable Qt for GUI configuration" On)
option(USE_QT6 "Build against Qt6" On)
include(FeatureSummary)
include(GNUInstallDirs)
include(ECMUninstallTarget)
Expand All @@ -24,15 +26,19 @@ find_package(Fcitx5Utils 5.0.6 REQUIRED)
# GITHUB_ACTION_BUILD_CSKK_VERSION=3.0.0
pkg_check_modules(LIBCSKK REQUIRED IMPORTED_TARGET "cskk>=3.0")

option(ENABLE_QT "Enable Qt for GUI configuration" On)

include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")

# GUI related libs
if (ENABLE_QT)
if (USE_QT6)
set(QT_MAJOR_VERSION 6)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
else()
set(QT_MAJOR_VERSION 5)
find_package(Qt5 5.7 REQUIRED COMPONENTS Core Gui Widgets)
find_package(Fcitx5Qt5WidgetsAddons REQUIRED)
endif ()
endif()
find_package(Fcitx5Qt${QT_MAJOR_VERSION}WidgetsAddons REQUIRED)
endif()

# make default value header searchable
set(SKK_DICT_DEFAULT_PATH "/usr/share/skk/SKK-JISYO.L" CACHE STRING "Default path of SKK Dictionary file")
Expand Down
8 changes: 4 additions & 4 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ set_target_properties(fcitx5-cskk-config PROPERTIES
AUTOUIC_OPTIONS "-tr=fcitx::tr2fcitx;--include=fcitxqti18nhelper.h"
)
target_link_libraries(fcitx5-cskk-config
Qt5::Core
Qt5::Widgets
Fcitx5Qt5::WidgetsAddons
Qt${QT_MAJOR_VERSION}::Core
Qt${QT_MAJOR_VERSION}::Widgets
Fcitx5Qt${QT_MAJOR_VERSION}::WidgetsAddons
Fcitx5::Utils
PkgConfig::LIBCSKK
)

# Must install to same lib dir that Fcitx5Utils specify using FCITX_*DIR so that fcitx5 can find.
install(TARGETS fcitx5-cskk-config DESTINATION ${FCITX_INSTALL_LIBDIR}/fcitx5/qt5)
install(TARGETS fcitx5-cskk-config DESTINATION ${FCITX_INSTALL_LIBDIR}/fcitx5/qt${QT_MAJOR_VERSION})

0 comments on commit 0ffae71

Please sign in to comment.