-
Notifications
You must be signed in to change notification settings - Fork 36
/
luamake.lua
248 lines (220 loc) · 5.73 KB
/
luamake.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
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
---@meta luamake
---@class LmPath
---@alias LmStrlist any
---@alias LmValue string | LmPath
---@class LmTargetAttri
---@field builddir string?
---@field bindir string?
---@field objdir string?
---@field rootdir string?
---@field workdir string?
---@field mode "debug" | "release"?
---@field crt "dynamic" | "static"?
---@field c "c89" | "c99" | "c11" | "c17" | "c23" | "clatest"?
---@field cxx "c++11" | "c++14" | "c++17" | "c++20" | "c++23" | "c++2a" | "c++2b" | "c++latest"?
---@field warnings "off" | "on" | "all" | "error" | "strict"?
---@field rtti "off" | "on"?
---@field visibility "hidden" | "default"?
---@field lto "off" | "on"?
---@field permissive "off" | "on"?
---@field includes LmStrlist?
---@field sysincludes LmStrlist?
---@field linkdirs LmStrlist?
---@field objdeps LmStrlist?
---@field defines LmStrlist?
---@field flags LmStrlist?
---@field ldflags LmStrlist?
---@field links LmStrlist?
---@field frameworks LmStrlist?
---@field deps LmStrlist?
---@field confs LmStrlist?
---@field sources LmStrlist?
---@field luaversion "lua53" | "lua54" | "lua55"?
---@field export_luaopen "off" | "on"?
---@field windows LmTargetAttri?
---@field linux LmTargetAttri?
---@field macos LmTargetAttri?
---@field ios LmTargetAttri?
---@field android LmTargetAttri?
---@field freebsd LmTargetAttri?
---@field openbsd LmTargetAttri?
---@field netbsd LmTargetAttri?
---@field msvc LmTargetAttri?
---@field gcc LmTargetAttri?
---@field clang LmTargetAttri?
---@field clang_cl LmTargetAttri?
---@field mingw LmTargetAttri?
---@field emcc LmTargetAttri?
---@class luamake: LmTargetAttri
---@field compile_commands string
---@field os string
---@field hostos string
---@field hostshell string
---@field compiler string
---@field cc string
---@field arch string
---@field [any] LmValue
local lm = {}
---
--- Asserts the minimum luamake version required to use.
---
---@param version string
function lm:required_version(version)
end
---
--- Include a lua file.
--- Unlike require, import creates a sandbox where the child can access the father's attribute, but modifying the attribute will not affect the father.
--- In addition, import will also change the workdir.
---
---@param path LmValue
function lm:import(path)
end
---
--- Create an absolute path, base is workdir.
---
---@param value string
---@return LmPath
function lm:path(value)
end
---
--- Gets whether a target already exists.
---
---@param name string
---@return boolean
function lm:has(name)
end
---
--- Specify default target. If not specified, all targets are default.
---
---@param targets LmStrlist
function lm:default(targets)
end
---@class LmRuleAttri
---@field args LmStrlist
---@field description string?
---@field generator string?
---@field pool string?
---@field restat string?
---@field rspfile string?
---@field rspfile_content string?
---@field deps string?
---@field depfile string?
---
--- Same as the rule in ninja.
---
---@param attribute string
---@return fun(attribute: LmRuleAttri)
function lm:rule(attribute)
end
---@class LmBuildAttri
---@field rootdir string?
---@field deps LmStrlist?
---@field inputs LmStrlist?
---@field outputs LmStrlist
---@field rule string
---
--- Same as the build in ninja.
---
---@param attribute string | LmBuildAttri
---@return fun(attribute: LmBuildAttri) ?
function lm:build(attribute)
end
---@class LmPhonyAttri
---@field rootdir string?
---@field deps LmStrlist?
---@field inputs LmStrlist?
---@field outputs LmStrlist
---
--- A target that does nothing. Just to resolve dependencies.
---
---@param attribute string | LmPhonyAttri
---@return fun(attribute: LmPhonyAttri) ?
function lm:phony(attribute)
end
---@class LmRunluaAttri
---@field rootdir string?
---@field deps LmStrlist?
---@field inputs LmStrlist?
---@field outputs LmStrlist?
---@field script string
---@field args LmStrlist?
---
--- Run a lua script. Equivalent to `luamake lua $script $args`
---
---@param attribute string | LmRunluaAttri
---@return fun(attribute: LmRunluaAttri) ?
function lm:runlua(attribute)
end
---@class LmCopyAttri
---@field rootdir string?
---@field deps LmStrlist?
---@field inputs LmStrlist?
---@field outputs LmStrlist
---
--- Copy files.
---
---@param attribute string | LmCopyAttri
---@return fun(attribute: LmCopyAttri) ?
function lm:copy(attribute)
end
---@class LmMsvcCopyDllAttri
---@field rootdir string?
---@field deps LmStrlist?
---@field inputs LmStrlist?
---@field outputs LmStrlist
---@field type "vcrt" | "ucrt" | "asan"
---
--- **msvc-specific**
--- Copy msvc runtime files to directory.
---
---@param attribute string | LmMsvcCopyDllAttri
---@return fun(attribute: LmMsvcCopyDllAttri) ?
function lm:msvc_copydll(attribute)
end
---
--- Define a attribute set.
--- If no name is specified, the attribute set is immediately applied to the current workspace.
--- If a name is specified, the confs attribute can apply the attribute set by this name.
---
---@param attribute string | LmTargetAttri
---@return fun(attribute: LmTargetAttri) ?
function lm:conf(attribute)
end
---
--- Compilation target, executable.
---
---@param name string
---@return fun(attribute: LmTargetAttri)
function lm:exe(name)
end
---
--- Compilation target, shared library.
---
---@param name string
---@return fun(attribute: LmTargetAttri)
function lm:dll(name)
end
---
--- Compilation target, static library.
---
---@param name string
---@return fun(attribute: LmTargetAttri)
function lm:lib(name)
end
---
--- Compilation target without link stage.
--- Can be depended on by compilation targets with link phases and participate in their link phases.
---
---@param name string
---@return fun(attribute: LmTargetAttri)
function lm:src(name)
end
lm.lua_exe = lm.exe
lm.lua_dll = lm.dll
lm.lua_lib = lm.lib
lm.lua_src = lm.src
lm.executable = lm.exe
lm.shared_library = lm.dll
lm.static_library = lm.lib
lm.source_set = lm.src
return lm