-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathxmake.lua
More file actions
105 lines (86 loc) · 3.44 KB
/
xmake.lua
File metadata and controls
105 lines (86 loc) · 3.44 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
-- set minimum xmake version
set_xmakever("3.0.0")
-- set project constants
set_project("commonlibob64")
set_languages("c++23")
set_warnings("allextra")
set_encodings("utf-8")
-- add common rules
add_rules("mode.debug", "mode.releasedbg")
-- include subprojects
includes("lib/commonlib-shared")
-- define targets
target("commonlibob64", function ()
-- set target kind
set_kind("static")
-- set build by default
set_default(os.scriptdir() == os.projectdir())
-- add packages
add_deps("commonlib-shared", { public = true })
-- add source files
add_files("src/**.cpp")
-- add header files
add_includedirs("include", { public = true })
add_headerfiles(
"include/(OBSE/**.h)",
"include/(RE/**.h)",
"include/(UE/**.h)"
)
-- add extra files
add_extrafiles("res/commonlibob64.natvis")
-- set precompiled header
set_pcxxheader("include/OBSE/Impl/PCH.h")
-- add flags (clang-cl: disable warnings) (public)
add_cxxflags(
"clang_cl::-Wno-undefined-bool-conversion",
{ public = true }
)
end)
rule("commonlibob64.plugin", function()
add_deps("commonlib.plugin")
on_load(function(target)
target:data_set("commonlib.plugin.config", target:extraconf("rules", "commonlibob64.plugin"))
end)
on_config(function(target)
target:add("deps", "commonlibob64")
target:add("configfiles", path.join(os.scriptdir(), "res/commonlibob64-plugin.cpp.in"))
target:add("files", path.join(target:configdir(), "commonlibob64-plugin.cpp"))
local conf = target:extraconf("rules", "commonlibob64.plugin")
if conf.options then
if conf.options.sig_scanning then
conf.options.address_library = false
else
conf.options.sig_scanning = false
if conf.options.address_library == nil then
conf.options.address_library = true
end
end
if conf.options.no_struct_use then
conf.options.layout_dependent = false
else
conf.options.no_struct_use = false
if conf.options.layout_dependent == nil then
conf.options.layout_dependent = true
end
end
else
conf.options = {
sig_scanning = false,
address_library = true,
no_struct_use = false,
layout_dependent = true
}
end
target:set("configvar", "COMMONLIBOB64_OPTION_SIG_SCANNING", tostring(conf.options.sig_scanning))
target:set("configvar", "COMMONLIBOB64_OPTION_ADDRESS_LIBRARY", tostring(conf.options.address_library))
target:set("configvar", "COMMONLIBOB64_OPTION_NO_STRUCT_USE", tostring(conf.options.no_struct_use))
target:set("configvar", "COMMONLIBOB64_OPTION_LAYOUT_DEPENDENT", tostring(conf.options.layout_dependent))
if os.getenv("XSE_TES4_MODS_PATH") then
target:set("installdir", path.join(os.getenv("XSE_TES4_MODS_PATH"), target:name()))
elseif os.getenv("XSE_TES4_GAME_PATH") then
target:set("installdir", os.getenv("XSE_TES4_GAME_PATH"))
end
target:add("installfiles", target:targetfile(), { prefixdir = "OblivionRemastered/Binaries/Win64/OBSE/Plugins" })
target:add("installfiles", target:symbolfile(), { prefixdir = "OblivionRemastered/Binaries/Win64/OBSE/Plugins" })
end)
end)