diff --git a/CQtDeployer/deploy.cpp b/CQtDeployer/deploy.cpp index 59bfe46..6021446 100644 --- a/CQtDeployer/deploy.cpp +++ b/CQtDeployer/deploy.cpp @@ -179,6 +179,16 @@ void Deploy::setExtraPath(const QStringList &value) { } } +void Deploy::setExtraPlugins(const QStringList &value) { + for(auto i: value) { + if (QFile::exists(i)) { + extraPlugins.append(i); + } else { + qWarning() << i << " does not exist! and skiped"; + } + } +} + bool Deploy::isQtLib(const QString &lib) const { QFileInfo info(lib); return info.absolutePath().contains(qtDir); @@ -287,7 +297,8 @@ void Deploy::extract(const QString &file, bool isExtractPlugins) { continue; } - if (QuasarAppUtils::isEndable("deploy-not-qt") && + if ((QuasarAppUtils::isEndable("deploy-not-qt") || + onlyCLibs) && !noQTLibs.contains(line)) { noQTLibs << line; extract(line, isExtractPlugins); @@ -378,6 +389,20 @@ void Deploy::copyPlugins(const QStringList &list) { qWarning () << plugin << " not copied!"; } } + QFileInfo info; + + for (auto extraPlugin : extraPlugins) { + + info.setFile(extraPlugin); + if (info.isDir()) { + QDir from(info.absoluteDir()); + QDir to(targetDir + QDir::separator() + "plugins"); + copyFolder(from, to, ".so.debug"); + } else { + copyFile(info.absoluteFilePath(), targetDir + QDir::separator() + "plugins"); + extract(info.absoluteFilePath()); + } + } } bool Deploy::copyFolder( QDir &from, QDir &to, const QString& filter, diff --git a/CQtDeployer/deploy.h b/CQtDeployer/deploy.h index e9062b4..15e6348 100644 --- a/CQtDeployer/deploy.h +++ b/CQtDeployer/deploy.h @@ -29,7 +29,7 @@ private: QStringList neededPlugins; QStringList ignoreList; QStringList extraPath; - + QStringList extraPlugins; bool isQtLib(const QString& lib) const; @@ -75,6 +75,7 @@ public: bool initDirs(); void setOnlyCLibs(bool value); void setExtraPath(const QStringList &value); + void setExtraPlugins(const QStringList &value); }; #endif // DEPLOY_H diff --git a/CQtDeployer/main.cpp b/CQtDeployer/main.cpp index 309c569..8a7c463 100644 --- a/CQtDeployer/main.cpp +++ b/CQtDeployer/main.cpp @@ -34,11 +34,13 @@ void help() { qInfo() << " | (not recommended, as it takes up a lot of memory)"; qInfo() << " -libDir [list,params] : set additional path for extralib of app."; qInfo() << " | for example -libDir ~/myLib,~/newLibs"; - + qInfo() << " -extraPlugin[list,params]: set additional path for extraPlugin of app"; qInfo() << ""; qInfo() << "Example: CDQ -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear"; + qInfo() << "Example (only C libs): CDQ -bin myApp clear"; + } bool parseQt(Deploy& deploy) { @@ -55,9 +57,15 @@ bool parseQt(Deploy& deploy) { return false; } - auto list = QuasarAppUtils::getStrArg("libDir").split(","); + if (QuasarAppUtils::isEndable("clear")) { + qInfo() << "clear old data"; + deploy.clear(); + } - deploy.setExtraPath(list); + auto listLibDir = QuasarAppUtils::getStrArg("libDir").split(","); + auto listExtraPlugin = QuasarAppUtils::getStrArg("extraPlugin").split(","); + deploy.setExtraPath(listLibDir); + deploy.setExtraPlugins(listExtraPlugin); if (!deploy.initDirs()) { qCritical() << "error init targeet dir"; @@ -77,11 +85,6 @@ bool parseQt(Deploy& deploy) { deploy.setQmake(qmake); auto scaner = basePath + QDir::separator() + "qmlimportscanner"; - if (QuasarAppUtils::isEndable("clear")) { - qInfo() << "clear old data"; - deploy.clear(); - } - auto qmlDir = QuasarAppUtils::getStrArg("qmlDir"); QDir dir(basePath); diff --git a/README.md b/README.md index 8c163f3..482cebf 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Key differences of this program: | | (not recommended, as it takes up a lot of memory) | | -libDir [list,params] | set additional path for extralib of app | | | for example -libDir ~/myLib,~/newLibs | +| -extraPlugin [list,params] | set additional path for extraPlugin of app | @@ -89,6 +90,7 @@ Console QtDeployer является консольной реализацией | | (не рекомендуется, так как занимает много памяти) | | -libDir [list,params] | установит дополнительные пути к библиотекам | | | пример -libDir ~/myLib,~/newLibs | +| -extraPlugin [list,params] | установить дополнительный путь для extraPlugin приложения | #### Пример: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear