Merge pull request #949 from LORgames/ssurtees/DPIAwareness
Added DPI awareness support to VS2010+ projects
This commit is contained in:
commit
e768d4ab40
@ -52,3 +52,37 @@
|
||||
prepare()
|
||||
test.isemptycapture()
|
||||
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,19 +482,23 @@
|
||||
-- Write the manifest section.
|
||||
--
|
||||
|
||||
function m.manifest(cfg)
|
||||
if cfg.kind ~= p.STATICLIB then
|
||||
-- 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
|
||||
m.elements.manifest = function(cfg)
|
||||
return {
|
||||
m.enableDpiAwareness,
|
||||
m.additionalManifestFiles,
|
||||
}
|
||||
end
|
||||
|
||||
if #manifests > 0 then
|
||||
function m.manifest(cfg)
|
||||
if cfg.kind ~= p.STATICLIB then
|
||||
local contents = p.capture(function ()
|
||||
p.push()
|
||||
p.callArray(m.elements.manifest, cfg)
|
||||
p.pop()
|
||||
end)
|
||||
if #contents > 0 then
|
||||
p.push('<Manifest>')
|
||||
m.element("AdditionalManifestFiles", nil, "%s;%%(AdditionalManifestFiles)", table.concat(manifests, ";"))
|
||||
p.outln(contents)
|
||||
p.pop('</Manifest>')
|
||||
end
|
||||
end
|
||||
@ -1216,6 +1220,21 @@
|
||||
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)
|
||||
if #cfg.usingdirs > 0 then
|
||||
local dirs = vstudio.path(cfg, cfg.usingdirs)
|
||||
@ -1462,6 +1481,20 @@
|
||||
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)
|
||||
local v
|
||||
local x = cfg.vectorextensions
|
||||
|
@ -389,6 +389,18 @@
|
||||
kind = "string",
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "dpiawareness",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"Default",
|
||||
"None",
|
||||
"High",
|
||||
"HighPerMonitor",
|
||||
}
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "editandcontinue",
|
||||
scope = "config",
|
||||
|
Loading…
Reference in New Issue
Block a user