winrt: Enable usage of static manifest files

Previously, manifest files always got processed to perform, e.g., variable
expansion.
This change introduces the 'verbatim' flag for WINRT_MANIFEST.CONFIG to
disable those steps and perform a simple copy of the source manifest.

Task-number: QTBUG-43468
Change-Id: Ie7d4d27376efb3bcf5bc38163496f0a1f1319742
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
bb10
Maurice Kalinowski 2016-10-04 13:08:06 +02:00
parent dd7bf4b4c1
commit c01d989a0c
1 changed files with 135 additions and 131 deletions

View File

@ -55,141 +55,145 @@
else: \
manifest_file.output = $$BUILD_DIR/AppxManifest.xml
# Provide the C-runtime dependency
equals(TEMPLATE, "app") {
VCLIBS = Microsoft.VCLibs.$$replace(MSVC_VER, \\., ).00
winphone: VCLIBS = $${VCLIBS}.Phone
CONFIG(debug, debug|release): \
VCLIBS = $${VCLIBS}.Debug
else: \
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
}
# 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 {
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"
write_file($$UUID_CACHE, WINRT_UUID)|error("Unable to write the UUID cache; aborting.")
eval($$WINRT_UUID)
!contains(WINRT_MANIFEST.CONFIG, "verbatim") {
# Provide the C-runtime dependency
equals(TEMPLATE, "app") {
VCLIBS = Microsoft.VCLibs.$$replace(MSVC_VER, \\., ).00
winphone: VCLIBS = $${VCLIBS}.Phone
CONFIG(debug, debug|release): \
VCLIBS = $${VCLIBS}.Debug
else: \
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
}
}
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
isEmpty(WINRT_MANIFEST.publisherid): WINRT_MANIFEST.publisherid = CN=$$(USERNAME)
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
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
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
*-msvc2015 {
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
}
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)
}
INDENT = "$$escape_expand(\\r\\n) "
# 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
contains(WINRT_MANIFEST.capabilities, defaults) {
WINRT_MANIFEST.capabilities -= defaults
WINRT_MANIFEST.capabilities += $$WINRT_MANIFEST.capabilities_default
}
contains(WINRT_MANIFEST.capabilities_device, defaults) {
WINRT_MANIFEST.capabilities_device -= defaults
WINRT_MANIFEST.capabilities_device += $$WINRT_MANIFEST.capabilities_device_default
}
# Capabilities are given as a string list and may change with the configuration (network, sensors, etc.)
WINRT_MANIFEST.capabilities = $$unique(WINRT_MANIFEST.capabilities)
WINRT_MANIFEST.capabilities_device = $$unique(WINRT_MANIFEST.capabilities_device)
!isEmpty(WINRT_MANIFEST.capabilities)|!isEmpty(WINRT_MANIFEST.capabilities_device) {
MANIFEST_CAPABILITIES += "<Capabilities>"
for(CAPABILITY, WINRT_MANIFEST.capabilities): \
MANIFEST_CAPABILITIES += " <Capability Name=\"$$CAPABILITY\" />"
for(CAPABILITY, WINRT_MANIFEST.capabilities_device): \
MANIFEST_CAPABILITIES += " <DeviceCapability Name=\"$$CAPABILITY\" />"
MANIFEST_CAPABILITIES += "</Capabilities>"
WINRT_MANIFEST.capabilities = $$join(MANIFEST_CAPABILITIES, $$INDENT, $$INDENT)
}
# Dependencies are given as a string list. The CRT dependency is added automatically above.
# For MSVC2015 the dependencies are added in conjunction with TargetDeviceFamily
# Due to the hard coded dependency on "Windows.Universal" the <Dependencies> tag
# is already inside the MSVC2015 manifest.
WINRT_MANIFEST.dependencies = $$unique(WINRT_MANIFEST.dependencies)
!isEmpty(WINRT_MANIFEST.dependencies) {
*-msvc2013: MANIFEST_DEPENDENCIES += "<Dependencies>"
for(DEPENDENCY, WINRT_MANIFEST.dependencies): \
MANIFEST_DEPENDENCIES += " <PackageDependency Name=\"$$DEPENDENCY\" />"
*-msvc2013: MANIFEST_DEPENDENCIES += "</Dependencies>"
WINRT_MANIFEST.dependencies = $$join(MANIFEST_DEPENDENCIES, $$INDENT, $$INDENT)
}
# 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)
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)
# 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 {
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"
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
isEmpty(WINRT_MANIFEST.publisherid): WINRT_MANIFEST.publisherid = CN=$$(USERNAME)
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
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
isEmpty(WINRT_MANIFEST.default_language): WINRT_MANIFEST.default_language = en
*-msvc2015 {
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(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)
icon_$${ICON_NAME}.CONFIG = verbatim
QMAKE_SUBSTITUTES += icon_$${ICON_NAME}
WINRT_MANIFEST.$${ICON_NAME} = assets/$$basename(ICON_FILE)
}
!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
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)
}
INDENT = "$$escape_expand(\\r\\n) "
# 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
contains(WINRT_MANIFEST.capabilities, defaults) {
WINRT_MANIFEST.capabilities -= defaults
WINRT_MANIFEST.capabilities += $$WINRT_MANIFEST.capabilities_default
}
contains(WINRT_MANIFEST.capabilities_device, defaults) {
WINRT_MANIFEST.capabilities_device -= defaults
WINRT_MANIFEST.capabilities_device += $$WINRT_MANIFEST.capabilities_device_default
}
# Capabilities are given as a string list and may change with the configuration (network, sensors, etc.)
WINRT_MANIFEST.capabilities = $$unique(WINRT_MANIFEST.capabilities)
WINRT_MANIFEST.capabilities_device = $$unique(WINRT_MANIFEST.capabilities_device)
!isEmpty(WINRT_MANIFEST.capabilities)|!isEmpty(WINRT_MANIFEST.capabilities_device) {
MANIFEST_CAPABILITIES += "<Capabilities>"
for(CAPABILITY, WINRT_MANIFEST.capabilities): \
MANIFEST_CAPABILITIES += " <Capability Name=\"$$CAPABILITY\" />"
for(CAPABILITY, WINRT_MANIFEST.capabilities_device): \
MANIFEST_CAPABILITIES += " <DeviceCapability Name=\"$$CAPABILITY\" />"
MANIFEST_CAPABILITIES += "</Capabilities>"
WINRT_MANIFEST.capabilities = $$join(MANIFEST_CAPABILITIES, $$INDENT, $$INDENT)
}
# Dependencies are given as a string list. The CRT dependency is added automatically above.
# For MSVC2015 the dependencies are added in conjunction with TargetDeviceFamily
# Due to the hard coded dependency on "Windows.Universal" the <Dependencies> tag
# is already inside the MSVC2015 manifest.
WINRT_MANIFEST.dependencies = $$unique(WINRT_MANIFEST.dependencies)
!isEmpty(WINRT_MANIFEST.dependencies) {
*-msvc2013: MANIFEST_DEPENDENCIES += "<Dependencies>"
for(DEPENDENCY, WINRT_MANIFEST.dependencies): \
MANIFEST_DEPENDENCIES += " <PackageDependency Name=\"$$DEPENDENCY\" />"
*-msvc2013: MANIFEST_DEPENDENCIES += "</Dependencies>"
WINRT_MANIFEST.dependencies = $$join(MANIFEST_DEPENDENCIES, $$INDENT, $$INDENT)
}
# 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)
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)
}
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)
icon_$${ICON_NAME}.CONFIG = verbatim
QMAKE_SUBSTITUTES += icon_$${ICON_NAME}
WINRT_MANIFEST.$${ICON_NAME} = assets/$$basename(ICON_FILE)
}
!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
}
} else {
manifest_file.CONFIG += verbatim
}
QMAKE_SUBSTITUTES += manifest_file