Enable users to specify WindowsTargetPlatform[Min]Version in VS projects
[ChangeLog][qmake] Introduced the variables WINDOWS_TARGET_PLATFORM_VERSION and WINDOWS_TARGET_PLATFORM_MIN_VERSION for overriding the default values of WindowsTargetPlatformVersion and WindowsTargetPlatformMinVersion in Visual Studio project files. The code to determine the default values is moved to qmake feature files. A common/windows-desktop.conf file is introduced for variables common to all non-UWP Windows mkspecs. The package_manifest feature uses WINDOWS_TARGET_PLATFORM_VERSION as default value for WINRT_MANIFEST.minVersion, and WINDOWS_TARGET_PLATFORM_MIN_VERSION for WINRT_MANIFEST.maxVersionTested respectively. Task-number: QTBUG-53654 Change-Id: I251ec7f9b804c9bc9f7d571f5b43d52b2a2d99d3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
a5e1dc5e92
commit
6e34552638
mkspecs
common
features
win32-g++
qmake
@ -115,4 +115,5 @@ VCSOLUTION_EXTENSION = .sln
|
||||
VCPROJ_KEYWORD = Qt4VSv1.0
|
||||
|
||||
include(angle.conf)
|
||||
include(windows-desktop.conf)
|
||||
include(windows-vulkan.conf)
|
||||
|
5
mkspecs/common/windows-desktop.conf
Normal file
5
mkspecs/common/windows-desktop.conf
Normal file
@ -0,0 +1,5 @@
|
||||
# This file contains initializations for Windows Desktop platforms (non-UWP)
|
||||
|
||||
WINDOWS_TARGET_PLATFORM_VERSION = $$(WindowsSDKVersion)
|
||||
# The version number might have a trailing backslash due to a VS bug.
|
||||
WINDOWS_TARGET_PLATFORM_VERSION ~= s/\\\\$//
|
@ -97,6 +97,8 @@ WINRT_ASSETS_PATH = $$PWD/assets
|
||||
WINRT_MANIFEST.capabilities = defaults
|
||||
WINRT_MANIFEST.capabilities_device = defaults
|
||||
|
||||
WINDOWS_TARGET_PLATFORM_VERSION = $$(UCRTVERSION)
|
||||
|
||||
include(../angle.conf)
|
||||
|
||||
load(qt_config)
|
||||
|
@ -90,6 +90,10 @@ staticlib:unix {
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB
|
||||
}
|
||||
|
||||
defined(WINDOWS_TARGET_PLATFORM_VERSION, var):isEmpty(WINDOWS_TARGET_PLATFORM_MIN_VERSION) {
|
||||
WINDOWS_TARGET_PLATFORM_MIN_VERSION = $$WINDOWS_TARGET_PLATFORM_VERSION
|
||||
}
|
||||
|
||||
incredibuild_xge {
|
||||
CONFIG -= incredibuild_xge
|
||||
CONFIG = incredibuild_xge $$CONFIG
|
||||
|
@ -96,9 +96,10 @@
|
||||
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
|
||||
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
|
||||
*-msvc2015|*-msvc2017 {
|
||||
isEmpty(WINRT_MANIFEST.minVersion): WINRT_MANIFEST.minVersion = $$(UCRTVersion)
|
||||
isEmpty(WINRT_MANIFEST.minVersion): error("No UCRTVersion found in environment."))
|
||||
isEmpty(WINRT_MANIFEST.maxVersionTested): WINRT_MANIFEST.maxVersionTested = $$WINRT_MANIFEST.minVersion
|
||||
isEmpty(WINRT_MANIFEST.minVersion): \
|
||||
WINRT_MANIFEST.minVersion = $$WINDOWS_TARGET_PLATFORM_VERSION
|
||||
isEmpty(WINRT_MANIFEST.maxVersionTested): \
|
||||
WINRT_MANIFEST.maxVersionTested = $$WINDOWS_TARGET_PLATFORM_MIN_VERSION
|
||||
}
|
||||
|
||||
INDENT = "$$escape_expand(\\r\\n) "
|
||||
|
@ -8,6 +8,7 @@
|
||||
#
|
||||
|
||||
include(../common/g++-win32.conf)
|
||||
include(../common/windows-desktop.conf)
|
||||
|
||||
# modifications to g++-win32.conf
|
||||
|
||||
|
@ -2788,6 +2788,26 @@
|
||||
|
||||
See also \l{#DEPENDPATH}{DEPENDPATH}.
|
||||
|
||||
\target WINDOWS_TARGET_PLATFORM_VERSION
|
||||
\section1 WINDOWS_TARGET_PLATFORM_VERSION
|
||||
|
||||
Specifies the targeted Windows version; this corresponds to the tag
|
||||
\c{WindowsTargetPlatformVersion} in vcxproj files.
|
||||
|
||||
On desktop Windows, the default value is the value of the environment
|
||||
variable \c{WindowsSDKVersion}.
|
||||
|
||||
On WinRT, the default value is the value of the environment variable
|
||||
\c{UCRTVERSION}.
|
||||
|
||||
\target WINDOWS_TARGET_PLATFORM_MIN_VERSION
|
||||
\section1 WINDOWS_TARGET_PLATFORM_MIN_VERSION
|
||||
|
||||
Specifies the minimum version of the Windows target platform; this
|
||||
corresponds to the tag \c{WindowsTargetPlatformMinVersion} in vcxproj files.
|
||||
|
||||
Defaults to \c{WINDOWS_TARGET_PLATFORM_VERSION}.
|
||||
|
||||
\target WINRT_MANIFEST
|
||||
\section1 WINRT_MANIFEST
|
||||
|
||||
@ -2921,10 +2941,12 @@
|
||||
\li The version number of the package. Defaults to \c{1.0.0.0}.
|
||||
\row
|
||||
\li minVersion
|
||||
\li The minimum required Windows version to run the package. Defaults to the environment variable \c UCRTVersion.
|
||||
\li The minimum required Windows version to run the package.
|
||||
Defaults to \c{WINDOWS_TARGET_PLATFORM_VERSION}.
|
||||
\row
|
||||
\li maxVersionTested
|
||||
\li The maximum Windows version the package has been tested against. Defaults to \c WINRT_MANIFEST.minVersion
|
||||
\li The maximum Windows version the package has been tested against.
|
||||
Defaults to \c{WINDOWS_TARGET_PLATFORM_MIN_VERSION}.
|
||||
|
||||
\endtable
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <qscopedpointer.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qversionnumber.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -625,31 +624,17 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
|
||||
<< tagValue("RootNamespace", tool.Name)
|
||||
<< tagValue("Keyword", tool.Keyword);
|
||||
|
||||
QString windowsTargetPlatformVersion;
|
||||
if (isWinRT) {
|
||||
xml << tagValue("MinimumVisualStudioVersion", tool.Version)
|
||||
<< tagValue("DefaultLanguage", "en")
|
||||
<< tagValue("AppContainerApplication", "true")
|
||||
<< tagValue("ApplicationType", "Windows Store")
|
||||
<< tagValue("ApplicationTypeRevision", tool.SdkVersion);
|
||||
if (tool.SdkVersion == "10.0")
|
||||
windowsTargetPlatformVersion = qgetenv("UCRTVERSION");
|
||||
} else {
|
||||
QByteArray winSDKVersionStr = qgetenv("WindowsSDKVersion").trimmed();
|
||||
|
||||
// This environment variable might end with a backslash due to a VS bug.
|
||||
if (winSDKVersionStr.endsWith('\\'))
|
||||
winSDKVersionStr.chop(1);
|
||||
|
||||
QVersionNumber winSDKVersion = QVersionNumber::fromString(
|
||||
QString::fromLocal8Bit(winSDKVersionStr));
|
||||
if (!winSDKVersion.isNull())
|
||||
windowsTargetPlatformVersion = winSDKVersionStr;
|
||||
}
|
||||
if (!windowsTargetPlatformVersion.isEmpty()) {
|
||||
xml << tagValue("WindowsTargetPlatformVersion", windowsTargetPlatformVersion)
|
||||
<< tagValue("WindowsTargetPlatformMinVersion", windowsTargetPlatformVersion);
|
||||
}
|
||||
if (!tool.WindowsTargetPlatformVersion.isEmpty())
|
||||
xml << tagValue("WindowsTargetPlatformVersion", tool.WindowsTargetPlatformVersion);
|
||||
if (!tool.WindowsTargetPlatformMinVersion.isEmpty())
|
||||
xml << tagValue("WindowsTargetPlatformMinVersion", tool.WindowsTargetPlatformMinVersion);
|
||||
|
||||
xml << closetag();
|
||||
|
||||
|
@ -1123,6 +1123,8 @@ public:
|
||||
QString SccLocalPath;
|
||||
QString PlatformName;
|
||||
QString SdkVersion;
|
||||
QString WindowsTargetPlatformVersion;
|
||||
QString WindowsTargetPlatformMinVersion;
|
||||
|
||||
// Single projects
|
||||
QList<VCProjectSingleConfig> SingleProjects;
|
||||
|
@ -191,6 +191,10 @@ bool VcprojGenerator::writeProjectMakefile()
|
||||
mergedProject.SccProjectName = mergedProjects.at(0)->vcProject.SccProjectName;
|
||||
mergedProject.SccLocalPath = mergedProjects.at(0)->vcProject.SccLocalPath;
|
||||
mergedProject.PlatformName = mergedProjects.at(0)->vcProject.PlatformName;
|
||||
mergedProject.WindowsTargetPlatformVersion =
|
||||
project->first("WINDOWS_TARGET_PLATFORM_VERSION").toQString();
|
||||
mergedProject.WindowsTargetPlatformMinVersion =
|
||||
project->first("WINDOWS_TARGET_PLATFORM_MIN_VERSION").toQString();
|
||||
|
||||
XmlOutput xmlOut(t);
|
||||
projectWriter->write(xmlOut, mergedProject);
|
||||
|
Loading…
Reference in New Issue
Block a user