Skip to content

Commit 0038984

Browse files
committed
Allow installation of extra platform plugins
Resolves linuxdeploy#88
1 parent dc2e5b7 commit 0038984

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Just like all linuxdeploy plugins, the Qt plugin's behavior can be configured so
5757
**Qt specific:**
5858
- `$QMAKE=/path/to/my/qmake`: use another `qmake` binary to detect paths of plugins and other resources (usually doesn't need to be set manually, most Qt environments ship scripts changing `$PATH`)
5959
- `$EXTRA_QT_PLUGINS=pluginA;pluginB`: Plugins to deploy even if not found automatically by linuxdeploy-plugin-qt
60+
- `$EXTRA_PLATFORM_PLUGINS=platformA;platformB`: Platforms to deploy in addition to `libqxcb.so`. Platform must be available from `QT_INSTALL_PLUGINS/platforms`.
6061

6162
QML related:
6263
- `$QML_SOURCES_PATHS`: directory containing the application's QML files — useful/needed if QML files are "baked" into the binaries. `$QT_INSTALL_QML` is prepended to this list internally.

Diff for: ci/test.sh

+11
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,15 @@ pushd linuxdeploy-plugin-qt-examples/QtWidgetsApplication
8787
"$linuxdeploy_bin" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
8888
mv -v *AppImage "$build_dir" || exit 1
8989
popd
90+
91+
mkdir build-platforms
92+
pushd build-platforms
93+
export EXTRA_PLATFORM_PLUGINS="libqoffscreen.so;libqminimal.so"
94+
qmake CONFIG+=release PREFIX=/usr ../QtWidgetsApplication.pro || exit 1
95+
INSTALL_ROOT="$PWD"/AppDir make install || exit 1
96+
97+
"$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
98+
APPIMAGE=(*AppImage)
99+
mv -v "${APPIMAGE[0]}" "$BUILD_DIR/offscreen-${APPIMAGE[0]}" || exit 1
100+
popd
90101
popd

Diff for: src/deployers/PlatformPluginsDeployer.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// library headers
22
#include <linuxdeploy/core/log.h>
3+
#include <linuxdeploy/util/util.h>
34
#include <boost/filesystem.hpp>
45

56
// local headers
@@ -17,9 +18,19 @@ bool PlatformPluginsDeployer::deploy() {
1718

1819
ldLog() << "Deploying platform plugins" << std::endl;
1920

21+
// always deploy default platform
2022
if (!appDir.deployLibrary(qtPluginsPath / "platforms/libqxcb.so", appDir.path() / "usr/plugins/platforms/"))
2123
return false;
2224

25+
// deploy extra platform plugins, if any
26+
if (const auto* const platformPluginsFromEnvData = getenv("EXTRA_PLATFORM_PLUGINS")) {
27+
for (const auto& platformToDeploy : linuxdeploy::util::split(std::string(platformPluginsFromEnvData), ';')) {
28+
ldLog() << "Deploying extra platform plugin: " << platformToDeploy << std::endl;
29+
if (!appDir.deployLibrary(qtPluginsPath / "platforms" / platformToDeploy, appDir.path() / "usr/plugins/platforms/"))
30+
return false;
31+
}
32+
}
33+
2334
for (bf::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != bf::directory_iterator(); ++i) {
2435
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/platforminputcontexts/"))
2536
return false;

0 commit comments

Comments
 (0)