mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-29 11:14:33 +00:00
ref #731 Added support of system qt (without qmake access)
This commit is contained in:
parent
5e37e9a2ad
commit
0197c24263
@ -1135,7 +1135,32 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
|
|||||||
QFileInfo info(qmake);
|
QFileInfo info(qmake);
|
||||||
|
|
||||||
QString basePath = info.absolutePath();
|
QString basePath = info.absolutePath();
|
||||||
if (!setQmake(qmake)) {
|
|
||||||
|
// Invoke qmake executable only when qmake pathe exclude snapRootFS path.
|
||||||
|
// Because files in snapRootFS is not executable ...
|
||||||
|
if (!qmake.contains(DeployCore::snapRootFS()) && setQmake(qmake)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// try deploy qt using only read FS permisions
|
||||||
|
|
||||||
|
// check debian qt structure
|
||||||
|
if (DeployCore::isDebianQt(info.absoluteFilePath())) {
|
||||||
|
QString neededPlatform = DeployCore::getPlatformLibPrefix(_config.getPlatformOfAll());
|
||||||
|
int qtVersion = DeployCore::qtVersionToString(_config.isNeededQt());
|
||||||
|
|
||||||
|
QString debianQtRoot = QString("/usr/lib/%0/qt%1").
|
||||||
|
arg(neededPlatform).arg(qtVersion);
|
||||||
|
|
||||||
|
|
||||||
|
if (!setQtDir(debianQtRoot)) {
|
||||||
|
QuasarAppUtils::Params::log("Failed to initialize Qt directories",
|
||||||
|
QuasarAppUtils::Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QDir dir(basePath);
|
QDir dir(basePath);
|
||||||
|
|
||||||
if (!dir.cdUp()) {
|
if (!dir.cdUp()) {
|
||||||
@ -1144,9 +1169,12 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For snap package of cqtdeplyer it is norma behavior
|
||||||
|
if (!DeployCore::isSnap()) {
|
||||||
QuasarAppUtils::Params::log("Failed to execute the qmake process!"
|
QuasarAppUtils::Params::log("Failed to execute the qmake process!"
|
||||||
" Trying to initialize Qt directories from path: " + dir.absolutePath(),
|
" Trying to initialize Qt directories from path: " + dir.absolutePath(),
|
||||||
QuasarAppUtils::Warning);
|
QuasarAppUtils::Warning);
|
||||||
|
}
|
||||||
|
|
||||||
if (!setQtDir(dir.absolutePath())){
|
if (!setQtDir(dir.absolutePath())){
|
||||||
QuasarAppUtils::Params::log("Failed to initialize Qt directories",
|
QuasarAppUtils::Params::log("Failed to initialize Qt directories",
|
||||||
@ -1154,8 +1182,6 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1284,11 +1310,16 @@ bool ConfigParser::setQtDir(const QString &value) {
|
|||||||
}
|
}
|
||||||
_config.qtDir.setBins(info.absoluteFilePath() + ("/bin"));
|
_config.qtDir.setBins(info.absoluteFilePath() + ("/bin"));
|
||||||
|
|
||||||
|
if (DeployCore::isDebianQt(value)) {
|
||||||
|
_config.qtDir.setLibs(info.absoluteFilePath() + ("/.."));
|
||||||
|
} else {
|
||||||
if (!QFile::exists(info.absoluteFilePath() + ("/lib"))) {
|
if (!QFile::exists(info.absoluteFilePath() + ("/lib"))) {
|
||||||
QuasarAppUtils::Params::log("get qt lib failed!", QuasarAppUtils::Debug);
|
QuasarAppUtils::Params::log("get qt lib failed!", QuasarAppUtils::Debug);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_config.qtDir.setLibs(info.absoluteFilePath() + ("/lib"));
|
_config.qtDir.setLibs(info.absoluteFilePath() + ("/lib"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!QFile::exists(info.absoluteFilePath() + ("/qml"))) {
|
if (!QFile::exists(info.absoluteFilePath() + ("/qml"))) {
|
||||||
QuasarAppUtils::Params::log("get qt qml failed!", QuasarAppUtils::Debug);
|
QuasarAppUtils::Params::log("get qt qml failed!", QuasarAppUtils::Debug);
|
||||||
@ -1312,11 +1343,16 @@ bool ConfigParser::setQtDir(const QString &value) {
|
|||||||
_config.qtDir.setLibexecs(info.absoluteFilePath() + ("/bin"));
|
_config.qtDir.setLibexecs(info.absoluteFilePath() + ("/bin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DeployCore::isDebianQt(value)) {
|
||||||
|
_config.qtDir.setTranslations(QString("/usr/share/qt%0/translations").
|
||||||
|
arg(DeployCore::qtVersionToString(_config.isNeededQt())));
|
||||||
|
} else {
|
||||||
if (!QFile::exists(info.absoluteFilePath() + ("/translations"))) {
|
if (!QFile::exists(info.absoluteFilePath() + ("/translations"))) {
|
||||||
QuasarAppUtils::Params::log("get qt translations failed!", QuasarAppUtils::Debug);
|
QuasarAppUtils::Params::log("get qt translations failed!", QuasarAppUtils::Debug);
|
||||||
} else {
|
} else {
|
||||||
_config.qtDir.setTranslations(info.absoluteFilePath() + ("/translations"));
|
_config.qtDir.setTranslations(info.absoluteFilePath() + ("/translations"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!QFile::exists(info.absoluteFilePath() + ("/resources"))) {
|
if (!QFile::exists(info.absoluteFilePath() + ("/resources"))) {
|
||||||
QuasarAppUtils::Params::log("get qt resources failed!", QuasarAppUtils::Debug);
|
QuasarAppUtils::Params::log("get qt resources failed!", QuasarAppUtils::Debug);
|
||||||
|
@ -923,7 +923,7 @@ QString DeployCore::platformToString(Platform platform) {
|
|||||||
{Platform::Win32, "win_x86"},
|
{Platform::Win32, "win_x86"},
|
||||||
{Platform::Win64, "win_x86_64"},
|
{Platform::Win64, "win_x86_64"},
|
||||||
{Platform::Win_ARM_32, "win_arm"},
|
{Platform::Win_ARM_32, "win_arm"},
|
||||||
{Platform::win_ARM_64, "win_arm64"},
|
{Platform::Win_ARM_64, "win_arm64"},
|
||||||
{Platform::Unix_x86_32, "linux_x86"},
|
{Platform::Unix_x86_32, "linux_x86"},
|
||||||
{Platform::Unix_x86_64, "linux_x86_64"},
|
{Platform::Unix_x86_64, "linux_x86_64"},
|
||||||
{Platform::Unix_ARM_32, "linux_ARM"},
|
{Platform::Unix_ARM_32, "linux_ARM"},
|
||||||
@ -957,7 +957,7 @@ Platform DeployCore::getPlatformFromString(const QString &platformName) {
|
|||||||
{"win_x86", Platform::Win32},
|
{"win_x86", Platform::Win32},
|
||||||
{"win_x86_64", Platform::Win64},
|
{"win_x86_64", Platform::Win64},
|
||||||
{"win_arm", Platform::Win_ARM_32},
|
{"win_arm", Platform::Win_ARM_32},
|
||||||
{"win_arm64", Platform::win_ARM_64},
|
{"win_arm64", Platform::Win_ARM_64},
|
||||||
{"linux_x86", Platform::Unix_x86_32},
|
{"linux_x86", Platform::Unix_x86_32},
|
||||||
{"linux_x86_64", Platform::Unix_x86_64},
|
{"linux_x86_64", Platform::Unix_x86_64},
|
||||||
{"linux_ARM", Platform::Unix_ARM_32},
|
{"linux_ARM", Platform::Unix_ARM_32},
|
||||||
@ -1062,7 +1062,49 @@ Qt::CaseSensitivity DeployCore::getCaseSensitivity(const QString &checkedFile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Qt::CaseSensitive;
|
return Qt::CaseSensitive;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QString DeployCore::getPlatformLibPrefix(Platform plarform) {
|
||||||
|
|
||||||
|
if (plarform & Platform::Unix_x86_64) {
|
||||||
|
return "x86_64-linux-gnu";
|
||||||
|
} else if (plarform & Platform::Unix_ARM_64) {
|
||||||
|
return "aarch64-linux-gnu";
|
||||||
|
} else if (plarform & Platform::Unix_x86_32) {
|
||||||
|
return "x86_32-linux-gnu";
|
||||||
|
} else if (plarform & Platform::Unix_ARM_32) {
|
||||||
|
return "arm-linux-gnu";
|
||||||
|
} else if (plarform & Platform::Win64) {
|
||||||
|
return "";
|
||||||
|
} else if (plarform & Platform::Win32) {
|
||||||
|
return "";
|
||||||
|
} else if (plarform & Platform::Win_ARM_64) {
|
||||||
|
return "";
|
||||||
|
} else if (plarform & Platform::Win_ARM_32) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// not supported
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int DeployCore::qtVersionToString(QtMajorVersion qtVersion) {
|
||||||
|
if (qtVersion & QtMajorVersion::Qt6) {
|
||||||
|
return 6;
|
||||||
|
} else if (qtVersion & QtMajorVersion::Qt5) {
|
||||||
|
return 5;
|
||||||
|
} else if (qtVersion & QtMajorVersion::Qt4) {
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DeployCore::isDebianQt(const QString &qtRoot) {
|
||||||
|
return qtRoot.contains("/usr/lib/qt");
|
||||||
|
}
|
||||||
|
|
||||||
QString DeployCore::systemLibsFolderName() {
|
QString DeployCore::systemLibsFolderName() {
|
||||||
return "systemLibs";
|
return "systemLibs";
|
||||||
|
@ -48,7 +48,7 @@ enum Platform {
|
|||||||
Win32 = 0x0001,
|
Win32 = 0x0001,
|
||||||
Win64 = 0x0002,
|
Win64 = 0x0002,
|
||||||
Win_ARM_32 = 0x0004,
|
Win_ARM_32 = 0x0004,
|
||||||
win_ARM_64 = 0x0008,
|
Win_ARM_64 = 0x0008,
|
||||||
Win = Win32 | Win64,
|
Win = Win32 | Win64,
|
||||||
|
|
||||||
// Unix
|
// Unix
|
||||||
@ -323,6 +323,27 @@ public:
|
|||||||
* @return Qt CaseSensitivity value
|
* @return Qt CaseSensitivity value
|
||||||
*/
|
*/
|
||||||
static Qt::CaseSensitivity getCaseSensitivity(const QString& checkedFile = "");
|
static Qt::CaseSensitivity getCaseSensitivity(const QString& checkedFile = "");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief getPlatformLibPrefix This method return string value of the @a platform
|
||||||
|
* @param plarform This is input platform
|
||||||
|
* @return string value of the @a platfrom. If platform not supported strings implementations the return empty string.
|
||||||
|
*/
|
||||||
|
static QString getPlatformLibPrefix(Platform plarform);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief qtVersionToString return integer interpritation of the Qt major version
|
||||||
|
* @return integer implementation of major qt version.
|
||||||
|
* @note return 0 if the @a qtVersion is invalid
|
||||||
|
*/
|
||||||
|
static int qtVersionToString(QtMajorVersion qtVersion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief isDebianQt this method return true if the @a qtRoot is debian system qt.
|
||||||
|
* @param qtRoot path to qt root dir.
|
||||||
|
* @return true if the @a qtRoot is debian system qt else false.
|
||||||
|
*/
|
||||||
|
static bool isDebianQt(const QString& qtRoot);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define internalError() DeployCore::printInternalError(__FUNCTION__, __FILE__, __LINE__)
|
#define internalError() DeployCore::printInternalError(__FUNCTION__, __FILE__, __LINE__)
|
||||||
|
@ -128,7 +128,7 @@ bool PE::getLibInfo(const QString &lib, LibInfo &info) const {
|
|||||||
info.setPlatform(Win_ARM_32);
|
info.setPlatform(Win_ARM_32);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
info.setPlatform(win_ARM_64);
|
info.setPlatform(Win_ARM_64);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (parsedPeLib->peHeader.nt.FileHeader.Machine == peparse::IMAGE_FILE_MACHINE_I386 ||
|
} else if (parsedPeLib->peHeader.nt.FileHeader.Machine == peparse::IMAGE_FILE_MACHINE_I386 ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user