Skip to content

Commit

Permalink
Merge pull request #172 from chewing/modernize-2
Browse files Browse the repository at this point in the history
Update to GTK4 and drop X11 dependency
  • Loading branch information
kanru authored Feb 6, 2024
2 parents 1de53bf + 712697a commit 50d4abb
Show file tree
Hide file tree
Showing 59 changed files with 1,608 additions and 5,104 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: LLVM
IndentWidth: 4
29 changes: 22 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: fedora:latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install build dependencies
run: sudo apt install -y libgtk-3-dev libibus-1.0-dev libx11-dev libchewing3-dev ibus gettext xvfb
run: sudo dnf -y install clang cmake gtk4-devel ibus-devel libadwaita-devel libchewing-devel ibus gettext weston

- name: Build
run: |
Expand All @@ -25,21 +26,29 @@ jobs:
cmake --build --preset default -t install --verbose
- name: Test
env:
XDG_RUNTIME_DIR: /tmp
GSETTINGS_BACKEND: keyfile
run: |
xvfb-run -a ctest --test-dir out/build/default --output-on-failure --verbose
glib-compile-schemas src/setup --targetdir=out/build/default/bin
weston --no-config --socket=wl-headless --backend=headless &
WAYLAND_DISPLAY=wl-headless cmake --build --preset default -t test --verbose
coverage:
runs-on: ubuntu-latest
container: fedora:latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install build dependencies
run: sudo apt install -y libgtk-3-dev libibus-1.0-dev libx11-dev libchewing3-dev ibus gettext xvfb
run: sudo dnf -y install clang cmake gtk4-devel ibus-devel libadwaita-devel libchewing-devel ibus gettext weston

- name: Install llvm
run: |
sudo apt install -y llvm
sudo dnf -y install llvm rustup bzip2 git
rustup-init -y
source "$HOME/.cargo/env"
rustup component add llvm-tools
- name: Setup grcov
Expand All @@ -54,8 +63,14 @@ jobs:
cmake --build --preset c99-coverage --verbose
- name: Test
env:
XDG_RUNTIME_DIR: /tmp
GSETTINGS_BACKEND: keyfile
run: |
xvfb-run -a ctest --test-dir out/build/c99-coverage --output-on-failure --verbose
source "$HOME/.cargo/env"
glib-compile-schemas src/setup --targetdir=out/build/c99-coverage/bin
weston --no-config --socket=wl-headless --backend=headless &
WAYLAND_DISPLAY=wl-headless cmake --build --preset c99-coverage -t test --verbose
./grcov . -s . -b . --keep-only 'src/*' --llvm -t lcov -o coverage.lcov
- name: Upload coverage reports to Codecov
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*.o
*.old
*.orig
*.pot
*.rej
*.rpm
*.so
Expand Down
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ enable_testing()
include(GNUInstallDirs)

option(GNOME_SHELL "Enable GNOME Shell support" ON)
option(GCONF2_SUPPORT "Enable GConf2 support" OFF)
option(GSETTINGS_SUPPORT "Enable GSettings support" ON)

find_package(PkgConfig REQUIRED)
pkg_check_modules(IBUS REQUIRED IMPORTED_TARGET ibus-1.0>=1.3)
Expand All @@ -49,17 +47,13 @@ add_compile_definitions(
)

pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GTK3 REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11)
pkg_check_modules(GTK4 REQUIRED IMPORTED_TARGET gtk4)
pkg_check_modules(LIBADWAITA REQUIRED IMPORTED_TARGET libadwaita-1)

find_program(GLIB_COMPILE_RESOURCES NAMES glib-compile-resources REQUIRED)

set(CMAKE_C_STANDARD 99)
add_compile_definitions(_XOPEN_SOURCE)
if(GSETTINGS_SUPPORT)
add_compile_definitions(USE_GSETTINGS)
endif()
if(GCONF2_SUPPORT)
add_compile_definitions(USE_GCONF2)
endif()

# Directory that store ibus-chewing icons
add_compile_definitions(PRJ_ICON_DIR="${CMAKE_INSTALL_DATADIR}/ibus-chewing/icons")
Expand All @@ -72,8 +66,6 @@ add_compile_definitions(
PROJECT_SCHEMA_BASE=/desktop/ibus/engine
PROJECT_SCHEMA_SECTION=chewing
PROJECT_SCHEMA_DIR=/desktop/ibus/engine/chewing
PROJECT_GCONF2_SCHEMA_SECTION=Chewing
PROJECT_GCONF2_SCHEMA_DIR=/desktop/ibus/engine/Chewing
PROJECT_SCHEMA_PATH=/desktop/ibus/engine/chewing/
)

Expand Down
3 changes: 3 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"CMAKE_CXX_COMPILER": "/usr/bin/clang++",
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_C_FLAGS": "-fprofile-instr-generate -fcoverage-mapping"
},
"environment": {
"LLVM_PROFILE_FILE": "default_%p_%m.profraw"
}
},
{
Expand Down
1 change: 0 additions & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Installation Instructions
gob >= 2.0.16
gtk >= 3
libchewing >= 0.5.1
libX11

1. Remove the old build cache:

Expand Down
237 changes: 0 additions & 237 deletions icons/ibus-chewing-chi-full.svg

This file was deleted.

Loading

0 comments on commit 50d4abb

Please sign in to comment.