done поиск библиотек #16

This commit is contained in:
a.yankovich 2018-09-18 16:36:05 +03:00
parent 4022c7262f
commit 662aafeb01
4 changed files with 37 additions and 1 deletions

View File

@ -168,6 +168,17 @@ void Deploy::setOnlyCLibs(bool value) {
onlyCLibs = value;
}
void Deploy::setExtraPath(const QStringList &value) {
for(auto i: value) {
if (QFile::exists(i)) {
extraPath.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);
@ -219,12 +230,21 @@ void Deploy::extract(const QString &file, bool isExtractPlugins) {
qInfo() << "extract lib :" << file;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("LD_LIBRARY_PATH", qtDir + "/lib:" + targetDir);
QString ld_path = qtDir + "/lib:" + targetDir;
for (auto i: extraPath) {
ld_path.push_back(":" + i);
}
env.insert("LD_LIBRARY_PATH", ld_path);
env.insert("QML_IMPORT_PATH", qtDir + "/qml");
env.insert("QML2_IMPORT_PATH", qtDir + "/qml");
env.insert("QT_PLUGIN_PATH", qtDir + "/plugins");
env.insert("QT_QPA_PLATFORM_PLUGIN_PATH", qtDir + "/plugins/platforms");
QProcess P;
P.setProcessEnvironment(env);
P.start("ldd " + file, QProcess::ReadOnly);

View File

@ -28,6 +28,8 @@ private:
QStringList qmlLibs;
QStringList neededPlugins;
QStringList ignoreList;
QStringList extraPath;
bool isQtLib(const QString& lib) const;
@ -72,6 +74,7 @@ public:
bool initDirs();
void setOnlyCLibs(bool value);
void setExtraPath(const QStringList &value);
};
#endif // DEPLOY_H

View File

@ -32,6 +32,8 @@ void help() {
qInfo() << " | for example -runScript myApp.sh";
qInfo() << " allQmlDependes : This flag will force to extract all qml libraries.";
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";
@ -53,6 +55,10 @@ bool parseQt(Deploy& deploy) {
return false;
}
auto list = QuasarAppUtils::getStrArg("libDir").split(",");
deploy.setExtraPath(list);
if (!deploy.initDirs()) {
qCritical() << "error init targeet dir";
return false;

View File

@ -33,6 +33,9 @@ Key differences of this program:
| | for example -runScript myApp.sh |
| allQmlDependes | This flag will force to extract all qml libraries. |
| | (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 |
#### Example: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
@ -84,6 +87,10 @@ Console QtDeployer является консольной реализацией
| | пример -runScript myApp.sh |
| allQmlDependes | Этот флаг заставит извлекать все библиотеки qml. |
| | (не рекомендуется, так как занимает много памяти) |
| -libDir [list,params] | установит дополнительные пути к библиотекам |
| | пример -libDir ~/myLib,~/newLibs |
#### Пример: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
## Build для Linux