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
|
target("lua")
set_kind("static")
set_warnings("all")
-- disable c99(/TP) for windows
if is_plat("windows") then
set_languages("c89")
end
-- add header files
add_headerfiles("lua/(*.h)", {prefixdir = "lua"})
-- add include directories
add_includedirs("lua", {public = true})
-- add the common source files
add_files("lua/*.c|lua.c|onelua.c|loslib.c")
if not is_plat("iphoneos") then
add_files("lua/loslib.c")
end
-- add definitions
add_defines("LUA_COMPAT_5_1", "LUA_COMPAT_5_2", "LUA_COMPAT_5_3", {public = true})
if is_plat("windows", "mingw") then
-- it has been defined in luaconf.h
--add_defines("LUA_USE_WINDOWS")
elseif is_plat("macosx", "iphoneos") then
add_defines("LUA_USE_MACOSX")
else
add_defines("LUA_USE_LINUX")
end
-- we just disable os.execute for ios, because os.execv do not use it
-- @see https://github.com/xmake-io/xmake/issues/2187
on_load("iphoneos", function (target)
local loslib_file = target:autogenfile("loslib.c")
os.cp(path.join(os.scriptdir(), "lua", "loslib.c"), loslib_file)
io.replace(loslib_file, "system(cmd)", "0", {plain = true})
target:add("files", loslib_file)
end)
|