summaryrefslogtreecommitdiffstats
path: root/tools/configure/environment.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-08-14 09:48:55 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2016-08-18 17:10:47 +0000
commit97b856b78859861f16304debad29889f691d9eb7 (patch)
treec570975edb23c5790b323af7218ca4f28e6dd0bf /tools/configure/environment.cpp
parentc027cffbef6cb317a5a09e1785398c046f0a6395 (diff)
Use the qmake based configuration system also on Windows
Adapt configure.exe to use qmake to do most of the work of configuring Qt. This unifies a large part of our configuration system between Unix and Windows. configure.exe is now still doing the license check, creating qconfig.cpp, building qmake, and not much more. On the way, re-implement the still missing Windows-specific tests with the new system. The opengles2 vs. opengl-desktop conditions got a bit convoluted, as Unix prefers desktop GL, while Windows GLES2 (via ANGLE). Superficially, there is a circular dependency, but the platform scopes are supposed to break it. Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Change-Id: Ia1941f2c34b7f5bd4990a7673cd737361381c2e7 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tools/configure/environment.cpp')
-rw-r--r--tools/configure/environment.cpp151
1 files changed, 0 insertions, 151 deletions
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp
index dfcc322065..78298f1068 100644
--- a/tools/configure/environment.cpp
+++ b/tools/configure/environment.cpp
@@ -118,35 +118,6 @@ QString Environment::detectQMakeSpec()
return spec;
}
-Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec)
-{
- if (qmakeSpec == QLatin1String("win32-msvc2015"))
- return CC_MSVC2015;
- if (qmakeSpec == QLatin1String("win32-msvc2013"))
- return CC_MSVC2013;
- if (qmakeSpec == QLatin1String("win32-msvc2012"))
- return CC_MSVC2012;
- if (qmakeSpec == QLatin1String("win32-icc"))
- return CC_INTEL;
- if (qmakeSpec == QLatin1String("win32-g++"))
- return CC_MINGW;
- if (qmakeSpec == QLatin1String("win32-borland"))
- return CC_BORLAND;
- return CC_UNKNOWN;
-}
-
-QString Environment::gccVersion()
-{
- CompilerInfo *info = compilerInfo(CC_MINGW);
- int returnValue = 0;
- QString version = execute(QStringLiteral("%1 -dumpversion").arg(info->executable), &returnValue);
- if (returnValue != 0) {
- cout << "Could not get mingw version" << returnValue << qPrintable(version);
- version.resize(0);
- }
- return version;
-}
-
/*!
Returns the enum of the compiler which was detected on the system.
The compilers are detected in the order as entered into the
@@ -431,126 +402,4 @@ QString Environment::execute(const QString &command, int *returnCode)
return output;
}
-static QStringList splitPathList(const QString &path)
-{
-#if defined(Q_OS_WIN)
- QRegExp splitReg(QStringLiteral("[;,]"));
-#else
- QRegExp splitReg(QStringLiteral("[:]"));
-#endif
- QStringList result = path.split(splitReg, QString::SkipEmptyParts);
- const QStringList::iterator end = result.end();
- for (QStringList::iterator it = result.begin(); it != end; ++it) {
- // Remove any leading or trailing ", this is commonly used in the environment
- // variables
- if (it->startsWith('"'))
- it->remove(0, 1);
- if (it->endsWith('"'))
- it->chop(1);
- *it = QDir::cleanPath(*it);
- if (it->endsWith(QLatin1Char('/')))
- it->chop(1);
- }
- return result;
-}
-
-QString Environment::findFileInPaths(const QString &fileName, const QStringList &paths)
-{
- if (!paths.isEmpty()) {
- QDir d;
- const QChar separator = QDir::separator();
- foreach (const QString &path, paths)
- if (d.exists(path + separator + fileName))
- return path;
- }
- return QString();
-}
-
-QStringList Environment::path()
-{
- return splitPathList(QString::fromLocal8Bit(qgetenv("PATH")));
-}
-
-static QStringList mingwPaths(const QString &mingwPath, const QString &pathName)
-{
- QStringList ret;
- QDir mingwDir(mingwPath);
- const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
- for (int i = 0 ;i < subdirs.length(); ++i) {
- const QFileInfo &fi = subdirs.at(i);
- const QString name = fi.fileName();
- if (name == pathName)
- ret += fi.absoluteFilePath();
- else if (name.contains(QLatin1String("mingw"))) {
- ret += fi.absoluteFilePath() + QLatin1Char('/') + pathName;
- }
- }
- return ret;
-}
-
-// Return MinGW location from "c:\mingw\bin" -> "c:\mingw"
-static inline QString detectMinGW()
-{
- const QString gcc = QStandardPaths::findExecutable(QLatin1String("g++.exe"));
- return gcc.isEmpty() ?
- gcc : QFileInfo(QFileInfo(gcc).absolutePath()).absolutePath();
-}
-
-// Detect Direct X SDK up tp June 2010. Included in Windows Kit 8.
-QString Environment::detectDirectXSdk()
-{
- const QByteArray directXSdkEnv = qgetenv("DXSDK_DIR");
- if (directXSdkEnv.isEmpty())
- return QString();
- QString directXSdk = QDir::cleanPath(QString::fromLocal8Bit(directXSdkEnv));
- if (directXSdk.endsWith(QLatin1Char('/')))
- directXSdk.truncate(directXSdk.size() - 1);
- return directXSdk;
-}
-
-QStringList Environment::headerPaths(Compiler compiler)
-{
- QStringList headerPaths;
- if (compiler == CC_MINGW) {
- const QString mingwPath = detectMinGW();
- headerPaths = mingwPaths(mingwPath, QLatin1String("include"));
- // Additional compiler paths
- const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
- for (int i = 0; i < mingwConfigs.length(); ++i) {
- const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
- foreach (const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
- headerPaths += version.absoluteFilePath() + QLatin1String("/include");
- }
- } else {
- headerPaths = splitPathList(QString::fromLocal8Bit(getenv("INCLUDE")));
- }
-
- // Add Direct X SDK for ANGLE
- const QString directXSdk = detectDirectXSdk();
- if (!directXSdk.isEmpty()) // Add Direct X SDK for ANGLE
- headerPaths += directXSdk + QLatin1String("/include");
- return headerPaths;
-}
-
-QStringList Environment::libraryPaths(Compiler compiler)
-{
- QStringList libraryPaths;
- if (compiler == CC_MINGW) {
- libraryPaths = mingwPaths(detectMinGW(), "lib");
- } else {
- libraryPaths = splitPathList(QString::fromLocal8Bit(qgetenv("LIB")));
- }
-
- // Add Direct X SDK for ANGLE
- const QString directXSdk = detectDirectXSdk();
- if (!directXSdk.isEmpty()) {
-#ifdef Q_OS_WIN64
- libraryPaths += directXSdk + QLatin1String("/lib/x64");
-#else
- libraryPaths += directXSdk + QLatin1String("/lib/x86");
-#endif
- }
- return libraryPaths;
-}
-
QT_END_NAMESPACE