-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathxmake.lua
More file actions
75 lines (69 loc) · 2.29 KB
/
xmake.lua
File metadata and controls
75 lines (69 loc) · 2.29 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
add_rules("mode.debug", "mode.release")
set_warnings("more")
add_defines("WIN32", "_WIN32", "UNICODE", "_UNICODE")
set_encodings("source:utf-8")
-- set_languages("c++23")
-- xmake does not currently check for `/std:c++23preview`, but cl only supports it.
-- https://github.com/xmake-io/xmake/issues/6327
add_cxflags("/std:c++23preview", {force = true})
set_fpmodels("precise") -- Default
if is_mode("release") then
set_exceptions("none")
set_optimize("smallest")
set_runtimes("MT")
add_requires("vc-ltl5")
add_defines("NDEBUG")
add_ldflags("/DYNAMICBASE")
set_policy("build.optimization.lto", true)
end
if is_mode("debug") then
set_runtimes("MTd")
add_defines("_DEBUG")
add_ldflags("/DYNAMICBASE")
end
target("detours")
set_kind("static")
add_includedirs("detours/src", {public=true})
add_files(
"detours/src/detours.cpp",
"detours/src/disasm.cpp",
"detours/src/image.cpp",
"detours/src/modules.cpp"
)
if is_arch("x86") then
add_defines("_X86_")
add_files("detours/src/disolx86.cpp")
elseif is_arch("x64") then
add_defines("_AMD64_")
add_files("detours/src/disolx64.cpp")
elseif is_arch("arm64") then
add_defines("_ARM64_")
add_files("detours/src/disolarm64.cpp")
end
add_cxflags("-Wno-unknown-pragmas", "-Wno-reorder-ctor", "-Wno-unused-local-typedef", {tools = "clang_cl", force = true})
target("mini_gzip")
set_kind("static")
add_includedirs("mini_gzip", {public = true})
add_files("mini_gzip/miniz.c", "mini_gzip/mini_gzip.c")
add_cxflags("/wd5287", "/wd4267", {tools = "cl"})
target("chrome_plus")
set_kind("shared")
set_targetdir("$(builddir)/$(mode)")
set_basename("version")
add_deps("detours")
add_deps("mini_gzip")
add_files("src/*.cc")
add_files("src/*.rc")
add_links("onecore", "propsys", "oleacc")
if is_mode("release") then
add_packages("vc-ltl5")
end
after_build(function (target)
if is_mode("release") then
for _, file in ipairs(os.files("$(builddir)/release/*")) do
if not file:endswith("dll") then
os.rm(file)
end
end
end
end)