我正在尝试使用Visual Studio 2012构建Qt 4.8.5 / Qt 5.2.1,目标是Windows XP(SDK v7.1a)。使用VS2102编译时,源代码与SDK v7.1a存在各种不兼容性,因此它无法开箱即用。
这是一个规范性问题,提供在这样的环境中成功构建Qt所需的知识。
答案 0 :(得分:3)
首先,构建环境需要准备如下。注意事项:这个脚本的“变形”存在一些错别字,它们实际上是无操作的。
@call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
:: The below applies to XP-targeting builds *only*!
@set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
@set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
@set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
首先,我们注意到Qt源应保持原始状态,以便不破坏现有构建。我们不会更改现有的make规格。因此:
通过从win32-msvc2012-xp
复制来创建单独的qtbase/mkspecs/win32-msvc2012
qmake规范。修改它。
教授有关新qmake规范的configure和qmake makefile。
通过在qtbase中创建一个空的.gitignore文件来强制configure.exe的引导。
下面的脚本和补丁处理过程。
:: Assume that we're in an equivalent of C:\Qt prefix
@set PREFIX=%~dp0
:: Qt sources
@set QT=%PREFIX%..\5.2.1-src
:: Patch file(s)
@set SRC=%PREFIX%
@set SPEC=win32-msvc2012
@if not exist "%QT%\qt.pro" ( echo Qt source folder expected in %QT%>&2 & exit /b 1 )
::
@patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt5fixes.rej --input=%SRC%\qt5fixes.patch
::
@echo > %QT%\qtbase\.gitignore
@mkdir %QT%\qtbase\mkspecs\%SPEC%-xp
@copy %QT%\qtbase\mkspecs\%SPEC%\qplatformdefs.h %QT%\qtbase\mkspecs\%SPEC%-xp
@copy %QT%\qtbase\mkspecs\%SPEC%\qmake.conf %QT%\qtbase\mkspecs\%SPEC%-xp
@patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt5xp.rej --input=%SRC%\qt5xp.patch
要撤消更改,请运行以下命令(必须按上述方式设置变量):
@patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt5xp-unfix.rej --input=%SRC%\qt5xp.patch
@del %QT%\qtbase\mkspecs\%SPEC%-xp\qplatformdefs.h
@del %QT%\qtbase\mkspecs\%SPEC%-xp\qmake.conf
@rmdir %QT%\qtbase\mkspecs\%SPEC%-xp
@del %QT%\qtbase\.gitignore
然后通过执行:
执行构建configure -platform win32-msvc2012-xp
jom (or nmake)
jom install (if doing the build separate from the installation directory)
此make规范还支持静态构建(给定-static
进行配置),但需要注意的是MSVC2012运行时仍然是动态链接的。对静态MSVC运行时的支持是another question的主题。
# qt5fixes.patch
# Fix for QTBUG-32519: Fix for preprocessor.lib not getting installed
--- qtbase/src/angle/src/compiler/preprocessor/preprocessor.pro 2014-02-01 22:37:36.000000000 -0500
+++ qtbase/src/angle/src/compiler/preprocessor/preprocessor.pro 2014-02-18 18:11:00.472660600 -0500
@@ -4,6 +4,10 @@
include(../../config.pri)
+contains(QT_CONFIG, static) {
+ load(qt_installs)
+}
+
INCLUDEPATH = $$ANGLE_DIR/src/compiler/preprocessor
DEFINES += _SECURE_SCL=0
# Fix for QTBUG-32519: Fix for translator_common.lib not getting installed
--- qtbase/src/angle/src/compiler/translator_common.pro 2014-02-01 22:37:36.000000000 -0500
+++ qtbase/src/angle/src/compiler/translator_common.pro 2014-02-18 18:08:51.596661200 -0500
@@ -4,6 +4,10 @@
include(../config.pri)
+contains(QT_CONFIG, static) {
+ load(qt_installs)
+}
+
# Mingw 4.7 chokes on implicit move semantics, so disable C++11 here
win32-g++*: CONFIG -= c++11
# Fix for QTBUG-32519: Fix for translator_hlsl.lib not getting installed
--- qtbase/src/angle/src/compiler/translator_hlsl.pro 2014-02-01 22:37:36.000000000 -0500
+++ qtbase/src/angle/src/compiler/translator_hlsl.pro 2014-02-18 18:09:54.651312600 -0500
@@ -4,6 +4,10 @@
include(../config.pri)
+contains(QT_CONFIG, static) {
+ load(qt_installs)
+}
+
# Mingw 4.7 chokes on implicit move semantics, so disable C++11 here
win32-g++*: CONFIG -= c++11
# Fix for QTBUG-36951: Make ANGLE binary compatible with rest of Qt
--- qtbase/src/angle/src/config.pri 2014-02-01 15:37:36.000000000 -0500
+++ qtbase/src/angle/src/config.pri 2014-02-20 04:26:52.535186300 -0500
@@ -54,7 +54,6 @@
CONFIG(debug, debug|release) {
DEFINES += _DEBUG
} else {
- CONFIG += rtti_off
DEFINES += NDEBUG
}
# qt5xp.patch
# XP Targeting Support for Qt 5.2
#
# Get configure to recognize all qmake specs that begin with a known prefix.
--- qtbase/tools/configure/environment.cpp 2014-02-01 15:37:29.000000000 -0500
+++ qtbase/tools/configure/environment.cpp 2014-02-18 13:14:37.321371600 -0500
@@ -149,23 +149,23 @@
Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec)
{
- if (qmakeSpec == QLatin1String("win32-msvc2013"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-msvc2013")))
return CC_NET2013;
- if (qmakeSpec == QLatin1String("win32-msvc2012"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-msvc2012")))
return CC_NET2012;
- if (qmakeSpec == QLatin1String("win32-msvc2010"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-msvc2010")))
return CC_NET2010;
- if (qmakeSpec == QLatin1String("win32-msvc2008"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-msvc2008")))
return CC_NET2008;
- if (qmakeSpec == QLatin1String("win32-msvc2005"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-msvc2005")))
return CC_NET2005;
- if (qmakeSpec == QLatin1String("win32-msvc2003"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-msvc2003")))
return CC_NET2003;
- if (qmakeSpec == QLatin1String("win32-icc"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-icc")))
return CC_INTEL;
- if (qmakeSpec == QLatin1String("win32-g++"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-g++")))
return CC_MINGW;
- if (qmakeSpec == QLatin1String("win32-borland"))
+ if (qmakeSpec.startsWith(QLatin1String("win32-borland")))
return CC_BORLAND;
return CC_UNKNOWN;
}
# Build configure with XP targeting.
--- qtbase/configure.bat 2014-02-01 15:37:23.000000000 -0500
+++ qtbase/configure.bat 2014-02-18 13:22:34.356160100 -0500
@@ -70,7 +70,7 @@
for /f "tokens=3 usebackq" %%V in (`findstr QT_VERSION_STR %QTSRC%\src\corelib\global\qglobal.h`) do @echo QTVERSION = %%~V>> Makefile
if not "%cl.exe%" == "" (
echo CXX = cl>>Makefile
- echo EXTRA_CXXFLAGS =>>Makefile
+ echo EXTRA_CXXFLAGS = -D_USING_V110_SDK71_>>Makefile
rem This must have a trailing space.
echo QTSRC = %QTSRC% >> Makefile
set tmpl=win32
# Build qmake with XP targeting.
--- qtbase/qmake/Makefile.win32 2014-02-20 12:24:10.341305900 -0500
+++ qtbase/qmake/Makefile.win32 2014-02-20 12:28:23.316380600 -0500
@@ -42,6 +42,9 @@
-DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_COMPRESS \
-DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM \
-DUNICODE -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_JSON_READONLY
+!if "$(QMAKESPEC)" == "win32-msvc2012-xp"
+CFLAGS_BARE = $(CFLAGS_BARE) -D_USING_V110_SDK71_
+!endif
CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS) $(EXTRA_CPPFLAGS)
CXXFLAGS_BARE = $(CFLAGS_BARE)
# Let qmake recognize the XP targeting makespec
--- qtbase/qmake/Makefile.win32 2014-02-01 22:37:30.000000000 -0500
+++ qtbase/qmake/Makefile.win32 2014-02-17 16:21:09.329949100 -0500
@@ -1,4 +1,4 @@
-!IF "$(QMAKESPEC)" == "win32-msvc" || "$(QMAKESPEC)" == "win32-msvc.net" || "$(QMAKESPEC)" == "win32-msvc2002" || "$(QMAKESPEC)" == "win32-msvc2003" || "$(QMAKESPEC)" == "win32-msvc2005" || "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2013" || "$(QMAKESPEC)" == "win32-icc"
+!IF "$(QMAKESPEC)" == "win32-msvc" || "$(QMAKESPEC)" == "win32-msvc.net" || "$(QMAKESPEC)" == "win32-msvc2002" || "$(QMAKESPEC)" == "win32-msvc2003" || "$(QMAKESPEC)" == "win32-msvc2005" || "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2012-xp" || "$(QMAKESPEC)" == "win32-msvc2013" || "$(QMAKESPEC)" == "win32-icc"
!if "$(SOURCE_PATH)" == ""
SOURCE_PATH = ..
# XP targeting makespec
--- qtbase/mkspecs/win32-msvc2012-xp/qmake.conf 2014-02-01 22:37:38.000000000 -0500
+++ qtbase/mkspecs/win32-msvc2012-xp/qmake.conf 2014-02-17 16:08:47.204498000 -0500
@@ -7,7 +7,7 @@
MAKEFILE_GENERATOR = MSBUILD
QMAKE_PLATFORM = win32
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
-DEFINES += UNICODE WIN32
+DEFINES += UNICODE WIN32 _USING_V110_SDK71_
QMAKE_COMPILER_DEFINES += _MSC_VER=1700 _WIN32
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += WIN64
@@ -69,8 +69,13 @@
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
+contains(QMAKE_TARGET.arch, x86_64) {
+ QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.02
+ QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.02
+} else {
+ QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
+ QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
+}
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
# Add support for XP targeting.
--- qtbase/src/corelib/io/qfilesystemengine_win.cpp 2014-02-01 22:37:36.000000000 -0500
+++ qtbase/src/corelib/io/qfilesystemengine_win.cpp 2014-02-17 16:20:29.612858300 -0500
@@ -571,7 +571,7 @@
// 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) || (defined(Q_CC_MSVC) && _MSC_VER >= 1700 && defined(_USING_V110_SDK71_))
// 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))
# Add support for XP targeting.
--- qtbase/src/corelib/kernel/qeventdispatcher_win.cpp 2014-02-17 17:29:02.552706900 -0500
+++ qtbase/src/corelib/kernel/qeventdispatcher_win.cpp 2014-02-17 17:25:26.662602800 -0500
@@ -435,7 +435,7 @@
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 defined(_MSC_VER) && _MSC_VER >= 1700 && !defined(_USING_V110_SDK71_)
if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
result &= ~(QS_TOUCH | QS_POINTER);
#endif // _MSC_VER >= 1700
答案 1 :(得分:1)
Qt 5.3及以后版本不需要任何其他补丁:只需使用“-target xp”运行configure。
您需要设置正确的环境,如其他答案所示
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
set PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
set LIB=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;%LIB%
set CL=/D_USING_V110_SDK71_
(CL = / D_USING_V110_SDK71_可防止来自Windows标头的大量警告。)
答案 2 :(得分:0)
构建环境需要准备如下。注意事项:这个脚本的“变形”存在一些错别字,它们实际上是无操作的。
@call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
:: The below applies to XP-targeting builds *only*!
@set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%
@set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%
@set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%
以下脚本修补了源代码:
:: Assume that we're in an equivalent of C:\Qt prefix
@set PREFIX=%~dp0
:: Qt sources
@set QT=%PREFIX%..\4.8.5-src
:: Patch file(s)
@set SRC=%PREFIX%
@set SPEC=win32-msvc2012
@if not exist "%QT%\projects.pro" ( echo Qt source folder expected in %QT%>&2 & exit /b 1 )
::
@patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt4fixes.rej --input=%SRC%\qt4fixes.patch
::
@mkdir %QT%\mkspecs\%SPEC%-xp
@copy %QT%\mkspecs\%SPEC%\qplatformdefs.h %QT%\mkspecs\%SPEC%-xp
@copy %QT%\mkspecs\%SPEC%\qmake.conf %QT%\mkspecs\%SPEC%-xp
@patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt4xp.rej --input=%SRC%\qt4xp.patch
要撤消更改,请运行以下命令:
@patch --reverse --directory=%QT% -p0 --global-reject-file=%SRC%\qt4static-unfix.rej --input=%SRC%\qt4static.patch
@del %QT%\mkspecs\%SPEC%-static\qplatformdefs.h
@del %QT%\mkspecs\%SPEC%-static\qmake.conf
@rmdir %QT%\mkspecs\%SPEC%-static
@del %QT%\mkspecs\%SPEC%-static-xp\qplatformdefs.h
@del %QT%\mkspecs\%SPEC%-static-xp\qmake.conf
@rmdir %QT%\mkspecs\%SPEC%-static-xp
然后通过执行:
执行构建configure -platform win32-msvc2012-xp
jom (or nmake)
# qt4fixes.patch
#
# Fix for HashSet under MSVC2012/2013.
--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h 2013-06-07 09:16:54.000000000 -0400
+++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/HashSet.h 2013-09-27 12:20:48.148285400 -0400
@@ -174,12 +174,23 @@
return m_impl.template contains<T, Adapter>(value);
}
+ /*
template<typename T, typename U, typename V>
inline pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value)
{
return m_impl.add(value);
}
+ */
+ // fix
+ template<typename T, typename U, typename V>
+ inline pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value)
+ {
+ typedef typename HashSet<T, U, V>::iterator iter_type;
+ auto& temp = m_impl.add(value);
+ return make_pair((iter_type)temp.first, temp.second);
+ }
+ /*
template<typename Value, typename HashFunctions, typename Traits>
template<typename T, typename HashTranslator>
inline pair<typename HashSet<Value, HashFunctions, Traits>::iterator, bool>
@@ -188,6 +199,18 @@
typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
return m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
}
+ */
+ // fix
+ template<typename Value, typename HashFunctions, typename Traits>
+ template<typename T, typename HashTranslator>
+ inline pair<typename HashSet<Value, HashFunctions, Traits>::iterator, bool>
+ HashSet<Value, HashFunctions, Traits>::add(const T& value)
+ {
+ typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter;
+ typedef typename HashSet<Value, HashFunctions, Traits>::iterator iter_type;
+ auto& temp = m_impl.template addPassingHashCode<T, T, Adapter>(value, value);
+ return make_pair((iter_type)temp.first, temp.second);
+ }
template<typename T, typename U, typename V>
inline void HashSet<T, U, V>::remove(iterator it)
# qt4xp.patch
# XP Targeting Support for Qt 4.8
#
# Build configure with XP targeting
--- tools/configure/configure.pro 2013-06-07 09:17:02.000000000 -0400
+++ tools/configure/configure.pro 2014-02-20 10:00:29.840317000 -0500
@@ -4,6 +4,7 @@
CONFIG += console flat stl rtti_off
CONFIG -= moc qt
DEFINES = UNICODE QT_NODLL QT_NO_CODECS QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_LITE_COMPONENT QT_NO_STL QT_NO_COMPRESS QT_NO_THREAD QT_NO_QOBJECT QT_NO_GEOM_VARIANT _CRT_SECURE_NO_DEPRECATE
+win32-msvc2012-xp: DEFINES += _USING_V110_SDK71_
DEFINES += QT_BOOTSTRAPPED
win32 : LIBS += -lole32 -ladvapi32
@@ -19,7 +20,7 @@
QMAKE_CXXFLAGS_DEBUG -= -MDd
QMAKE_CXXFLAGS_DEBUG += -MTd
}
-win32-msvc2012: DEFINES += _ALLOW_KEYWORD_MACROS
+win32-msvc2012*: DEFINES += _ALLOW_KEYWORD_MACROS
PRECOMPILED_HEADER = configure_pch.h
# Build qmake with XP targeting
--- qmake/Makefile.win32 2013-06-07 09:17:02.000000000 -0400
+++ qmake/Makefile.win32 2014-02-20 09:31:51.090426700 -0500
@@ -1,4 +1,4 @@
-!IF "$(QMAKESPEC)" == "win32-msvc" || "$(QMAKESPEC)" == "win32-msvc.net" || "$(QMAKESPEC)" == "win32-msvc2002" || "$(QMAKESPEC)" == "win32-msvc2003" || "$(QMAKESPEC)" == "win32-msvc2005" || "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-icc"
+!IF "$(QMAKESPEC)" == "win32-msvc" || "$(QMAKESPEC)" == "win32-msvc.net" || "$(QMAKESPEC)" == "win32-msvc2002" || "$(QMAKESPEC)" == "win32-msvc2003" || "$(QMAKESPEC)" == "win32-msvc2005" || "$(QMAKESPEC)" == "win32-msvc2008" || "$(QMAKESPEC)" == "win32-msvc2010" || "$(QMAKESPEC)" == "win32-msvc2012" || "$(QMAKESPEC)" == "win32-msvc2012-xp" || "$(QMAKESPEC)" == "win32-icc"
!if "$(SOURCE_PATH)" == ""
SOURCE_PATH = ..
# Build qmake with XP targeting
--- qmake/Makefile.win32 2013-06-07 09:17:02.000000000 -0400
+++ qmake/Makefile.win32 2014-02-20 09:31:51.090426700 -0500
@@ -42,6 +42,9 @@
-DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD \
-DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED \
-DQLIBRARYINFO_EPOCROOT
+!if "$(QMAKESPEC)" == "win32-msvc2012-xp"
+CFLAGS_BARE = $(CFLAGS_BARE) -D_USING_V110_SDK71_
+!endif
CFLAGS = -Yuqmake_pch.h -FIqmake_pch.h -Fpqmake_pch.pch $(CFLAGS_BARE) $(CFLAGS)
CXXFLAGS_BARE = $(CFLAGS_BARE)
--- mkspecs/win32-msvc2012-xp/qmake.conf 2013-06-07 09:17:00.000000000 -0400
+++ mkspecs/win32-msvc2012-xp/qmake.conf 2014-02-17 16:17:38.831119700 -0500
@@ -8,7 +8,7 @@
TEMPLATE = app
CONFIG += qt warn_on release incremental flat link_prl precompile_header autogen_precompile_source copy_dir_files debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
QT += core gui
-DEFINES += UNICODE WIN32
+DEFINES += UNICODE WIN32 _USING_V110_SDK71_
QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32
QMAKE_CC = cl
@@ -59,8 +59,8 @@
QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF
QMAKE_LFLAGS_DEBUG = /DEBUG
-QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
-QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
+QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
+QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.01
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
# Recognize spec prefixes.
--- src/3rdparty/webkit/Source/WebCore/WebCore.pri 2013-06-07 09:16:56.000000000 -0400
+++ src/3rdparty/webkit/Source/WebCore/WebCore.pri 2013-09-27 12:20:48.148285400 -0400
@@ -303,7 +303,7 @@
}
# Remove whole program optimizations due to miscompilations
-win32-msvc2005|win32-msvc2008|win32-msvc2010|wince*:{
+win32-msvc2005*|win32-msvc2008*|win32-msvc2010*|win32-msvc2012*|wince*:{
QMAKE_CFLAGS_LTCG -= -GL
QMAKE_CXXFLAGS_LTCG -= -GL
答案 3 :(得分:0)
感谢这个精彩的教程!
我可以使用Qt 4.8.5-1在Win7上成功重复它(见下面的注释)。
我想补充一些我必须努力解决的问题:
在Windows上,需要一个补丁工具。我使用GnuWin32 patch package,不幸的是必须以管理员身份运行。在补丁脚本中,我包含了补丁二进制文件的完整路径。
E:\Qt\enterprise-src-4.8.5_patch_for_build\patch-2.5.9-7-bin\bin\patch --forward --directory=%QT% -p0 --global-reject-file=%SRC%\qt4fixes.rej --input=%SRC%\qt4fixes.patch
为了在同一台机器上并行允许不同的平台规范,我做了一个“源外”构建。因此,创建一个新文件夹,例如4.8.5_static-xp_build
,启动命令提示符,运行“构建环境”脚本,切换到创建的文件夹并为qmake(set PATH=%cd%\bin;%PATH%
)设置PATH。
最后从源文件夹中调用configure,例如:
E:\Qt\qt-everywhere-enterprise-src-4.8.5-1\configure -platform win32-msvc2012-static-xp -make nmake -no-phonon -no-qt3support -no-multimedia -no-webkit -no-script -no-scripttools -no-declarative -nomake examples -static
最后提示:Qt 4.8撤消补丁脚本不正确,它应该撤消qt4xp.patch
和qt4fixes.patch
以及不 {{1} } ...
注意:我可以使用以下变量编译Qt 4.8.5-1:xp,static和static-xp。最后的Qt Demo可以在没有可再发行组件和Qt DLL的WinXP上运行。不幸的是我没有成功运行我自己的可执行文件,它是用VS2012 IDE编译的。用nmake编译工作......