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 | |
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')
-rw-r--r-- | tools/configure/Makefile.mingw | 10 | ||||
-rw-r--r-- | tools/configure/Makefile.win32 | 9 | ||||
-rw-r--r-- | tools/configure/configure.pro | 7 | ||||
-rw-r--r-- | tools/configure/configureapp.cpp | 13 | ||||
-rw-r--r-- | tools/configure/environment.cpp | 85 | ||||
-rw-r--r-- | tools/configure/environment.h | 8 |
6 files changed, 29 insertions, 103 deletions
diff --git a/tools/configure/Makefile.mingw b/tools/configure/Makefile.mingw index b61dc38de4..ccc3a64cdf 100644 --- a/tools/configure/Makefile.mingw +++ b/tools/configure/Makefile.mingw @@ -1,11 +1,10 @@ CORESRC = $(QTSRC)src/corelib -TOOLSRC = $(QTSRC)tools -CONFSRC = $(TOOLSRC)/configure +CONFSRC = $(QTSRC)tools/configure RAW_PCH = configure_pch.h PCH = $(RAW_PCH).gch/c++ DEFINES = -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DQT_USE_QSTRINGBUILDER -DQT_VERSION_STR=\"$(QTVERSION)\" -DQT_VERSION_MAJOR=$(QT_VERSION_MAJOR) -DQT_VERSION_MINOR=$(QT_VERSION_MINOR) -DQT_VERSION_PATCH=$(QT_VERSION_PATCH) -INCPATH = -I"../../include" -I"../../include/QtCore" -I"../../include/QtCore/$(QTVERSION)" -I"../../include/QtCore/$(QTVERSION)/QtCore" -I"$(TOOLSRC)/shared" -I"$(QTSRC)mkspecs/win32-g++" +INCPATH = -I"../../include" -I"../../include/QtCore" -I"../../include/QtCore/$(QTVERSION)" -I"../../include/QtCore/$(QTVERSION)/QtCore" -I"$(QTSRC)mkspecs/win32-g++" CXXFLAGS_BARE = -std=c++11 -fno-rtti -fno-exceptions -mthreads -Wall -Wextra $(DEFINES) $(INCPATH) CXXFLAGS = -include $(RAW_PCH) $(CXXFLAGS_BARE) LINK = g++ @@ -70,8 +69,7 @@ OBJECTS = \ qmalloc.o \ qxmlstream.o \ qxmlutils.o \ - quuid.o \ - registry.o + quuid.o $(TARGET): $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) @@ -112,7 +110,7 @@ $(PCH): $(CONFSRC)/configure_pch.h @$(CHK_DIR_EXISTS) $(RAW_PCH).gch $(CHK_DIR_EXISTS_GLUE) $(MKDIR) $(RAW_PCH).gch $(CXX) -x c++-header -c $(CXXFLAGS_BARE) -o $@ $< -VPATH = $(CONFSRC):$(TOOLSRC)/shared/windows:$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin +VPATH = $(CONFSRC):$(CORESRC)/global:$(CORESRC)/kernel:$(CORESRC)/tools:$(CORESRC)/codecs:$(CORESRC)/io:$(CORESRC)/xml:$(CORESRC)/plugin main.o: $(CONFSRC)/configureapp.h configureapp.o: $(CONFSRC)/configureapp.h $(CONFSRC)/environment.h diff --git a/tools/configure/Makefile.win32 b/tools/configure/Makefile.win32 index 8864d6fc8f..f0199343be 100644 --- a/tools/configure/Makefile.win32 +++ b/tools/configure/Makefile.win32 @@ -1,9 +1,8 @@ CORESRC = $(QTSRC)src\corelib -TOOLSRC = $(QTSRC)tools -CONFSRC = $(TOOLSRC)\configure +CONFSRC = $(QTSRC)tools\configure DEFINES = -DUNICODE -D_CRT_SECURE_NO_DEPRECATE -DQT_BOOTSTRAPPED -DQT_BUILD_CONFIGURE -DQT_USE_QSTRINGBUILDER -DQT_VERSION_STR=\"$(QTVERSION)\" -DQT_VERSION_MAJOR=$(QT_VERSION_MAJOR) -DQT_VERSION_MINOR=$(QT_VERSION_MINOR) -DQT_VERSION_PATCH=$(QT_VERSION_PATCH) -INCPATH = -I"..\..\include" -I"..\..\include\QtCore" -I"..\..\include\QtCore\$(QTVERSION)" -I"..\..\include\QtCore\$(QTVERSION)\QtCore" -I"$(TOOLSRC)\shared" -I"$(QTSRC)mkspecs\win32-msvc2012" +INCPATH = -I"..\..\include" -I"..\..\include\QtCore" -I"..\..\include\QtCore\$(QTVERSION)" -I"..\..\include\QtCore\$(QTVERSION)\QtCore" -I"$(QTSRC)mkspecs\win32-msvc" CXXFLAGS_BARE = -nologo -Zc:wchar_t -W3 -GR -EHsc -w34100 -w34189 -wd4577 $(CFLAGS_CRT) $(EXTRA_CXXFLAGS) $(DEFINES) $(INCPATH) !IF ("$(CXX)" != "clang-cl") PCH = configure_pch.pch @@ -76,7 +75,6 @@ OBJECTS = \ qxmlstream.obj \ qxmlutils.obj \ quuid.obj \ - registry.obj \ $(PCH_OBJECT) $(TARGET): $(OBJECTS) @@ -98,7 +96,6 @@ $(OBJECTS): $(PCH) main.obj: $(CONFSRC)\main.cpp $(CONFSRC)\configureapp.h $(PCH) configureapp.obj: $(CONFSRC)\configureapp.cpp $(CONFSRC)\configureapp.h $(CONFSRC)\environment.h $(PCH) environment.obj: $(CONFSRC)\environment.cpp $(CONFSRC)\environment.h $(PCH) -registry.obj: $(TOOLSRC)\shared\windows\registry.cpp $(PCH) qarraydata.obj: $(CORESRC)\tools\qarraydata.cpp $(PCH) qbytearray.obj: $(CORESRC)\tools\qbytearray.cpp $(PCH) qbytearraymatcher.obj: $(CORESRC)\tools\qbytearraymatcher.cpp $(PCH) @@ -157,8 +154,6 @@ quuid.obj: $(CORESRC)\plugin\quuid.cpp $(PCH) {$(CONFSRC)}.cpp{}.obj:: $(CXX) -c $(CXXFLAGS) $< -{$(TOOLSRC)\shared\windows}.cpp{}.obj:: - $(CXX) -c $(CXXFLAGS) $< {$(CORESRC)\tools}.cpp{}.obj:: $(CXX) -c $(CXXFLAGS) $< {$(CORESRC)\codecs}.cpp{}.obj:: diff --git a/tools/configure/configure.pro b/tools/configure/configure.pro index 93e6a197a2..90da2de119 100644 --- a/tools/configure/configure.pro +++ b/tools/configure/configure.pro @@ -76,9 +76,7 @@ HEADERS = configureapp.h environment.h \ $$QT_SOURCE_TREE/src/corelib/tools/qunicodetables_p.h \ $$QT_SOURCE_TREE/src/corelib/kernel/qsystemerror_p.h \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.h \ - $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h \ - $$QT_SOURCE_TREE/tools/shared/windows/registry_p.h - + $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils_p.h SOURCES = main.cpp configureapp.cpp environment.cpp \ $$QT_SOURCE_TREE/src/corelib/tools/qbytearray.cpp \ @@ -134,5 +132,4 @@ SOURCES = main.cpp configureapp.cpp environment.cpp \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlstream.cpp \ $$QT_SOURCE_TREE/src/corelib/xml/qxmlutils.cpp \ $$QT_SOURCE_TREE/src/corelib/plugin/quuid.cpp \ - $$QT_SOURCE_TREE/src/corelib/tools/qcryptographichash.cpp \ - $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp + $$QT_SOURCE_TREE/src/corelib/tools/qcryptographichash.cpp diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 2ffec0707f..6a09705cc1 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -163,6 +163,14 @@ void Configure::parseCmdLine() mkspecs << mkspec; } + if (dictionary[ "QMAKESPEC" ] == "win32-msvc2012" + || dictionary[ "QMAKESPEC" ] == "win32-msvc2013" + || dictionary[ "QMAKESPEC" ] == "win32-msvc2015" + || dictionary[ "QMAKESPEC" ] == "win32-msvc2017") { + cout << "\nNotice: re-mapping requested qmake spec to unified 'win32-msvc'.\n\n"; + dictionary[ "QMAKESPEC" ] = "win32-msvc"; + } + if (dictionary["QMAKESPEC"].toLower() == "features" || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) { dictionary[ "DONE" ] = "error"; @@ -175,10 +183,7 @@ void Configure::parseCmdLine() cout << "See the README file for a list of supported operating systems and compilers." << endl; } else { if (dictionary[ "QMAKESPEC" ].endsWith("-icc") || - dictionary[ "QMAKESPEC" ].endsWith("-msvc2012") || - dictionary[ "QMAKESPEC" ].endsWith("-msvc2013") || - dictionary[ "QMAKESPEC" ].endsWith("-msvc2015") || - dictionary[ "QMAKESPEC" ].endsWith("-msvc2017")) { + dictionary[ "QMAKESPEC" ].contains("-msvc")) { if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake"; dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32"; } else if (dictionary[ "QMAKESPEC" ].startsWith(QLatin1String("win32-g++"))) { diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 260af276fa..312e2f9e56 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 }; /*! diff --git a/tools/configure/environment.h b/tools/configure/environment.h index 8415fa10a6..65ddc60eff 100644 --- a/tools/configure/environment.h +++ b/tools/configure/environment.h @@ -35,13 +35,7 @@ enum Compiler { CC_UNKNOWN = 0, CC_MINGW = 0x02, CC_INTEL = 0x03, - CC_MSVC2005 = 0x80, - CC_MSVC2008 = 0x90, - CC_MSVC2010 = 0xA0, - CC_MSVC2012 = 0xB0, - CC_MSVC2013 = 0xC0, - CC_MSVC2015 = 0xD0, - CC_MSVC2017 = 0xE0 + CC_MSVC = 0x04 }; struct CompilerInfo; |