Windows XP target support for MSVC >= 2012
To enable windows xp support, we must do two things: 1. linker flag must be /SUBSYSTEM:CONSOLE,5.01 or /SUBSYSTEM:WINDOWS,5.01. For x64, the version is 5.02. 2. Do not use Windows Kit 8. Win SDK v7.1A is recommended. Prepend the right include paths and lib paths to INCLUDE and LIB before building. The Windows XP target support is enabled by passing "-target xp" to configure. Task-number: QTBUG-29939 Change-Id: I84c8439606cc2a9d27d64947702846faa4f1e4a2 Reviewed-by: Lucas Wang <wbsecg1@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
This commit is contained in:
parent
f412f2b5ee
commit
10a0ac759e
@ -1,4 +1,6 @@
|
||||
CONFIG -= windows
|
||||
contains(TEMPLATE, ".*app") {
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_CONSOLE $$QMAKE_LFLAGS_EXE
|
||||
QMAKE_LFLAGS += \
|
||||
$$replace(QMAKE_LFLAGS_CONSOLE, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) \
|
||||
$$QMAKE_LFLAGS_EXE
|
||||
}
|
||||
|
10
mkspecs/features/win32/qt_config.prf
Normal file
10
mkspecs/features/win32/qt_config.prf
Normal file
@ -0,0 +1,10 @@
|
||||
load(qt_config)
|
||||
|
||||
equals(QMAKE_TARGET_OS, xp) {
|
||||
# http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx?PageIndex=3
|
||||
equals(QT_ARCH, x86_64) {
|
||||
QMAKE_SUBSYSTEM_SUFFIX = ,5.02
|
||||
} else {
|
||||
QMAKE_SUBSYSTEM_SUFFIX = ,5.01
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
CONFIG -= console
|
||||
contains(TEMPLATE, ".*app"){
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_WINDOWS $$QMAKE_LFLAGS_EXE
|
||||
QMAKE_LFLAGS += \
|
||||
$$replace(QMAKE_LFLAGS_WINDOWS, @QMAKE_SUBSYSTEM_SUFFIX@, $$QMAKE_SUBSYSTEM_SUFFIX) \
|
||||
$$QMAKE_LFLAGS_EXE
|
||||
mingw:DEFINES += QT_NEEDS_QMAIN
|
||||
|
||||
qt:for(entryLib, $$list($$unique(QMAKE_LIBS_QT_ENTRY))) {
|
||||
|
@ -70,8 +70,8 @@ QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT
|
||||
QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_DEBUG = /DEBUG
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@
|
||||
QMAKE_LFLAGS_EXE = \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\"
|
||||
QMAKE_LFLAGS_DLL = /DLL
|
||||
QMAKE_LFLAGS_LTCG = /LTCG
|
||||
|
@ -70,8 +70,8 @@ QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT
|
||||
QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_DEBUG = /DEBUG
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE@QMAKE_SUBSYSTEM_SUFFIX@
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS@QMAKE_SUBSYSTEM_SUFFIX@
|
||||
QMAKE_LFLAGS_EXE = \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\"
|
||||
QMAKE_LFLAGS_DLL = /DLL
|
||||
QMAKE_LFLAGS_LTCG = /LTCG
|
||||
|
@ -396,12 +396,18 @@ QString VcprojGenerator::retrievePlatformToolSet() const
|
||||
if (!envVar.isEmpty())
|
||||
return envVar;
|
||||
|
||||
QString suffix;
|
||||
if (vcProject.Configuration.WinPhone)
|
||||
suffix = "_wp80";
|
||||
else if (project->first("QMAKE_TARGET_OS") == "xp")
|
||||
suffix = "_xp";
|
||||
|
||||
switch (vcProject.Configuration.CompilerVersion)
|
||||
{
|
||||
case NET2012:
|
||||
return vcProject.Configuration.WinPhone ? "v110_wp80" : "v110";
|
||||
return QStringLiteral("v110") + suffix;
|
||||
case NET2013:
|
||||
return "v120";
|
||||
return QStringLiteral("v120") + suffix;
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ QFileSystemEntry QFileSystemEngine::absoluteName(const QFileSystemEntry &entry)
|
||||
// FILE_INFO_BY_HANDLE_CLASS has been extended by FileIdInfo = 18 as of VS2012.
|
||||
typedef enum { Q_FileIdInfo = 18 } Q_FILE_INFO_BY_HANDLE_CLASS;
|
||||
|
||||
# if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && _MSC_VER < 1700)
|
||||
# if defined(Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601))
|
||||
|
||||
// MinGW-64 defines FILE_ID_128 as of gcc-4.8.1 along with FILE_SUPPORTS_INTEGRITY_STREAMS
|
||||
# if !(defined(Q_CC_MINGW) && defined(FILE_SUPPORTS_INTEGRITY_STREAMS))
|
||||
@ -619,7 +619,7 @@ typedef struct _FILE_ID_INFO {
|
||||
ULONGLONG VolumeSerialNumber;
|
||||
FILE_ID_128 FileId;
|
||||
} FILE_ID_INFO, *PFILE_ID_INFO;
|
||||
# endif // if defined (Q_CC_MINGW) || (defined(Q_CC_MSVC) && _MSC_VER < 1700))
|
||||
# endif // if defined (Q_CC_MINGW) || (defined(Q_CC_MSVC) && (_MSC_VER < 1700 || WINVER <= 0x0601))
|
||||
|
||||
// File ID for Windows up to version 7.
|
||||
static inline QByteArray fileId(HANDLE handle)
|
||||
|
@ -435,10 +435,10 @@ static inline UINT inputTimerMask()
|
||||
UINT result = QS_TIMER | QS_INPUT | QS_RAWINPUT;
|
||||
// QTBUG 28513, QTBUG-29097, QTBUG-29435: QS_TOUCH, QS_POINTER became part of
|
||||
// QS_INPUT in Windows Kit 8. They should not be used when running on pre-Windows 8.
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1700
|
||||
#if WINVER > 0x0601
|
||||
if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
|
||||
result &= ~(QS_TOUCH | QS_POINTER);
|
||||
#endif // _MSC_VER >= 1700
|
||||
#endif // WINVER > 0x0601
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,18 @@ void Configure::parseCmdLine()
|
||||
else if (configCmdLine.at(i) == "-force-asserts") {
|
||||
dictionary[ "FORCE_ASSERTS" ] = "yes";
|
||||
}
|
||||
|
||||
else if (configCmdLine.at(i) == "-target") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
break;
|
||||
const QString option = configCmdLine.at(i);
|
||||
if (option != "xp") {
|
||||
cout << "ERROR: invalid argument for -target option" << endl;
|
||||
dictionary["DONE"] = "error";
|
||||
return;
|
||||
}
|
||||
dictionary["TARGET_OS"] = option;
|
||||
}
|
||||
else if (configCmdLine.at(i) == "-platform") {
|
||||
++i;
|
||||
if (i == argCount)
|
||||
@ -1817,6 +1828,10 @@ bool Configure::displayHelp()
|
||||
desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
|
||||
desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
|
||||
desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
|
||||
|
||||
desc("TARGET_OS", "*", "-target", "Set target OS version. Currently the only valid value is 'xp' for targeting Windows XP.\n"
|
||||
"MSVC >= 2012 targets Windows Vista by default.\n");
|
||||
|
||||
desc( "-sysroot <dir>", "Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.");
|
||||
desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler.\n");
|
||||
|
||||
@ -2497,6 +2512,12 @@ bool Configure::verifyConfiguration()
|
||||
<< "files such as headers and libraries." << endl;
|
||||
prompt = true;
|
||||
}
|
||||
#if WINVER > 0x0601
|
||||
if (dictionary["TARGET_OS"] == "xp") {
|
||||
cout << "WARNING: Cannot use Windows Kit 8 to build Qt for Windows XP.\n"
|
||||
"WARNING: Windows SDK v7.1A is recommended.\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dictionary["DIRECT2D"] == "yes" && !checkAvailability("DIRECT2D")) {
|
||||
cout << "WARNING: To be able to build the Direct2D platform plugin you will" << endl
|
||||
@ -3331,6 +3352,10 @@ void Configure::generateQConfigPri()
|
||||
<< "}" << endl;
|
||||
}
|
||||
|
||||
const QString targetOS = dictionary.value("TARGET_OS");
|
||||
if (!targetOS.isEmpty())
|
||||
configStream << "QMAKE_TARGET_OS = " << targetOS << endl;
|
||||
|
||||
if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
|
||||
configStream << "QMAKE_RPATHDIR += " << formatPath(dictionary["QMAKE_RPATHDIR"]) << endl;
|
||||
|
||||
@ -3574,6 +3599,8 @@ void Configure::displayConfig()
|
||||
sout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
|
||||
else
|
||||
sout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
|
||||
if (!dictionary["TARGET_OS"].isEmpty())
|
||||
sout << "Target OS..................." << dictionary["TARGET_OS"] << endl;
|
||||
sout << "Architecture................" << dictionary["QT_ARCH"]
|
||||
<< ", features:" << dictionary["QT_CPU_FEATURES"] << endl;
|
||||
sout << "Host Architecture..........." << dictionary["QT_HOST_ARCH"]
|
||||
|
Loading…
Reference in New Issue
Block a user