forked from rime/weasel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmake.lua
33 lines (30 loc) · 1.3 KB
/
xmake.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
target("WeaselSetup")
set_kind("binary")
add_files("./*.cpp")
add_rules("add_rcfiles", "use_weaselconstants", "subwin")
add_links("imm32", "kernel32")
set_policy("windows.manifest.uac", "invoker")
add_files("$(projectdir)/PerMonitorHighDPIAware.manifest")
add_ldflags("/DEBUG /OPT:REF /OPT:ICF /LARGEADDRESSAWARE /ERRORREPORT:QUEUE")
before_build(function(target)
local target_dir = path.join(target:targetdir(), target:name())
if not os.exists(target_dir) then
os.mkdir(target_dir)
end
target:set("targetdir", target_dir)
local level = target:policy("windows.manifest.uac")
if level then
local level_maps = {
invoker = "asInvoker",
admin = "requireAdministrator",
highest = "highestAvailable"
}
assert(level_maps[level], "unknown uac level %s, please set invoker, admin or highest", level)
local ui = target:policy("windows.manifest.uac.ui") or false
target:add("ldflags", "/manifest:embed", {("/manifestuac:level='%s' uiAccess='%s'"):format(level_maps[level], ui)}, {force = true, expand = false})
end
end)
after_build(function(target)
os.cp(path.join(target:targetdir(), "WeaselSetup.exe"), "$(projectdir)/output")
os.cp(path.join(target:targetdir(), "WeaselSetup.pdb"), "$(projectdir)/output")
end)