2014-01-24 06:47:51 +00:00
# This performs basic variable replacement on the contents of the WinRT manifest template, as
# specified by WINRT_MANIFEST. The resulting manifest file is written to the output directory.
# While the most common options are covered by the default template, the developer is expected
# to make an application-level copy of the template in order to customize the manifest further.
# Afterwards, they can override the default template by assigning their template to WINRT_MANIFEST.
#
# All subkeys in WINRT_MANIFEST will be replaced if defined/found, so new variables can be easily
# added. The following keys have default values and are present in the default templates:
# WINRT_MANIFEST: The name of the input manifest file. Defaults to a file defined by the mkspec.
# WINRT_MANIFEST.target: The name of the target (.exe). Defaults to TARGET.
# WINRT_MANIFEST.identity: The unique ID of the app. Defaults to reusing the existing generated manifest's UUID, or generates a new UUID if none is present.
# WINRT_MANIFEST.name: The name of the package as displayed to the user. Defaults to TARGET.
# WINRT_MANIFEST.architecture: The target architecture. Defaults to VCPROJ_ARCH.
# WINRT_MANIFEST.version: The version number of the package. Defaults to "1.0.0.0".
# WINRT_MANIFEST.publisher: Display name of the publisher. Defaults to "Default publisher display name".
2014-06-23 08:47:55 +00:00
# WINRT_MANIFEST.publisher_id: The publisher's distinguished name (default: CN=MyCN).
# WINRT_MANIFEST.phone_product_id: The GUID of the product. Defaults to the value of WINRT_MANIFEST.identity. (Windows Phone only)
# WINRT_MANIFEST.phone_publisher_id: The GUID of the publisher. Defaults to an invalid GUID. (Windows Phone only)
2014-01-24 06:47:51 +00:00
# WINRT_MANIFEST.description: Package description. Defaults to "Default package description".
# WINRT_MANIFEST.background: Tile background color. Defaults to "green".
# WINRT_MANIFEST.foreground: Tile foreground (text) color (Windows 8/RT only). Defaults to "light".
# WINRT_MANIFEST.logo_store: Logo image file for Windows Store. Default provided by the mkspec.
# WINRT_MANIFEST.logo_small: Small logo image file. Default provided by the mkspec.
# WINRT_MANIFEST.logo_medium: Medium logo image file. Default provided by the mkspec.
# WINRT_MANIFEST.logo_large: Large logo image file. Default provided by the mkspec.
# WINRT_MANIFEST.splash_screen: Splash screen image file. Default provided by the mkspec.
2014-11-03 16:44:50 +00:00
# WINRT_MANIFEST.rotation_preference: Orientation specification. Default is empty. (portrait, landscape, landscapeFlipped)
2014-01-24 06:47:51 +00:00
# WINRT_MANIFEST.iconic_tile_icon: Image file for the "iconic" tile template icon. Default provided by the mkspec.
# WINRT_MANIFEST.iconic_tile_small: Image file for the small "iconic" tile template logo. Default provided by the mkspec.
2014-04-29 06:47:24 +00:00
# WINRT_MANIFEST.default_language: Specifies the default language of the application
2014-01-24 06:47:51 +00:00
# WINRT_MANIFEST.capabilities: Specifies capabilities to add to the capability list.
2014-03-28 08:15:11 +00:00
# WINRT_MANIFEST.capabilities_device: Specifies device capabilities to add to the capability list. (location, webcam...)
2014-01-24 06:47:51 +00:00
# WINRT_MANIFEST.dependencies: Specifies dependencies required by the package.
# The manifest is generated for each build pass for normal apps, and only once for vcapps.
# - Normal apps have their package root directory in the same place as the target (one for each build pass).
# - Visual Studio requires a design-mode manifest in the same location as the vcproj.
!isEmpty(WINRT_MANIFEST): \
if(build_pass:equals(TEMPLATE, "app"))| \
if(!build_pass:equals(TEMPLATE, "vcapp")) {
manifest_file.input = $$WINRT_MANIFEST
2014-02-25 14:32:47 +00:00
contains(TEMPLATE, "vc.*") {
BUILD_DIR = $$OUT_PWD
} else {
load(resolve_target)
BUILD_DIR = $$dirname(QMAKE_RESOLVED_TARGET)
}
2014-06-23 08:47:55 +00:00
contains(TEMPLATE, "vc.*"): \
2014-01-24 06:47:51 +00:00
manifest_file.output = $$BUILD_DIR/Package.appxmanifest
else: \
manifest_file.output = $$BUILD_DIR/AppxManifest.xml
# Provide the C-runtime dependency
equals(TEMPLATE, "app") {
VCLIBS = Microsoft.VCLibs.$$replace(MSVC_VER, \\., ).00
2014-06-03 07:39:30 +00:00
winphone: VCLIBS = $${VCLIBS}.Phone
2014-01-24 06:47:51 +00:00
CONFIG(debug, debug|release): \
2015-07-08 11:31:20 +00:00
VCLIBS = $${VCLIBS}.Debug
2014-01-24 06:47:51 +00:00
else: \
2015-07-08 11:31:20 +00:00
VCLIBS = $${VCLIBS}
contains(MSVC_VER, "14.0"): VCLIBS = "$${VCLIBS}\" MinVersion=\"14.0.0.0\" Publisher=\"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
WINRT_MANIFEST.dependencies += $$VCLIBS
2014-01-24 06:47:51 +00:00
}
# Provide default values for required variables
isEmpty(WINRT_MANIFEST.target): WINRT_MANIFEST.target = $$TARGET
isEmpty(WINRT_MANIFEST.identity) {
# Reuse the existing UUID if possible
UUID_CACHE = $$OUT_PWD/.qmake.winrt_uuid_$$TARGET
exists($$UUID_CACHE) {
include($$UUID_CACHE)
} else {
2015-03-11 16:56:13 +00:00
WINRT_UUID = $$system(uuidgen)
isEmpty(WINRT_UUID): error("Unable to generate a UUID. Make sure uuidgen is in your PATH.")
WINRT_UUID = "WINRT_MANIFEST.identity = $$WINRT_UUID"
2014-01-24 06:47:51 +00:00
write_file($$UUID_CACHE, WINRT_UUID)|error("Unable to write the UUID cache; aborting.")
eval($$WINRT_UUID)
}
}
isEmpty(WINRT_MANIFEST.name): WINRT_MANIFEST.name = $$TARGET
isEmpty(WINRT_MANIFEST.architecture): WINRT_MANIFEST.architecture = $$VCPROJ_ARCH
isEmpty(WINRT_MANIFEST.version): WINRT_MANIFEST.version = 1.0.0.0
isEmpty(WINRT_MANIFEST.publisher): WINRT_MANIFEST.publisher = Default publisher display name
2014-06-23 08:47:55 +00:00
isEmpty(WINRT_MANIFEST.publisherid): WINRT_MANIFEST.publisherid = CN=$$(USERNAME)
2014-05-21 13:42:31 +00:00
isEmpty(WINRT_MANIFEST.phone_product_id): WINRT_MANIFEST.phone_product_id = $$WINRT_MANIFEST.identity
isEmpty(WINRT_MANIFEST.phone_publisher_id): WINRT_MANIFEST.phone_publisher_id = 00000000-0000-0000-0000-000000000000
2014-01-24 06:47:51 +00:00
isEmpty(WINRT_MANIFEST.description): WINRT_MANIFEST.description = Default package description
isEmpty(WINRT_MANIFEST.background): WINRT_MANIFEST.background = green
isEmpty(WINRT_MANIFEST.foreground): WINRT_MANIFEST.foreground = light
2014-04-29 06:47:24 +00:00
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
2014-01-24 06:47:51 +00:00
2014-11-03 16:44:50 +00:00
INDENT = "$$escape_expand(\\r\\n) "
VS_XML_NAMESPACE = "m2"
winphone: VS_XML_NAMESPACE = "m3"
WINRT_MANIFEST.rotation_preference = $$unique(WINRT_MANIFEST.rotation_preference)
!isEmpty(WINRT_MANIFEST.rotation_preference) {
MANIFEST_ROTATION += "<$${VS_XML_NAMESPACE}:InitialRotationPreference>"
for(ROTATION, WINRT_MANIFEST.rotation_preference): \
MANIFEST_ROTATION += " <$${VS_XML_NAMESPACE}:Rotation Preference=\"$$ROTATION\" />"
MANIFEST_ROTATION += "</$${VS_XML_NAMESPACE}:InitialRotationPreference>"
WINRT_MANIFEST.rotation_preference = $$join(MANIFEST_ROTATION, $$INDENT, $$INDENT)
}
2014-06-23 08:47:55 +00:00
INDENT = "$$escape_expand(\\r\\n) "
2014-04-29 06:47:24 +00:00
2015-11-18 08:40:48 +00:00
# All Windows 10 applications need to have internetClient. It is also not marked as additional
# capability anymore and is assumed to be standard.
*-msvc2015: WINRT_MANIFEST.capabilities += internetClient
2014-01-24 06:47:51 +00:00
# Capabilities are given as a string list and may change with the configuration (network, sensors, etc.)
WINRT_MANIFEST.capabilities = $$unique(WINRT_MANIFEST.capabilities)
2014-03-28 08:15:11 +00:00
WINRT_MANIFEST.capabilities_device = $$unique(WINRT_MANIFEST.capabilities_device)
2014-06-23 08:47:55 +00:00
!isEmpty(WINRT_MANIFEST.capabilities)|!isEmpty(WINRT_MANIFEST.capabilities_device) {
2014-02-25 08:19:10 +00:00
MANIFEST_CAPABILITIES += "<Capabilities>"
for(CAPABILITY, WINRT_MANIFEST.capabilities): \
MANIFEST_CAPABILITIES += " <Capability Name=\"$$CAPABILITY\" />"
2014-06-23 08:47:55 +00:00
for(CAPABILITY, WINRT_MANIFEST.capabilities_device): \
2014-03-28 08:15:11 +00:00
MANIFEST_CAPABILITIES += " <DeviceCapability Name=\"$$CAPABILITY\" />"
2014-02-25 08:19:10 +00:00
MANIFEST_CAPABILITIES += "</Capabilities>"
WINRT_MANIFEST.capabilities = $$join(MANIFEST_CAPABILITIES, $$INDENT, $$INDENT)
}
2014-01-24 06:47:51 +00:00
# Dependencies are given as a string list. The CRT dependency is added automatically above.
2015-07-08 11:31:20 +00:00
# For MSVC2015 the dependencies are added in conjunction with TargetDeviceFamily
2015-10-08 09:23:35 +00:00
# Due to the hard coded dependency on "Windows.Universal" the <Dependencies> tag
# is already inside the MSVC2015 manifest.
2014-01-24 06:47:51 +00:00
WINRT_MANIFEST.dependencies = $$unique(WINRT_MANIFEST.dependencies)
2014-02-25 08:19:10 +00:00
!isEmpty(WINRT_MANIFEST.dependencies) {
2015-10-08 09:23:35 +00:00
*-msvc2013: MANIFEST_DEPENDENCIES += "<Dependencies>"
2014-02-25 08:19:10 +00:00
for(DEPENDENCY, WINRT_MANIFEST.dependencies): \
MANIFEST_DEPENDENCIES += " <PackageDependency Name=\"$$DEPENDENCY\" />"
2015-10-08 09:23:35 +00:00
*-msvc2013: MANIFEST_DEPENDENCIES += "</Dependencies>"
2014-02-25 08:19:10 +00:00
WINRT_MANIFEST.dependencies = $$join(MANIFEST_DEPENDENCIES, $$INDENT, $$INDENT)
}
2014-01-24 06:47:51 +00:00
# Provide default icons where needed
isEmpty(WINRT_ASSETS_PATH): WINRT_ASSETS_PATH = $$[QT_HOST_DATA/get]/mkspecs/common/winrt_winphone/assets
TEMPLATE_CONTENTS = $$cat($$WINRT_MANIFEST, lines)
ICONS_FOUND = $$find(TEMPLATE_CONTENTS, \\\$\\\$\\{WINRT_MANIFEST\\.(logo|tile)_)
ICONS_FOUND ~= s/.*\\\$\\\$\\{WINRT_MANIFEST\\.((logo|tile)_[^\}]+)\\}.*/\\1/g
for (ICON_NAME, ICONS_FOUND) {
ICON_FILE = $$eval(WINRT_MANIFEST.$$ICON_NAME)
2015-01-09 14:48:50 +00:00
isEmpty(ICON_FILE) {
equals(ICON_NAME, "logo_310x150"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_wide)
else: equals(ICON_NAME, "logo_150x150"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_large)
# Windows Phone specifics
else: equals(ICON_NAME, "logo_480x800"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_splash)
else: equals(ICON_NAME, "logo_71x71"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_medium)
else: equals(ICON_NAME, "logo_44x44"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_small)
# Windows RT specifics
else: equals(ICON_NAME, "logo_620x300"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_splash)
else: equals(ICON_NAME, "logo_70x70"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_medium)
else: equals(ICON_NAME, "logo_30x30"): ICON_FILE = $$eval(WINRT_MANIFEST.logo_small)
}
2014-05-21 13:42:31 +00:00
isEmpty(ICON_FILE): ICON_FILE = $$WINRT_ASSETS_PATH/$${ICON_NAME}.png
icon_$${ICON_NAME}.input = $$ICON_FILE
icon_$${ICON_NAME}.output = $$BUILD_DIR/assets/$$basename(ICON_FILE)
2014-01-24 06:47:51 +00:00
icon_$${ICON_NAME}.CONFIG = verbatim
QMAKE_SUBSTITUTES += icon_$${ICON_NAME}
2014-05-21 13:42:31 +00:00
WINRT_MANIFEST.$${ICON_NAME} = assets/$$basename(ICON_FILE)
2014-01-24 06:47:51 +00:00
}
2015-06-17 07:25:24 +00:00
!contains(TEMPLATE, "vc.*") {
winrt_manifest_install.files = $$manifest_file.output
winrt_manifest_install.path = $$target.path
winrt_assets_install.files = $$BUILD_DIR/assets/*
winrt_assets_install.path = $$target.path/assets
INSTALLS += winrt_manifest_install winrt_assets_install
}
2014-01-24 06:47:51 +00:00
QMAKE_SUBSTITUTES += manifest_file
}