diff --git a/README.md b/README.md index 5b6965e..252e932 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/ci/test.sh b/ci/test.sh index 331e0c3..3d31828 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -87,4 +87,14 @@ 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 + + env OUTPUT=platforms.AppImage "$linuxdeploy_bin" --appdir "$PWD"/AppDir --plugin qt --output appimage || exit 1 + mv -v platforms.AppImage "$build_dir" || exit 1 + popd popd diff --git a/src/deployers/PlatformPluginsDeployer.cpp b/src/deployers/PlatformPluginsDeployer.cpp index 7011abe..61c7a17 100644 --- a/src/deployers/PlatformPluginsDeployer.cpp +++ b/src/deployers/PlatformPluginsDeployer.cpp @@ -1,5 +1,6 @@ // library headers #include +#include #include // local headers @@ -17,9 +18,20 @@ 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 + const auto* const platformPluginsFromEnvData = getenv("EXTRA_PLATFORM_PLUGINS"); + if (platformPluginsFromEnvData != nullptr) { + 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;