webengine: add genbindings integration

This commit is contained in:
mappu 2024-11-27 18:16:40 +13:00
parent ac3bb31a71
commit 6b2935add1
3 changed files with 78 additions and 0 deletions

View File

@ -385,6 +385,12 @@ func AllowType(p CppParameter, isReturnType bool) error {
if strings.HasPrefix(p.ParameterType, "EncodedData<") { if strings.HasPrefix(p.ParameterType, "EncodedData<") {
return ErrTooComplex // e.g. Qt 6 qstringconverter.h return ErrTooComplex // e.g. Qt 6 qstringconverter.h
} }
if strings.HasPrefix(p.ParameterType, "QQmlListProperty<") {
return ErrTooComplex // e.g. Qt 5 QWebChannel qmlwebchannel.h . Supporting this will be required for QML in future
}
if strings.HasPrefix(p.ParameterType, "QWebEngineCallback<") {
return ErrTooComplex // Function pointer types in QtWebEngine
}
if strings.HasPrefix(p.ParameterType, "std::") { if strings.HasPrefix(p.ParameterType, "std::") {
// std::initializer e.g. qcborarray.h // std::initializer e.g. qcborarray.h
@ -510,6 +516,7 @@ func AllowType(p CppParameter, isReturnType bool) error {
"QPostEvent", // .. "QPostEvent", // ..
"QWebFrameAdapter", // Qt 5 Webkit: Used by e.g. qwebframe.h but never defined anywhere "QWebFrameAdapter", // Qt 5 Webkit: Used by e.g. qwebframe.h but never defined anywhere
"QWebPageAdapter", // ... "QWebPageAdapter", // ...
"QQmlWebChannelAttached", // Qt 5 qqmlwebchannel.h. Need to add QML support for this to work
"____last____": "____last____":
return ErrTooComplex return ErrTooComplex
} }

View File

@ -129,6 +129,41 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
ClangMatchSameHeaderDefinitionOnly, ClangMatchSameHeaderDefinitionOnly,
) )
// Qt 5 QWebChannel
generate(
"qt/webchannel",
[]string{
"/usr/include/x86_64-linux-gnu/qt5/QtWebChannel",
},
AllowAllHeaders,
clangBin,
pkgConfigCflags("Qt5WebChannel"),
outDir,
ClangMatchSameHeaderDefinitionOnly,
)
// Qt 5 QWebEngine
generate(
"qt/webengine",
[]string{
"/usr/include/x86_64-linux-gnu/qt5/QtWebEngine",
"/usr/include/x86_64-linux-gnu/qt5/QtWebEngineCore",
"/usr/include/x86_64-linux-gnu/qt5/QtWebEngineWidgets",
},
func(fullpath string) bool {
baseName := filepath.Base(fullpath)
if baseName == "qquickwebengineprofile.h" || baseName == "qquickwebenginescript.h" {
return false
}
return true
},
clangBin,
pkgConfigCflags("Qt5WebEngineWidgets"),
outDir,
ClangMatchSameHeaderDefinitionOnly,
)
// Depends on QtCore/Gui/Widgets, QPrintSupport // Depends on QtCore/Gui/Widgets, QPrintSupport
generate( generate(
"qt-restricted-extras/qscintilla", "qt-restricted-extras/qscintilla",
@ -269,6 +304,40 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
ClangMatchSameHeaderDefinitionOnly, ClangMatchSameHeaderDefinitionOnly,
) )
// Qt 6 QWebChannel
generate(
"qt6/webchannel",
[]string{
"/usr/include/x86_64-linux-gnu/qt6/QtWebChannel",
},
AllowAllHeaders,
clangBin,
"--std=c++17 "+pkgConfigCflags("Qt6WebChannel"),
outDir,
ClangMatchSameHeaderDefinitionOnly,
)
// Qt 6 QWebEngine
generate(
"qt6/webengine",
[]string{
"/usr/include/x86_64-linux-gnu/qt6/QtWebEngineCore",
"/usr/include/x86_64-linux-gnu/qt6/QtWebEngineWidgets",
},
func(fullpath string) bool {
baseName := filepath.Base(fullpath)
if baseName == "qtwebenginewidgets-config.h" {
return false
}
return true
},
clangBin,
"--std=c++17 "+pkgConfigCflags("Qt6WebEngineWidgets"),
outDir,
ClangMatchSameHeaderDefinitionOnly,
)
// Qt 6 QScintilla
// Depends on QtCore/Gui/Widgets, QPrintSupport // Depends on QtCore/Gui/Widgets, QPrintSupport
generate( generate(
"qt-restricted-extras/qscintilla6", "qt-restricted-extras/qscintilla6",

View File

@ -8,9 +8,11 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
qtscript5-dev \ qtscript5-dev \
libqt5svg5-dev \ libqt5svg5-dev \
libqt5webkit5-dev \ libqt5webkit5-dev \
qtwebengine5-dev \
qt6-base-dev \ qt6-base-dev \
qt6-multimedia-dev \ qt6-multimedia-dev \
qt6-svg-dev \ qt6-svg-dev \
qt6-webengine-dev \
libqscintilla2-qt5-dev \ libqscintilla2-qt5-dev \
libqscintilla2-qt6-dev \ libqscintilla2-qt6-dev \
clang \ clang \