diff --git a/modules/vstudio/tests/vc2010/test_manifest.lua b/modules/vstudio/tests/vc2010/test_manifest.lua
index 043ab1085c..c94f7eb304 100644
--- a/modules/vstudio/tests/vc2010/test_manifest.lua
+++ b/modules/vstudio/tests/vc2010/test_manifest.lua
@@ -52,3 +52,37 @@
prepare()
test.isemptycapture()
end
+
+--
+-- Check that DPI Awareness emits correctly
+--
+
+ function suite.dpiAwareness_None()
+ dpiawareness "None"
+ prepare()
+ test.capture [[
+
+ false
+
+ ]]
+ end
+
+ function suite.dpiAwareness_High()
+ dpiawareness "High"
+ prepare()
+ test.capture [[
+
+ true
+
+ ]]
+ end
+
+ function suite.dpiAwareness_HighPerMonitor()
+ dpiawareness "HighPerMonitor"
+ prepare()
+ test.capture [[
+
+ PerMonitorHighDPIAware
+
+ ]]
+ end
diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua
index 097e72bd07..8fa780b4aa 100644
--- a/modules/vstudio/vs2010_vcxproj.lua
+++ b/modules/vstudio/vs2010_vcxproj.lua
@@ -482,22 +482,26 @@
-- Write the manifest section.
--
+ m.elements.manifest = function(cfg)
+ return {
+ m.enableDpiAwareness,
+ m.additionalManifestFiles,
+ }
+ end
+
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))
+ local contents = p.capture(function ()
+ p.push()
+ p.callArray(m.elements.manifest, cfg)
+ p.pop()
+ end)
+ if #contents > 0 then
+ p.push('')
+ p.outln(contents)
+ p.pop('')
end
end
-
- if #manifests > 0 then
- p.push('')
- m.element("AdditionalManifestFiles", nil, "%s;%%(AdditionalManifestFiles)", table.concat(manifests, ";"))
- p.pop('')
- end
- 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
diff --git a/src/_premake_init.lua b/src/_premake_init.lua
index ade304eea1..b660a39fe7 100644
--- a/src/_premake_init.lua
+++ b/src/_premake_init.lua
@@ -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",