diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2016-06-15 23:21:03 -0700 |
|---|---|---|
| committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2016-12-23 13:45:39 +0000 |
| commit | 04403d5b12debadf95b565bf84e0527ae787c87d (patch) | |
| tree | 9a9599075577cbbf27ed61247f7676c5e00e600b /tools/configure/environment.cpp | |
| parent | 4d9fbb33458c82aaf37d9712495a0653aae70533 (diff) | |
Merge all "win32-msvc*" mkspecs into one
Since we can tell the MSVC version from the compiler now, each of the
qmake.conf files is now the same, so let's just have "win32-msvc" and be
future-proof. Likewise for win32-clang-msvc.
qplatformdefs.h was already common.
Since we can't obtain the MSVC version from the unified mkspec name any
more, I dropped the warning level during the qmake bootstrap to reduce
the number of warnings that need to be disabled from compiler version to
version.
There is no point in keeping the old mkspecs, but configure will re-map
the -platform argument to the unified spec as necessary, to keep
existing configure command lines working.
[ChangeLog][Visual Studio] Qt now has a common mkspec for all Visual
Studio versions, called "win32-msvc". The old names which contained the
version number are now gone (but qmake scopes based on the old names
continue to work). The version of the compiler can be obtained from the
MSC_VER and MSVC_VER variables (for example, for Visual Studio 2015,
those contain the values 1900 and 14.0, respectively). Those variables
are also available with the Intel compiler (win32-icc) and with Clang
(win32-clang-msvc).
Done-with: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: Ib57b52598e2f452985e9fffd14587c0a77a5c09c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Diffstat (limited to 'tools/configure/environment.cpp')
| -rw-r--r-- | tools/configure/environment.cpp | 85 |
1 files changed, 11 insertions, 74 deletions
diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 260af276fa9..312e2f9e566 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -51,25 +51,18 @@ using namespace std; #include <qt_windows.h> #endif -#include <windows/registry_p.h> // from tools/shared - QT_BEGIN_NAMESPACE struct CompilerInfo{ Compiler compiler; const char *compilerStr; - const char *regKey; const char *executable; } compiler_info[] = { // The compilers here are sorted in a reversed-preferred order - {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"}, - {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe - {CC_MSVC2012, "Microsoft (R) Visual Studio 2012 C/C++ Compiler (11.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2013, "Microsoft (R) Visual Studio 2013 C/C++ Compiler (12.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe - // Microsoft skipped version 13 - {CC_MSVC2015, "Microsoft (R) Visual Studio 2015 C/C++ Compiler (14.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\14.0", "cl.exe"}, // link.exe, lib.exe - {CC_MSVC2017, "Microsoft (R) Visual Studio 2017 C/C++ Compiler (15.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VS7\\15.0", "cl.exe"}, // link.exe, lib.exe - {CC_UNKNOWN, "Unknown", 0, 0}, + {CC_MINGW, "MinGW (Minimalist GNU for Windows)", "g++.exe"}, + {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe + {CC_MSVC, "Microsoft (R) Visual Studio C/C++ Compiler", "cl.exe"}, // link.exe, lib.exe + {CC_UNKNOWN, "Unknown", 0}, }; @@ -94,17 +87,8 @@ QString Environment::detectQMakeSpec() { QString spec; switch (detectCompiler()) { - case CC_MSVC2017: - spec = "win32-msvc2017"; - break; - case CC_MSVC2015: - spec = "win32-msvc2015"; - break; - case CC_MSVC2013: - spec = "win32-msvc2013"; - break; - case CC_MSVC2012: - spec = "win32-msvc2012"; + case CC_MSVC: + spec = "win32-msvc"; break; case CC_INTEL: spec = "win32-icc"; @@ -128,61 +112,15 @@ QString Environment::detectQMakeSpec() */ Compiler Environment::detectCompiler() { -#ifndef Q_OS_WIN32 - return CC_UNKNOWN; // Always generate CC_UNKNOWN on other platforms -#else if(detectedCompiler != CC_UNKNOWN) return detectedCompiler; int installed = 0; - - // Check for compilers in registry first, to see which version is in PATH - QString paths = qgetenv("PATH"); - QStringList pathlist = paths.toLower().split(";"); - for(int i = 0; compiler_info[i].compiler; ++i) { - QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey, - KEY_WOW64_32KEY).toLower(); - if (productPath.length()) { - QStringList::iterator it; - for(it = pathlist.begin(); it != pathlist.end(); ++it) { - if((*it).contains(productPath)) { - if (detectedCompiler != compiler_info[i].compiler) { - ++installed; - detectedCompiler = compiler_info[i].compiler; - } - /* else { - - We detected the same compiler again, which happens when - configure is build with the 64-bit compiler. Skip the - duplicate so that we don't think it's installed twice. - - } - */ - break; - } - } - } - } - - // Now just go looking for the executables, and accept any executable as the lowest version - if (!installed) { - for(int i = 0; compiler_info[i].compiler; ++i) { - QString executable = QString(compiler_info[i].executable).toLower(); - if (executable.length() && !QStandardPaths::findExecutable(executable).isEmpty()) { - if (detectedCompiler != compiler_info[i].compiler) { - ++installed; - detectedCompiler = compiler_info[i].compiler; - } - /* else { - - We detected the same compiler again, which happens when - configure is build with the 64-bit compiler. Skip the - duplicate so that we don't think it's installed twice. - - } - */ - break; - } + for (int i = 0; compiler_info[i].compiler; ++i) { + if (!QStandardPaths::findExecutable(compiler_info[i].executable).isEmpty()) { + if (detectedCompiler == CC_UNKNOWN) + detectedCompiler = compiler_info[i].compiler; + ++installed; } } @@ -191,7 +129,6 @@ Compiler Environment::detectCompiler() detectedCompiler = CC_UNKNOWN; } return detectedCompiler; -#endif }; /*! |
