Skip to content

Commit f375bfa

Browse files
Conan-KudoTingPing
authored andcommitted
Introduce libportal-qt6
Introduce a new libportal-qt6 library with Qt6-specific parent window exports. It contains a blank header with a single function declaration (xdp_parent_new_qt), and explicitly depends on Qt6. This is based on the existing code for libportal-qt5. Related: #12
1 parent 099abb7 commit f375bfa

20 files changed

+864
-6
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ jobs:
5858
steps:
5959
- name: Install dependencies
6060
run: |
61-
dnf install -y meson gcc gobject-introspection-devel gtk3-devel gtk4-devel gi-docgen vala git python3-pytest python3-dbusmock
61+
dnf install -y meson gcc gobject-introspection-devel gtk3-devel gtk4-devel gi-docgen vala git python3-pytest python3-dbusmock qt5-qtbase-devel qt5-qtx11extras-devel qt6-qtbase-devel
6262
- name: Check out libportal
6363
uses: actions/checkout@v3
6464
- name: Configure libportal
65-
run: meson setup --prefix=/usr _build -Dbackend-gtk3=enabled -Dbackend-gtk4=enabled
65+
run: meson setup --prefix=/usr _build -Dbackend-gtk3=enabled -Dbackend-gtk4=enabled -Dbackend-qt5=enabled -Dbackend-qt6=enabled
6666
- name: Build libportal
6767
run: ninja -C_build
6868
- name: Deploy Docs
@@ -84,7 +84,7 @@ jobs:
8484
steps:
8585
- name: Install dependencies
8686
run: |
87-
dnf install -y meson gcc gobject-introspection-devel gtk3-devel gtk4-devel qt5-qtbase-devel qt5-qtx11extras-devel git libabigail
87+
dnf install -y meson gcc gobject-introspection-devel gtk3-devel gtk4-devel qt5-qtbase-devel qt5-qtx11extras-devel qt6-qtbase-devel git libabigail
8888
- name: Install check-abi
8989
run: |
9090
curl https://gitlab.freedesktop.org/hadess/check-abi/-/raw/main/contrib/check-abi-fedora.sh | bash

.github/workflows/flatpak.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,20 @@ jobs:
6161
bundle: portal-test-qt5.flatpak
6262
manifest-path: build-aux/org.gnome.PortalTest.Qt5.json
6363
cache-key: qt5-${{ github.sha }}
64+
65+
build-flatpak-qt6:
66+
name: Qt6
67+
runs-on: ubuntu-latest
68+
container:
69+
image: bilelmoussaoui/flatpak-github-actions:kde-6.5
70+
options: --privileged
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v3
74+
75+
- name: Build Qt6 portal test
76+
uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v6
77+
with:
78+
bundle: portal-test-qt6.flatpak
79+
manifest-path: build-aux/org.gnome.PortalTest.Qt6.json
80+
cache-key: qt6-${{ github.sha }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ninja -C _build
6262
### `portal-tests`
6363

6464
To generate test binaries, set the `portal-tests` option to any combination of
65-
`gtk3`, `gtk4`, or `qt5` e.g. `-Dportal-tests=gtk3,gtk4,qt5`. Then run the desired
65+
`gtk3`, `gtk4`, `qt5`, or `qt6` e.g. `-Dportal-tests=gtk3,gtk4,qt5,qt6`. Then run the desired
6666
test binary, e.g.:
6767

6868
```

build-aux/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ OLD_DIR=`pwd`
77

88
cd "$TOP_DIR"
99

10-
for backend in Gtk3 Gtk4 Qt5; do
10+
for backend in Gtk3 Gtk4 Qt5 Qt6; do
1111
flatpak-builder --force-clean --ccache --repo=_build/repo --install --user "_build/app-$backend" "build-aux/org.gnome.PortalTest.${backend}.json"
1212
done
1313

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"app-id": "org.gnome.PortalTest.Qt6",
3+
"runtime": "org.kde.Platform",
4+
"runtime-version": "6.5",
5+
"sdk": "org.kde.Sdk",
6+
"command": "portal-test-qt6",
7+
"finish-args": [
8+
"--socket=wayland",
9+
"--socket=x11",
10+
"--socket=pulseaudio"
11+
],
12+
"modules": [
13+
{
14+
"name": "portal-test-qt6",
15+
"buildsystem": "meson",
16+
"builddir": true,
17+
"config-opts": [
18+
"-Dbackend-qt6=enabled",
19+
"-Dportal-tests=true",
20+
"-Dintrospection=false",
21+
"-Dvapi=false",
22+
"-Ddocs=false"
23+
],
24+
"sources": [
25+
{
26+
"type": "dir",
27+
"path": "../"
28+
}
29+
]
30+
}
31+
]
32+
}

libportal/meson.build

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,44 @@ if have_cpp and qt5_dep.found()
264264
enabled_backends += ['qt5']
265265
endif
266266

267+
########
268+
# Qt 6 #
269+
########
270+
271+
if meson.version().version_compare('>= 0.59.0')
272+
have_cpp = add_languages('cpp', required: get_option('backend-qt6'))
273+
qt6_dep = dependency('qt6', modules: ['Core', 'Gui', 'Widgets'], required: get_option('backend-qt6'))
274+
275+
if have_cpp and qt6_dep.found()
276+
qt6_headers = ['portal-qt6.h']
277+
qt6_sources = ['portal-qt6.cpp']
278+
279+
install_headers(qt6_headers, subdir: 'libportal-qt6')
280+
281+
libportal_qt6 = library('portal-qt6',
282+
qt6_sources,
283+
version: version,
284+
include_directories: [top_inc, libportal_inc],
285+
cpp_args : '-std=c++17',
286+
install: true,
287+
dependencies: [libportal_dep, qt6_dep],
288+
gnu_symbol_visibility: 'hidden',
289+
)
290+
291+
pkgconfig.generate(libportal_qt6,
292+
description: 'Portal API wrappers (Qt 6)',
293+
name: 'libportal-qt6',
294+
requires: [qt6_dep, libportal],
295+
)
296+
297+
libportal_qt6_dep = declare_dependency(
298+
dependencies: [libportal_dep, qt6_dep],
299+
link_with: libportal_qt6,
300+
)
301+
enabled_backends += ['qt6']
302+
endif
303+
endif
304+
267305
if meson.version().version_compare('>= 0.54.0')
268306
summary({'enabled backends': enabled_backends}, section: 'Backends', list_sep: ',')
269307
endif

0 commit comments

Comments
 (0)