mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-26 09:44:33 +00:00
added support of msvc
This commit is contained in:
parent
e734a37019
commit
b4d8950382
@ -78,6 +78,18 @@ void Deploy::setTargetDir() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Deploy::deployMSVC() {
|
||||
qInfo () << "try deploy msvc";
|
||||
|
||||
auto msvcInstaller = DeployUtils::getVCredist(qmake);
|
||||
|
||||
if (msvcInstaller.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return copyFile(msvcInstaller, targetDir);
|
||||
}
|
||||
|
||||
bool Deploy::setTargets(const QStringList &value) {
|
||||
|
||||
bool isfillList = false;
|
||||
@ -248,6 +260,10 @@ void Deploy::deploy() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!deployMSVC()) {
|
||||
QuasarAppUtils::Params::verboseLog("deploy msvc failed");
|
||||
}
|
||||
|
||||
settings.setValue(targetDir, deployedFiles);
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,7 @@ class DEPLOYSHARED_EXPORT Deploy {
|
||||
|
||||
bool initDir(const QString &path);
|
||||
void setTargetDir();
|
||||
bool deployMSVC();
|
||||
|
||||
public:
|
||||
Deploy();
|
||||
|
@ -294,6 +294,51 @@ MSVCVersion DeployUtils::getMSVC(const QString &_qmake) {
|
||||
QString DeployUtils::getVCredist(const QString &_qmake) {
|
||||
auto msvc = getMSVC(_qmake);
|
||||
|
||||
QFileInfo qmake(_qmake);
|
||||
|
||||
QDir dir = qmake.absoluteDir();
|
||||
|
||||
if (!(dir.cdUp() && dir.cdUp() && dir.cdUp() && dir.cd("vcredist"))) {
|
||||
QuasarAppUtils::Params::verboseLog("redist not findet!");
|
||||
return "";
|
||||
}
|
||||
|
||||
auto infoList = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
auto name = getMSVCName(msvc);
|
||||
auto version = getMSVCVersion(msvc);
|
||||
|
||||
for (auto &&info: infoList) {
|
||||
auto file = QFileInfo(info).fileName();
|
||||
if (file.contains(name) && file.contains(version)) {
|
||||
return info.absoluteFilePath();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
QString DeployUtils::getMSVCName(MSVCVersion msvc) {
|
||||
if (msvc | MSVCVersion::MSVC_13) {
|
||||
return "msvc2013";
|
||||
} else if (msvc | MSVCVersion::MSVC_15) {
|
||||
return "msvc2015";
|
||||
} else if (msvc | MSVCVersion::MSVC_17) {
|
||||
return "msvc2017";
|
||||
} else if (msvc | MSVCVersion::MSVC_19) {
|
||||
return "msvc2019";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
QString DeployUtils::getMSVCVersion(MSVCVersion msvc) {
|
||||
if (msvc | MSVCVersion::MSVC_x32) {
|
||||
return "x86";
|
||||
} else if (msvc | MSVCVersion::MSVC_x64) {
|
||||
return "x64";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,10 @@ class Deploy;
|
||||
class DEPLOYSHARED_EXPORT DeployUtils
|
||||
{
|
||||
|
||||
private:
|
||||
static QString getMSVCName(MSVCVersion msvc);
|
||||
static QString getMSVCVersion(MSVCVersion msvc);
|
||||
|
||||
public:
|
||||
enum QtModule : quint64
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user