summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2023-11-07 23:33:43 +0800
committerruki <[email protected]>2023-11-07 23:33:43 +0800
commitcbdfb8581392eb426dd7abce07b16308d6ba5a25 (patch)
treef413a344ac9e1f07abde548d1dcb28dd1f629941
parent0dfe01c36d154fdf6fd0b9db51763d59d6037638 (diff)
improve manifest
-rw-r--r--xmake/rules/platform/windows/manifest/xmake.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/xmake/rules/platform/windows/manifest/xmake.lua b/xmake/rules/platform/windows/manifest/xmake.lua
index e791d9398..112a93841 100644
--- a/xmake/rules/platform/windows/manifest/xmake.lua
+++ b/xmake/rules/platform/windows/manifest/xmake.lua
@@ -28,15 +28,25 @@ rule("platform.windows.manifest")
end
if target:has_tool("ld", "link") then
local manifest = false
+ local uac = false
local sourcebatch = target:sourcebatches()["platform.windows.manifest"]
if sourcebatch then
for _, sourcefile in ipairs(sourcebatch.sourcefiles) do
- target:add("ldflags", "/ManifestInput:" .. path.translate(sourcefile), {force = true})
+ target:add("ldflags", "/manifestinput:" .. path.translate(sourcefile), {force = true})
manifest = true
+ local content = io.readfile(sourcefile)
+ if content and content:find("requestedPrivileges", 1, true) then
+ uac = true
+ end
break
end
end
if manifest then
+ -- if manifest file is provided, we need disable default UAC manifest
+ -- @see https://github.com/xmake-io/xmake/pull/4362
+ if uac then
+ target:add("ldflags", "/manifestuac:no", {force = true})
+ end
target:add("ldflags", "/manifest:embed", {force = true})
end
end