rename "lua.version" to "VERSION"
[liba.git] / lua / xmake.lua
blob024ed022e28388658ae822b74da783ac9d4efabf
1 ---@diagnostic disable
2 -- option: liba-lua
3 option("liba-lua")
4 set_showmenu(true)
5 set_category("liba")
6 set_values("lua5.4", "lua5.3", "lua5.2", "lua5.1", "luajit")
7 set_description("Enable/Disable Lua")
8 option_end()
10 if has_config("liba-lua") then
11 add_requires(get_config("liba-lua"))
12 target("alua")
13 set_kind("shared")
14 add_files("src/**.c")
15 add_defines("A_EXPORTS")
16 on_load(function(target)
17 local version = target:pkg(get_config("liba-lua")):version()
18 if version:major() >= 5 then
19 version = version:major() .. "." .. version:minor()
20 else
21 version = "5.1"
22 end
23 target:set("VERSION", version)
24 target:set("targetdir", path.join(target:targetdir(), "lua" .. version))
25 end)
26 on_install(function(target)
27 local installdir = target:installdir()
28 if installdir then
29 local version = target:get("VERSION")
30 print("installing %s to %s ..", target:name(), installdir)
31 installdir = path.join(installdir, "lib", "lua", version)
32 os.mkdir(installdir)
33 os.vcp(target:targetfile(), installdir)
34 end
35 end)
36 add_packages(get_config("liba-lua"))
37 if is_plat("windows", "mingw") then
38 set_filename("liba.dll")
39 else
40 set_filename("liba.so")
41 end
42 add_deps("a")
43 target_end()
44 end