WinRT: Add qmake support for Windows 10

This allows creation of applications for
- x86
- x64
- arm

While the arm build theoretically also allows to launch on
a mobile, it currently asserts on runtime. Either we will
create a new mkspec for Windows 10 Mobile in the future,
or do runtime checks for the environment. That also depends
on whether there will be a separate SDK by Microsoft.

Change-Id: I510bfc88410a5b5a1eb7c37f7f43888d1e5dda0d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
This commit is contained in:
Maurice Kalinowski 2015-04-17 02:53:28 -07:00
parent 80c8d324b3
commit 99b08dd9d2
11 changed files with 290 additions and 6 deletions

View File

@ -0,0 +1,49 @@
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Package
xmlns=\"http://schemas.microsoft.com/appx/manifest/foundation/windows10\"
xmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\"
xmlns:uap=\"http://schemas.microsoft.com/appx/manifest/uap/windows10\"
IgnorableNamespaces=\"uap mp\">
<Identity
Name=\"$${WINRT_MANIFEST.identity}\"
Publisher=\"$${WINRT_MANIFEST.publisherid}\"
Version=\"$${WINRT_MANIFEST.version}\" />
<mp:PhoneIdentity PhoneProductId=\"$${WINRT_MANIFEST.identity}\" PhonePublisherId=\"$${WINRT_MANIFEST.phone_publisher_id}\"/>
<Properties>
<DisplayName>$${WINRT_MANIFEST.name}</DisplayName>
<PublisherDisplayName>$${WINRT_MANIFEST.publisher}</PublisherDisplayName>
<Logo>$${WINRT_MANIFEST.logo_store}</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name=\"Windows.Universal\" MinVersion=\"10.0.10069.0\" MaxVersionTested=\"10.0.10069.0\" />
</Dependencies>
<Resources>
<Resource Language=\"en\"/>
</Resources>
<Applications>
<Application Id=\"App\"
Executable=\"$${WINRT_MANIFEST.target}.exe\"
EntryPoint=\"$${WINRT_MANIFEST.target}.App\">
<uap:VisualElements
DisplayName=\"$${WINRT_MANIFEST.name}\"
Description=\"$${WINRT_MANIFEST.description}\"
BackgroundColor=\"$${WINRT_MANIFEST.background}\"
Square150x150Logo=\"$${WINRT_MANIFEST.logo_150x150}\"
Square44x44Logo=\"$${WINRT_MANIFEST.logo_44x44}\">
<uap:SplashScreen Image=\"$${WINRT_MANIFEST.logo_620x300}\" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name=\"internetClient\" />
</Capabilities>
</Package>

View File

@ -0,0 +1,32 @@
#
# qmake configuration for winrt-arm-msvc2015
#
# Written for Microsoft Visual C++ 2015
#
include(../common/winrt_winphone/qmake.conf)
QMAKE_COMPILER_DEFINES += _MSC_VER=1900
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_APP ARM __ARM__ __arm__
QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /MACHINE:ARM /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib
# Note that the order is important, ucrt(d) has to be first
# Otherwise the linker might use malloc from a different library
# but free_dbg() from the runtime, causing assert when deleting
# items from different heaps
CONFIG(debug, debug|release) {
QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS
} else {
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
}
VCPROJ_ARCH = ARM
MSVC_VER = 14.0
WINSDK_VER = 10.0
WINTARGET_VER = winv10.0
WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in
WINRT_MANIFEST.architecture = arm

View File

@ -0,0 +1,34 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../common/winrt_winphone/qplatformdefs.h"

View File

@ -0,0 +1,32 @@
#
# qmake configuration for winrt-x64-msvc2015
#
# Written for Microsoft Visual C++ 2015
#
include(../common/winrt_winphone/qmake.conf)
QMAKE_COMPILER_DEFINES += _MSC_VER=1900 _WIN32
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_APP X64 __X64__ __x64__
QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /MACHINE:X64 /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib
# Note that the order is important, ucrt(d) has to be first
# Otherwise the linker might use malloc from a different library
# but free_dbg() from the runtime, causing assert when deleting
# items from different heaps
CONFIG(debug, debug|release) {
QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS
} else {
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
}
VCPROJ_ARCH = x64
MSVC_VER = 14.0
WINSDK_VER = 10.0
WINTARGET_VER = winv10.0
WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in
WINRT_MANIFEST.architecture = x64

View File

@ -0,0 +1,34 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../common/winrt_winphone/qplatformdefs.h"

View File

@ -0,0 +1,32 @@
#
# qmake configuration for winrt-x86-msvc2015
#
# Written for Microsoft Visual C++ 2015
#
include(../common/winrt_winphone/qmake.conf)
QMAKE_COMPILER_DEFINES += _MSC_VER=1900 _WIN32
DEFINES += WINAPI_FAMILY=WINAPI_FAMILY_APP X86 __X86__ __x86__
QMAKE_CFLAGS += -FS
QMAKE_CXXFLAGS += -FS
QMAKE_LFLAGS += /SAFESEH /MACHINE:X86 /NODEFAULTLIB:kernel32.lib
QMAKE_LIBS += windowscodecs.lib WindowsApp.lib runtimeobject.lib
# Note that the order is important, ucrt(d) has to be first
# Otherwise the linker might use malloc from a different library
# but free_dbg() from the runtime, causing assert when deleting
# items from different heaps
CONFIG(debug, debug|release) {
QMAKE_LIBS = ucrtd.lib $$QMAKE_LIBS
} else {
QMAKE_LIBS = ucrt.lib $$QMAKE_LIBS
}
VCPROJ_ARCH = Win32
MSVC_VER = 14.0
WINSDK_VER = 10.0
WINTARGET_VER = winv10.0
WINRT_MANIFEST = $$PWD/../common/winrt_winphone/manifests/10.0/AppxManifest.xml.in
WINRT_MANIFEST.architecture = x86

View File

@ -0,0 +1,34 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../common/winrt_winphone/qplatformdefs.h"

View File

@ -608,10 +608,13 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
xml.setIndentString(" ");
const QString toolsVersion = (tool.SdkVersion == QStringLiteral("10.0")) ? QStringLiteral("14.0")
: QStringLiteral("4.0");
xml << decl("1.0", "utf-8")
<< tag("Project")
<< attrTag("DefaultTargets","Build")
<< attrTag("ToolsVersion", "4.0")
<< attrTag("ToolsVersion", toolsVersion)
<< attrTag("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003")
<< tag("ItemGroup")
<< attrTag("Label", "ProjectConfigurations");
@ -640,7 +643,7 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< tagValue("DefaultLanguage", "en")
<< tagValue("AppContainerApplication", "true")
<< tagValue("ApplicationType", isWinPhone ? "Windows Phone" : "Windows Store")
<< tagValue("ApplicationTypeRevision", tool.SdkVersion);
<< tagValue("ApplicationTypeRevision", tool.SdkVersion == "10.0" ? "8.2" : tool.SdkVersion);
}
xml << closetag();

View File

@ -176,11 +176,34 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
const QString vcInstallDir = "/fake/vc_install_dir";
const QString kitDir = "/fake/sdk_install_dir";
#endif // Q_OS_WIN
QStringList incDirs;
QStringList libDirs;
QStringList binDirs;
if (isPhone) {
if (msvcVer == QStringLiteral("14.0")) {
binDirs << vcInstallDir + QStringLiteral("bin/") + compiler;
binDirs << vcInstallDir + QStringLiteral("bin/"); // Maybe remove for x86 again?
binDirs << kitDir + QStringLiteral("bin/") + (arch == QStringLiteral("arm") ? QStringLiteral("x86") : arch);
binDirs << vcInstallDir + QStringLiteral("../Common7/Tools/bin");
binDirs << vcInstallDir + QStringLiteral("../Common7/Tools");
binDirs << vcInstallDir + QStringLiteral("../Common7/ide");
binDirs << kitDir + QStringLiteral("Windows Performance Toolkit/");
incDirs << vcInstallDir + QStringLiteral("include");
incDirs << vcInstallDir + QStringLiteral("atlmfc/include");
// ### Investigate why VS uses 10056 first
incDirs << kitDir + QStringLiteral("Include/10.0.10056.0/ucrt");
incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/ucrt");
incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/um");
incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/shared");
incDirs << kitDir + QStringLiteral("Include/10.0.10069.0/winrt");
libDirs << vcInstallDir + QStringLiteral("lib/store/") + compilerArch;
libDirs << vcInstallDir + QStringLiteral("atlmfc/lib") + compilerArch;
// ### Investigate why VS uses 10056 first
libDirs << kitDir + QStringLiteral("lib/10.0.10056.0/ucrt/") + arch;
libDirs << kitDir + QStringLiteral("lib/10.0.10069.0/ucrt/") + arch;
libDirs << kitDir + QStringLiteral("lib/10.0.10069.0/um/") + arch;
} else if (isPhone) {
QString sdkDir = vcInstallDir;
if (!QDir(sdkDir).exists()) {
fprintf(stderr, "Failed to find the Windows Phone SDK in %s.\n"
@ -208,7 +231,6 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
<< kitDir + QStringLiteral("/include/shared")
<< kitDir + QStringLiteral("/include/winrt");
}
// Inherit PATH
binDirs << QString::fromLocal8Bit(qgetenv("PATH")).split(QLatin1Char(';'));

View File

@ -56,7 +56,8 @@ enum DotNET {
NET2008 = 0x90,
NET2010 = 0xa0,
NET2012 = 0xb0,
NET2013 = 0xc0
NET2013 = 0xc0,
NET2015 = 0xd0
};
/*

View File

@ -71,6 +71,7 @@ struct DotNetCombo {
const char *regKey;
} dotNetCombo[] = {
#ifdef Q_OS_WIN64
{NET2015, "MSVC.NET 2015 (14.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\14.0\\Setup\\VC\\ProductDir"},
{NET2013, "MSVC.NET 2013 (12.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\12.0\\Setup\\VC\\ProductDir"},
{NET2013, "MSVC.NET 2013 Express Edition (12.0)", "Software\\Wow6432Node\\Microsoft\\VCExpress\\12.0\\Setup\\VC\\ProductDir"},
{NET2012, "MSVC.NET 2012 (11.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir"},
@ -84,6 +85,7 @@ struct DotNetCombo {
{NET2003, "MSVC.NET 2003 (7.1)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir"},
{NET2002, "MSVC.NET 2002 (7.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir"},
#else
{NET2015, "MSVC.NET 2015 (14.0)", "Software\\Microsoft\\VisualStudio\\14.0\\Setup\\VC\\ProductDir"},
{NET2013, "MSVC.NET 2013 (12.0)", "Software\\Microsoft\\VisualStudio\\12.0\\Setup\\VC\\ProductDir"},
{NET2013, "MSVC.NET 2013 Express Edition (12.0)", "Software\\Microsoft\\VCExpress\\12.0\\Setup\\VC\\ProductDir"},
{NET2012, "MSVC.NET 2012 (11.0)", "Software\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir"},
@ -175,6 +177,8 @@ const char _slnHeader110[] = "Microsoft Visual Studio Solution File, Format
"\n# Visual Studio 2012";
const char _slnHeader120[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
"\n# Visual Studio 2013";
const char _slnHeader140[] = "Microsoft Visual Studio Solution File, Format Version 12.00"
"\n# Visual Studio 2015";
// The following UUID _may_ change for later servicepacks...
// If so we need to search through the registry at
// HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Projects
@ -401,6 +405,8 @@ QString VcprojGenerator::retrievePlatformToolSet() const
return QStringLiteral("v110") + suffix;
case NET2013:
return QStringLiteral("v120") + suffix;
case NET2015:
return QStringLiteral("v140") + suffix;
default:
return QString();
}
@ -647,6 +653,8 @@ void VcprojGenerator::writeSubDirs(QTextStream &t)
}
switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) {
case NET2015:
t << _slnHeader140;
case NET2013:
t << _slnHeader120;
break;
@ -972,6 +980,9 @@ void VcprojGenerator::initProject()
// Own elements -----------------------------
vcProject.Name = project->first("QMAKE_ORIG_TARGET").toQString();
switch (which_dotnet_version(project->first("MSVC_VER").toLatin1())) {
case NET2015:
vcProject.Version = "14.00";
break;
case NET2013:
vcProject.Version = "12.00";
break;