QtStaticCMake
QtStaticCMake copied to clipboard
QWebView handling
Hello,
When using QWebView
through deployment (using QtIosCmake
), I had to manually add:
-
Q_IMPORT_PLUGIN(QWebViewModule)
-
Q_INIT_RESOURCE(qmake_QtWebView)
This has been found as follows:
λ nm ./qml/QtWebView/libdeclarative_webview.a | c++filt | grep -i static
---------------- T qt_static_plugin_QWebViewModule()
...
λ nm ./qml/QtWebView/libdeclarative_webview.a | c++filt | grep -i init
...
---------------- T qInitResources_qmake_QtWebView()
...
libdeclarative_webview.a
is correctly scanned, but these corresponding macros are missing from either qt_generate_qml_plugin_import
or qt_generate_plugin_import
.
Adding these macros results in successful device and simulator build and deployment.
With a little guidance I'll be glad provide a merge request.
Finally, big ups for this very very impressive, helpful and functional set of cmake macros.
So qt_generate_plugin_import rely on what is inside the lib/cmake
folder of Qt root.
https://github.com/OlivierLDff/QtStaticCMake/blob/5b4bb893934bd5cdeb39a52a46b4c05536603f95/QtStaticCMake.cmake#L354-L357
Then in each of those folder there are files for plugins, Qt5<Module>_<Plugin>Plugin
.
For example Module
can be Gui
, and Plugin
can be QGif
.
The function extract <Plugin>
from file name to write it into the Q_IMPORT_PLUGIN
.
I'm checking on windows, so what is see might not apply for ios, but in lib/cmake/Qt5WebView
i only have one file: Qt5WebView_QWebEngineWebViewPlugin.cmake
.
Can you check you have a file Qt5WebView_QWebViewModulePlugin.cmake
on mac. If not, or if file is formatted differently, we need to add specific code for the WebView
.
I would say something is required around here: https://github.com/OlivierLDff/QtStaticCMake/blob/5b4bb893934bd5cdeb39a52a46b4c05536603f95/QtStaticCMake.cmake#L365-L371
And for Q_INIT_RESOURCE(qmake_QtWebView)
, i don't know how to do something cleany. I think this should go in the readme. From the name, you can tell that qmake in generating some extra code for it.
I would maybe generate something like that :
class cmake_QtWebViewForceImport
{
cmake_QtWebViewForceImport()
{
Q_INIT_RESOURCE(qmake_QtWebView)
}
static cmake_QtWebViewForceImportsingleton;
};
cmake_QtWebViewForceImport cmake_QtWebViewForceImport::singleton;