Skip to content

Commit

Permalink
Allow installation of extra platform plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
asl committed Jul 21, 2022
1 parent dc2e5b7 commit 0038984
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Just like all linuxdeploy plugins, the Qt plugin's behavior can be configured so
**Qt specific:**
- `$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`)
- `$EXTRA_QT_PLUGINS=pluginA;pluginB`: Plugins to deploy even if not found automatically by linuxdeploy-plugin-qt
- `$EXTRA_PLATFORM_PLUGINS=platformA;platformB`: Platforms to deploy in addition to `libqxcb.so`. Platform must be available from `QT_INSTALL_PLUGINS/platforms`.

QML related:
- `$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.
Expand Down
11 changes: 11 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,15 @@ pushd linuxdeploy-plugin-qt-examples/QtWidgetsApplication
"$linuxdeploy_bin" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
mv -v *AppImage "$build_dir" || exit 1
popd

mkdir build-platforms
pushd build-platforms
export EXTRA_PLATFORM_PLUGINS="libqoffscreen.so;libqminimal.so"
qmake CONFIG+=release PREFIX=/usr ../QtWidgetsApplication.pro || exit 1
INSTALL_ROOT="$PWD"/AppDir make install || exit 1

"$LINUXDEPLOY_BIN" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1
APPIMAGE=(*AppImage)
mv -v "${APPIMAGE[0]}" "$BUILD_DIR/offscreen-${APPIMAGE[0]}" || exit 1
popd
popd
11 changes: 11 additions & 0 deletions src/deployers/PlatformPluginsDeployer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// library headers
#include <linuxdeploy/core/log.h>
#include <linuxdeploy/util/util.h>
#include <boost/filesystem.hpp>

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

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

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

// deploy extra platform plugins, if any
if (const auto* const platformPluginsFromEnvData = getenv("EXTRA_PLATFORM_PLUGINS")) {
for (const auto& platformToDeploy : linuxdeploy::util::split(std::string(platformPluginsFromEnvData), ';')) {
ldLog() << "Deploying extra platform plugin: " << platformToDeploy << std::endl;
if (!appDir.deployLibrary(qtPluginsPath / "platforms" / platformToDeploy, appDir.path() / "usr/plugins/platforms/"))
return false;
}
}

for (bf::directory_iterator i(qtPluginsPath / "platforminputcontexts"); i != bf::directory_iterator(); ++i) {
if (!appDir.deployLibrary(*i, appDir.path() / "usr/plugins/platforminputcontexts/"))
return false;
Expand Down

0 comments on commit 0038984

Please sign in to comment.