Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename EXTRA_QT_PLUGINS to EXTRA_QT_MODULES #174

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ 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
- example: `EXTRA_QT_PLUGINS=svg;` if you want to use the module [QtSvg](https://doc.qt.io/qt-5/qtsvg-index.html)
- `$EXTRA_QT_MODULES=moduleA;moduleB`: Modules to deploy even if not found automatically by linuxdeploy-plugin-qt
- example: `EXTRA_QT_MODULES=svg;` if you want to use the module [QtSvg](https://doc.qt.io/qt-5/qtsvg-index.html)
- `$EXTRA_PLATFORM_PLUGINS=platformA;platformB`: Platforms to deploy in addition to `libqxcb.so`. Platform must be available from `QT_INSTALL_PLUGINS/platforms`.

QML related:
Expand Down
31 changes: 20 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ int main(const int argc, const char *const *const argv) {
args::HelpFlag help(parser, "help", "Display this help text", {'h', "help"});

args::ValueFlag<fs::path> appDirPath(parser, "appdir path", "Path to an existing AppDir", {"appdir"});
args::ValueFlagList<std::string> extraPlugins(parser, "plugin",
"Extra Qt plugin to deploy (specified by name, filename or path)",
{'p', "extra-plugin"});
args::ValueFlagList<std::string> extraModules(parser, "module",
"Extra Qt module to deploy (specified by name, filename or path)",
{'m', "extra-module"});
dantti marked this conversation as resolved.
Show resolved Hide resolved

args::Flag pluginType(parser, "", "Print plugin type and exit", {"plugin-type"});
args::Flag pluginApiVersion(parser, "", "Print plugin API version and exit", {"plugin-api-version"});
Expand Down Expand Up @@ -199,18 +199,27 @@ int main(const int argc, const char *const *const argv) {
}) != libraryNames.end();
});

std::vector<std::string> extraPluginsFromEnv;
const auto* const extraPluginsFromEnvData = getenv("EXTRA_QT_PLUGINS");
if (extraPluginsFromEnvData != nullptr)
extraPluginsFromEnv = linuxdeploy::util::split(std::string(extraPluginsFromEnvData), ';');
std::vector<std::string> extraModulesFromEnv;
const auto* const extraModulesFromEnvData = []() -> char* {
auto* ret = getenv("EXTRA_QT_MODULES");
if (ret == nullptr) {
ret = getenv("EXTRA_QT_PLUGINS");
if (ret) {
ldLog() << std::endl << LD_WARNING << "Using deprecated EXTRA_QT_PLUGINS env var" << std::endl;
}
}
return ret;
}();
if (extraModulesFromEnvData != nullptr)
extraModulesFromEnv = linuxdeploy::util::split(std::string(extraModulesFromEnvData), ';');

for (const auto& pluginsList : {static_cast<std::vector<std::string>>(extraPlugins.Get()), extraPluginsFromEnv}) {
for (const auto& modulesList : {static_cast<std::vector<std::string>>(extraModules.Get()), extraModulesFromEnv}) {
std::copy_if(qtModules.begin(), qtModules.end(), std::back_inserter(extraQtModules),
[&matchesQtModule, &libraryNames, &pluginsList](const QtModule &module) {
return std::find_if(pluginsList.begin(), pluginsList.end(),
[&matchesQtModule, &libraryNames, &modulesList](const QtModule &module) {
return std::find_if(modulesList.begin(), modulesList.end(),
[&matchesQtModule, &module](const std::string &libraryName) {
return matchesQtModule(libraryName, module);
}) != pluginsList.end();
}) != modulesList.end();
}
);
}
Expand Down