diff options
Diffstat (limited to 'tools/configure/environment.cpp')
-rw-r--r-- | tools/configure/environment.cpp | 151 |
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 |