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
@ -115,4 +115,5 @@ VCSOLUTION_EXTENSION = .sln
|
|||||||
VCPROJ_KEYWORD = Qt4VSv1.0
|
VCPROJ_KEYWORD = Qt4VSv1.0
|
||||||
|
|
||||||
include(angle.conf)
|
include(angle.conf)
|
||||||
|
include(windows-desktop.conf)
|
||||||
include(windows-vulkan.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 = defaults
|
||||||
WINRT_MANIFEST.capabilities_device = defaults
|
WINRT_MANIFEST.capabilities_device = defaults
|
||||||
|
|
||||||
|
WINDOWS_TARGET_PLATFORM_VERSION = $$(UCRTVERSION)
|
||||||
|
|
||||||
include(../angle.conf)
|
include(../angle.conf)
|
||||||
|
|
||||||
load(qt_config)
|
load(qt_config)
|
||||||
|
@ -90,6 +90,10 @@ staticlib:unix {
|
|||||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_STATIC_LIB
|
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 {
|
incredibuild_xge {
|
||||||
CONFIG -= incredibuild_xge
|
CONFIG -= incredibuild_xge
|
||||||
CONFIG = incredibuild_xge $$CONFIG
|
CONFIG = incredibuild_xge $$CONFIG
|
||||||
|
@ -96,9 +96,10 @@
|
|||||||
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
|
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
|
||||||
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
|
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
|
||||||
*-msvc2015|*-msvc2017 {
|
*-msvc2015|*-msvc2017 {
|
||||||
isEmpty(WINRT_MANIFEST.minVersion): WINRT_MANIFEST.minVersion = $$(UCRTVersion)
|
isEmpty(WINRT_MANIFEST.minVersion): \
|
||||||
isEmpty(WINRT_MANIFEST.minVersion): error("No UCRTVersion found in environment."))
|
WINRT_MANIFEST.minVersion = $$WINDOWS_TARGET_PLATFORM_VERSION
|
||||||
isEmpty(WINRT_MANIFEST.maxVersionTested): WINRT_MANIFEST.maxVersionTested = $$WINRT_MANIFEST.minVersion
|
isEmpty(WINRT_MANIFEST.maxVersionTested): \
|
||||||
|
WINRT_MANIFEST.maxVersionTested = $$WINDOWS_TARGET_PLATFORM_MIN_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
INDENT = "$$escape_expand(\\r\\n) "
|
INDENT = "$$escape_expand(\\r\\n) "
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
include(../common/g++-win32.conf)
|
include(../common/g++-win32.conf)
|
||||||
|
include(../common/windows-desktop.conf)
|
||||||
|
|
||||||
# modifications to g++-win32.conf
|
# modifications to g++-win32.conf
|
||||||
|
|
||||||
|
@ -2788,6 +2788,26 @@
|
|||||||
|
|
||||||
See also \l{#DEPENDPATH}{DEPENDPATH}.
|
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
|
\target WINRT_MANIFEST
|
||||||
\section1 WINRT_MANIFEST
|
\section1 WINRT_MANIFEST
|
||||||
|
|
||||||
@ -2921,10 +2941,12 @@
|
|||||||
\li The version number of the package. Defaults to \c{1.0.0.0}.
|
\li The version number of the package. Defaults to \c{1.0.0.0}.
|
||||||
\row
|
\row
|
||||||
\li minVersion
|
\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
|
\row
|
||||||
\li maxVersionTested
|
\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
|
\endtable
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <qscopedpointer.h>
|
#include <qscopedpointer.h>
|
||||||
#include <qstringlist.h>
|
#include <qstringlist.h>
|
||||||
#include <qfileinfo.h>
|
#include <qfileinfo.h>
|
||||||
#include <qversionnumber.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -625,31 +624,17 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
|
|||||||
<< tagValue("RootNamespace", tool.Name)
|
<< tagValue("RootNamespace", tool.Name)
|
||||||
<< tagValue("Keyword", tool.Keyword);
|
<< tagValue("Keyword", tool.Keyword);
|
||||||
|
|
||||||
QString windowsTargetPlatformVersion;
|
|
||||||
if (isWinRT) {
|
if (isWinRT) {
|
||||||
xml << tagValue("MinimumVisualStudioVersion", tool.Version)
|
xml << tagValue("MinimumVisualStudioVersion", tool.Version)
|
||||||
<< tagValue("DefaultLanguage", "en")
|
<< tagValue("DefaultLanguage", "en")
|
||||||
<< tagValue("AppContainerApplication", "true")
|
<< tagValue("AppContainerApplication", "true")
|
||||||
<< tagValue("ApplicationType", "Windows Store")
|
<< tagValue("ApplicationType", "Windows Store")
|
||||||
<< tagValue("ApplicationTypeRevision", tool.SdkVersion);
|
<< 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();
|
xml << closetag();
|
||||||
|
|
||||||
|
@ -1123,6 +1123,8 @@ public:
|
|||||||
QString SccLocalPath;
|
QString SccLocalPath;
|
||||||
QString PlatformName;
|
QString PlatformName;
|
||||||
QString SdkVersion;
|
QString SdkVersion;
|
||||||
|
QString WindowsTargetPlatformVersion;
|
||||||
|
QString WindowsTargetPlatformMinVersion;
|
||||||
|
|
||||||
// Single projects
|
// Single projects
|
||||||
QList<VCProjectSingleConfig> SingleProjects;
|
QList<VCProjectSingleConfig> SingleProjects;
|
||||||
|
@ -191,6 +191,10 @@ bool VcprojGenerator::writeProjectMakefile()
|
|||||||
mergedProject.SccProjectName = mergedProjects.at(0)->vcProject.SccProjectName;
|
mergedProject.SccProjectName = mergedProjects.at(0)->vcProject.SccProjectName;
|
||||||
mergedProject.SccLocalPath = mergedProjects.at(0)->vcProject.SccLocalPath;
|
mergedProject.SccLocalPath = mergedProjects.at(0)->vcProject.SccLocalPath;
|
||||||
mergedProject.PlatformName = mergedProjects.at(0)->vcProject.PlatformName;
|
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);
|
XmlOutput xmlOut(t);
|
||||||
projectWriter->write(xmlOut, mergedProject);
|
projectWriter->write(xmlOut, mergedProject);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user