mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-05-03 13:09:34 +00:00
added msvc base support part 1
This commit is contained in:
parent
a80d2062b4
commit
e734a37019
@ -235,6 +235,68 @@ QStringList DeployUtils::extractTranslation(const QStringList &libs) {
|
||||
return res.toList();
|
||||
}
|
||||
|
||||
MSVCVersion DeployUtils::getMSVC(const QString &_qmake) {
|
||||
QFileInfo qmake(_qmake);
|
||||
|
||||
int res = MSVCVersion::MSVC_Unknown;
|
||||
|
||||
if (!qmake.isFile()) {
|
||||
QuasarAppUtils::Params::verboseLog("qmake is wrong!");
|
||||
return static_cast<MSVCVersion>(res);
|
||||
}
|
||||
|
||||
QDir dir = qmake.absoluteDir();
|
||||
|
||||
if (!dir.cdUp()) {
|
||||
QuasarAppUtils::Params::verboseLog("is not standart qt repo");
|
||||
return static_cast<MSVCVersion>(res);
|
||||
}
|
||||
|
||||
auto msvcPath = dir.absolutePath();
|
||||
|
||||
if (!(dir.cdUp() && dir.cdUp())) {
|
||||
QuasarAppUtils::Params::verboseLog("is not standart qt repo");
|
||||
return static_cast<MSVCVersion>(res);
|
||||
}
|
||||
|
||||
if (!msvcPath.contains("msvc")) {
|
||||
QuasarAppUtils::Params::verboseLog("vcredis not defined");
|
||||
return static_cast<MSVCVersion>(res);
|
||||
}
|
||||
|
||||
auto base = msvcPath.mid(msvcPath.indexOf("msvc"), 11);
|
||||
auto version = base.mid(4 , 4);
|
||||
auto type = base.right(2);
|
||||
|
||||
if (version == "2013") {
|
||||
res |= MSVC_13;
|
||||
}
|
||||
else if (version == "2015") {
|
||||
res |= MSVC_15;
|
||||
}
|
||||
else if (version == "2017") {
|
||||
res |= MSVC_17;
|
||||
}
|
||||
else if (version == "2019") {
|
||||
res |= MSVC_19;
|
||||
}
|
||||
|
||||
if (type == "32") {
|
||||
res |= MSVC_x32;
|
||||
}
|
||||
else if (type == "64") {
|
||||
res |= MSVC_x64;
|
||||
}
|
||||
|
||||
return static_cast<MSVCVersion>(res);
|
||||
}
|
||||
|
||||
QString DeployUtils::getVCredist(const QString &_qmake) {
|
||||
auto msvc = getMSVC(_qmake);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool DeployUtils::isQtLib(const QString &lib) {
|
||||
QFileInfo info(lib);
|
||||
return !qtDir.isEmpty() && info.absoluteFilePath().contains(qtDir);
|
||||
|
@ -12,6 +12,16 @@
|
||||
#include <QDebug>
|
||||
#include "deploy_global.h"
|
||||
|
||||
enum MSVCVersion: int {
|
||||
MSVC_Unknown = 0x0,
|
||||
MSVC_x64 = 0x01,
|
||||
MSVC_x32 = 0x02,
|
||||
MSVC_13 = 0x10,
|
||||
MSVC_15 = 0x20,
|
||||
MSVC_17 = 0x40,
|
||||
MSVC_19 = 0x80,
|
||||
};
|
||||
|
||||
struct DEPLOYSHARED_EXPORT QtModuleEntry {
|
||||
quint64 module;
|
||||
const char *option;
|
||||
@ -87,6 +97,9 @@ public:
|
||||
static QStringList extraPaths;
|
||||
static QtModuleEntry qtModuleEntries[];
|
||||
|
||||
static MSVCVersion getMSVC(const QString & _qmake);
|
||||
static QString getVCredist(const QString & _qmake);
|
||||
|
||||
static bool isQtLib(const QString &lib);
|
||||
static bool isExtraLib(const QString &lib);
|
||||
static int getLibPriority(const QString &lib);
|
||||
|
@ -40,7 +40,7 @@ private slots:
|
||||
void testTranslations();
|
||||
void testStrip();
|
||||
void testDeploy();
|
||||
|
||||
void testMSVC();
|
||||
};
|
||||
|
||||
deploytest::deploytest(){}
|
||||
@ -274,8 +274,7 @@ void deploytest::testStrip() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void deploytest::testDeploy()
|
||||
{
|
||||
void deploytest::testDeploy() {
|
||||
QuasarAppUtils::Params::parseParams(0, nullptr);
|
||||
|
||||
Deploy *deploy = new Deploy();
|
||||
@ -283,6 +282,33 @@ void deploytest::testDeploy()
|
||||
delete deploy;
|
||||
}
|
||||
|
||||
void deploytest::testMSVC() {
|
||||
QString testPath = "./Qt/5.11.2/msvc2017_64/bin/";
|
||||
QString testqmakepath = testPath +"qmake";
|
||||
|
||||
QDir d;
|
||||
QDir oldDir("./Qt");
|
||||
oldDir.removeRecursively();
|
||||
QVERIFY(d.mkpath(testPath));
|
||||
|
||||
QFile file(testqmakepath);
|
||||
|
||||
QVERIFY(file.open(QIODevice::ReadWrite | QIODevice::Truncate));
|
||||
|
||||
QVERIFY(file.write("test"));
|
||||
|
||||
file.close();
|
||||
|
||||
|
||||
auto msvc = DeployUtils::getMSVC(testqmakepath);
|
||||
|
||||
QVERIFY(msvc & MSVCVersion::MSVC_17);
|
||||
QVERIFY(msvc & MSVCVersion::MSVC_x64);
|
||||
|
||||
QVERIFY(file.remove());
|
||||
|
||||
}
|
||||
|
||||
void deploytest::testTranslations() {
|
||||
QStringList trList = {
|
||||
("./test/QtDir/translations/qtbase_ru.qm"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user