From db5fadaeb74646be3d9e81fd0e19a7b3e85b402b Mon Sep 17 00:00:00 2001 From: mappu Date: Tue, 26 Nov 2024 22:31:23 +1300 Subject: [PATCH] webkit: add genbindings support --- cmd/genbindings/config-allowlist.go | 18 ++++++++++++++++++ cmd/genbindings/config-libraries.go | 15 +++++++++++++++ docker/genbindings.Dockerfile | 1 + 3 files changed, 34 insertions(+) diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index 8104cfaf..c11069f4 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -34,6 +34,14 @@ func InsertTypedefs(qt6 bool) { KnownTypedefs["QFileDevice::Permissions"] = lookupResultTypedef{pp, CppTypedef{"QFile::Permissions", parseSingleTypeString("QFlags")}} KnownTypedefs["QIODevice::OpenMode"] = lookupResultTypedef{pp, CppTypedef{"QIODevice::OpenMode", parseSingleTypeString("QIODeviceBase::OpenMode")}} + // Qt 5 WebKit - use of an empty enum (should be possible to support?) + KnownEnums["QWebPluginFactory::Extension"] = lookupResultEnum{"qt/webkit", CppEnum{ + EnumName: "QWebPluginFactory::Extension", + UnderlyingType: CppParameter{ + ParameterType: "int", + }, + }} + if qt6 { // Qt 6 QVariant helper types - needs investigation KnownTypedefs["QVariantHash"] = lookupResultTypedef{"qt6", CppTypedef{"QVariantHash", parseSingleTypeString("QHash")}} @@ -231,6 +239,14 @@ func AllowVirtualForClass(className string) bool { return false } + // Qt 5 QWebkit: undefined reference to typeinfo + if className == "QWebNotificationPresenter" { + return false + } + if className == "QWebHapticFeedbackPlayer" { + return false + } + return true } @@ -492,6 +508,8 @@ func AllowType(p CppParameter, isReturnType bool) error { "QPostEventList", // Qt QCoreApplication: private headers required "QMetaCallEvent", // .. "QPostEvent", // .. + "QWebFrameAdapter", // Qt 5 Webkit: Used by e.g. qwebframe.h but never defined anywhere + "QWebPageAdapter", // ... "____last____": return ErrTooComplex } diff --git a/cmd/genbindings/config-libraries.go b/cmd/genbindings/config-libraries.go index 1b579663..4ea894b5 100644 --- a/cmd/genbindings/config-libraries.go +++ b/cmd/genbindings/config-libraries.go @@ -114,6 +114,21 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) { ClangMatchSameHeaderDefinitionOnly, ) + // Qt 5 QWebkit: depends on Qt5PrintSupport but only at runtime, not at + // codegen time + generate( + "qt/webkit", + []string{ + "/usr/include/x86_64-linux-gnu/qt5/QtWebKit", + "/usr/include/x86_64-linux-gnu/qt5/QtWebKitWidgets", + }, + AllowAllHeaders, + clangBin, + pkgConfigCflags("Qt5WebKitWidgets"), + outDir, + ClangMatchSameHeaderDefinitionOnly, + ) + // Depends on QtCore/Gui/Widgets, QPrintSupport generate( "qt-restricted-extras/qscintilla", diff --git a/docker/genbindings.Dockerfile b/docker/genbindings.Dockerfile index 6ef89cfc..116caa4f 100644 --- a/docker/genbindings.Dockerfile +++ b/docker/genbindings.Dockerfile @@ -7,6 +7,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ qtmultimedia5-dev \ qtscript5-dev \ libqt5svg5-dev \ + libqt5webkit5-dev \ qt6-base-dev \ qt6-multimedia-dev \ qt6-svg-dev \