mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-17 03:49:36 +00:00
done поиск библиотек #16
This commit is contained in:
parent
4022c7262f
commit
662aafeb01
@ -168,6 +168,17 @@ void Deploy::setOnlyCLibs(bool value) {
|
|||||||
onlyCLibs = 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 {
|
bool Deploy::isQtLib(const QString &lib) const {
|
||||||
QFileInfo info(lib);
|
QFileInfo info(lib);
|
||||||
return info.absolutePath().contains(qtDir);
|
return info.absolutePath().contains(qtDir);
|
||||||
@ -219,12 +230,21 @@ void Deploy::extract(const QString &file, bool isExtractPlugins) {
|
|||||||
qInfo() << "extract lib :" << file;
|
qInfo() << "extract lib :" << file;
|
||||||
|
|
||||||
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
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("QML_IMPORT_PATH", qtDir + "/qml");
|
||||||
env.insert("QML2_IMPORT_PATH", qtDir + "/qml");
|
env.insert("QML2_IMPORT_PATH", qtDir + "/qml");
|
||||||
env.insert("QT_PLUGIN_PATH", qtDir + "/plugins");
|
env.insert("QT_PLUGIN_PATH", qtDir + "/plugins");
|
||||||
env.insert("QT_QPA_PLATFORM_PLUGIN_PATH", qtDir + "/plugins/platforms");
|
env.insert("QT_QPA_PLATFORM_PLUGIN_PATH", qtDir + "/plugins/platforms");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QProcess P;
|
QProcess P;
|
||||||
P.setProcessEnvironment(env);
|
P.setProcessEnvironment(env);
|
||||||
P.start("ldd " + file, QProcess::ReadOnly);
|
P.start("ldd " + file, QProcess::ReadOnly);
|
||||||
|
@ -28,6 +28,8 @@ private:
|
|||||||
QStringList qmlLibs;
|
QStringList qmlLibs;
|
||||||
QStringList neededPlugins;
|
QStringList neededPlugins;
|
||||||
QStringList ignoreList;
|
QStringList ignoreList;
|
||||||
|
QStringList extraPath;
|
||||||
|
|
||||||
|
|
||||||
bool isQtLib(const QString& lib) const;
|
bool isQtLib(const QString& lib) const;
|
||||||
|
|
||||||
@ -72,6 +74,7 @@ public:
|
|||||||
|
|
||||||
bool initDirs();
|
bool initDirs();
|
||||||
void setOnlyCLibs(bool value);
|
void setOnlyCLibs(bool value);
|
||||||
|
void setExtraPath(const QStringList &value);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEPLOY_H
|
#endif // DEPLOY_H
|
||||||
|
@ -32,6 +32,8 @@ void help() {
|
|||||||
qInfo() << " | for example -runScript myApp.sh";
|
qInfo() << " | for example -runScript myApp.sh";
|
||||||
qInfo() << " allQmlDependes : This flag will force to extract all qml libraries.";
|
qInfo() << " allQmlDependes : This flag will force to extract all qml libraries.";
|
||||||
qInfo() << " | (not recommended, as it takes up a lot of memory)";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto list = QuasarAppUtils::getStrArg("libDir").split(",");
|
||||||
|
|
||||||
|
deploy.setExtraPath(list);
|
||||||
|
|
||||||
if (!deploy.initDirs()) {
|
if (!deploy.initDirs()) {
|
||||||
qCritical() << "error init targeet dir";
|
qCritical() << "error init targeet dir";
|
||||||
return false;
|
return false;
|
||||||
|
@ -33,6 +33,9 @@ Key differences of this program:
|
|||||||
| | for example -runScript myApp.sh |
|
| | for example -runScript myApp.sh |
|
||||||
| allQmlDependes | This flag will force to extract all qml libraries. |
|
| allQmlDependes | This flag will force to extract all qml libraries. |
|
||||||
| | (not recommended, as it takes up a lot of memory) |
|
| | (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
|
#### 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 |
|
| | пример -runScript myApp.sh |
|
||||||
| allQmlDependes | Этот флаг заставит извлекать все библиотеки qml. |
|
| 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
|
#### Пример: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
|
||||||
|
|
||||||
## Build для Linux
|
## Build для Linux
|
||||||
|
Loading…
x
Reference in New Issue
Block a user