luarocks-build-xmake
luarocks-build-xmake copied to clipboard
Provide some xmake variables for install
Is your feature request related to a problem? Please describe.
Currently, luarocks build backend for xmake just run xmake install -o output, then install output/lib and lua. Perhaps we can provide more flexible method, provide some variables in xmake:
xmake.lua:
target("bar")
do
set_prefixdir("$(prefix)/lib", { libdir = "foo" })
add_rules("lua.module")
add_files("*.c")
add_installfiles("usage.md", {prefixdir= "$(prefix)/doc"})
add_installfiles("example.conf", {prefixdir= "$(prefix)/conf"})
add_installfiles("(foo/init.lua)", {prefixdir= "$(prefix)/lua"})
end
$ find .
lib/foo/bar.so
lua/foo/init.lua
conf/example.conf
doc/usage.md
Describe the solution you'd like
not directly load user's xmake.lua, we generate a xmake.lua and load it:
option("prefix")
do
set_default("XXX")
end
includes"/the/path/of/user's/xmake.lua"
Then user can use $(prefix) or more xmake variables in their xmake.lua.
Describe alternatives you've considered
Or xmake support directly pass options. xmake f -D prefix=XXX user's/xmake.lua. like cmake -D.
Additional context
Here is similar thought for python backend.
you can open a pr to add it.
build = {
type = "xmake",
variables = {
xmake = {
version = "2.5.1"
configs = { -- custom option configs
var1 = "xxx",
var2.= "yyy"
}
}
},
copy_directories = {}
}
and modify this.
https://github.com/xmake-io/luarocks-build-xmake/blob/d96dfc90ca27c2a6f73638815a52ee7de5e4abcd/src/xmake.lua#L499
local configs = xmake_variables.configs
for name, value in pairs(configs) do
-- ...
end