Deploying 3rdparty Qt Quick plugins on macOS
-
Hello,
I am trying to build a macOS application which uses KDE's Kirigami framework for its UI. On Linux I am able to install Kirigami to a standard location so that Qt could automatically locate it. On macOS I use macdeployqt, but it only copies Qt's own Qt Quick libs (e.g. QQC2), so I have to script cp/ln/install_name_tool.
Is it possible to make macdeployqt add Kirigami automatically? Or, alternatively, can I use CMake or some macOS tools to do the job?
-
Starting from Qt 5.13, there will be a
-qmlimport
macdeployqt option to specify additional QML module search directories. -
Hi @Ilya-Bizyaev,
Provided that your QML imports it and you have your QML2_IMPORT_PATH environment variable set to include the location of the import then macdeployqt should take care of this for you and pick it up as a result. This way macdeployqt can see that it requires it and will deploy it with the other plugins.
-
Thank you for your reply!
Unfortunately, macdeployqt does not seem to take QML2_IMPORT_PATH into account. I managed to make it find Kirigami by symlinking from inside Qt's qml folder to the library's location, but it feels hacky.
-
Hi,
There's the
-qmldir
option ofmacdeployqt
that you can use but AFAIK, it only takes one path currently. -
Thanks for the reply :)
According to the macdeployqt manual:
-qmldir=<path> : Scan for QML imports in the given path.
This argument is used to specify the application's qml source directory to be scanned for
import *
statements. It can accept multiple paths, but these are not used as library search paths.To specify a library search path, macdeployqt would need to pass it as an
-importPath
argument to qmlimportscanner, but it only passes Qt's default library location: http://code.qt.io/cgit/qt/qttools.git/tree/src/macdeployqt/shared/shared.cpp#n1236As a hack one can create a link to the custom location from inside the Qt installation, and that's what I use for now, but I think there has to be a better way.
-
A feature to add to
macdeployqt
: an option to give additional import paths. -
Should I open a feature request?
-
If you don't find any yet, yes. If you can provide a minimal buildable sample application that shows that behaviour it would be great.
Out of curiosity, how did you got Kirigami for macOS ?
-
@SGaist I reported the issue as https://bugreports.qt.io/browse/QTBUG-70977 and opened a revision at https://codereview.qt-project.org/#/c/242083/
-
Kirigami works just right on macOS, here are some screenshots:
The app is on its early stages, though.
-
Thanks for the submission !
One small fix to the commit message to do :)
-
Starting from Qt 5.13, there will be a
-qmlimport
macdeployqt option to specify additional QML module search directories. -
If needed earlier,
macdeployqt
can be manually built from the dev branch.