Added DPI awareness support to VS2010+ projects
This commit is contained in:
parent
96a020c532
commit
d125d520e6
@ -52,3 +52,37 @@
|
|||||||
prepare()
|
prepare()
|
||||||
test.isemptycapture()
|
test.isemptycapture()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Check that DPI Awareness emits correctly
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.dpiAwareness_None()
|
||||||
|
dpiawareness "None"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<Manifest>
|
||||||
|
<EnableDpiAwareness>false</EnableDpiAwareness>
|
||||||
|
</Manifest>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.dpiAwareness_High()
|
||||||
|
dpiawareness "High"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<Manifest>
|
||||||
|
<EnableDpiAwareness>true</EnableDpiAwareness>
|
||||||
|
</Manifest>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
function suite.dpiAwareness_HighPerMonitor()
|
||||||
|
dpiawareness "HighPerMonitor"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<Manifest>
|
||||||
|
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
|
||||||
|
</Manifest>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -482,22 +482,26 @@
|
|||||||
-- Write the manifest section.
|
-- Write the manifest section.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
m.elements.manifest = function(cfg)
|
||||||
|
return {
|
||||||
|
m.enableDpiAwareness,
|
||||||
|
m.additionalManifestFiles,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
function m.manifest(cfg)
|
function m.manifest(cfg)
|
||||||
if cfg.kind ~= p.STATICLIB then
|
if cfg.kind ~= p.STATICLIB then
|
||||||
-- get the manifests files
|
local contents = p.capture(function ()
|
||||||
local manifests = {}
|
p.push()
|
||||||
for _, fname in ipairs(cfg.files) do
|
p.callArray(m.elements.manifest, cfg)
|
||||||
if path.getextension(fname) == ".manifest" then
|
p.pop()
|
||||||
table.insert(manifests, project.getrelative(cfg.project, fname))
|
end)
|
||||||
|
if #contents > 0 then
|
||||||
|
p.push('<Manifest>')
|
||||||
|
p.outln(contents)
|
||||||
|
p.pop('</Manifest>')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if #manifests > 0 then
|
|
||||||
p.push('<Manifest>')
|
|
||||||
m.element("AdditionalManifestFiles", nil, "%s;%%(AdditionalManifestFiles)", table.concat(manifests, ";"))
|
|
||||||
p.pop('</Manifest>')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1216,6 +1220,21 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function m.additionalManifestFiles(cfg)
|
||||||
|
-- get the manifests files
|
||||||
|
local manifests = {}
|
||||||
|
for _, fname in ipairs(cfg.files) do
|
||||||
|
if path.getextension(fname) == ".manifest" then
|
||||||
|
table.insert(manifests, project.getrelative(cfg.project, fname))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #manifests > 0 then
|
||||||
|
m.element("AdditionalManifestFiles", nil, "%s;%%(AdditionalManifestFiles)", table.concat(manifests, ";"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.additionalUsingDirectories(cfg)
|
function m.additionalUsingDirectories(cfg)
|
||||||
if #cfg.usingdirs > 0 then
|
if #cfg.usingdirs > 0 then
|
||||||
local dirs = vstudio.path(cfg, cfg.usingdirs)
|
local dirs = vstudio.path(cfg, cfg.usingdirs)
|
||||||
@ -1462,6 +1481,20 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function m.enableDpiAwareness(cfg)
|
||||||
|
local awareness = {
|
||||||
|
None = "false",
|
||||||
|
High = "true",
|
||||||
|
HighPerMonitor = "PerMonitorHighDPIAware",
|
||||||
|
}
|
||||||
|
local value = awareness[cfg.dpiawareness]
|
||||||
|
|
||||||
|
if value then
|
||||||
|
m.element("EnableDpiAwareness", nil, value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function m.enableEnhancedInstructionSet(cfg, condition)
|
function m.enableEnhancedInstructionSet(cfg, condition)
|
||||||
local v
|
local v
|
||||||
local x = cfg.vectorextensions
|
local x = cfg.vectorextensions
|
||||||
|
@ -389,6 +389,18 @@
|
|||||||
kind = "string",
|
kind = "string",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api.register {
|
||||||
|
name = "dpiawareness",
|
||||||
|
scope = "config",
|
||||||
|
kind = "string",
|
||||||
|
allowed = {
|
||||||
|
"Default",
|
||||||
|
"None",
|
||||||
|
"High",
|
||||||
|
"HighPerMonitor",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
api.register {
|
api.register {
|
||||||
name = "editandcontinue",
|
name = "editandcontinue",
|
||||||
scope = "config",
|
scope = "config",
|
||||||
|
Reference in New Issue
Block a user