Introduction (中文)
A fork of built-in build system for C++ rocks. Specify "xmake" as build type and "luarocks-build-xmake" as dependency to use it.
About xmake, please see xmake.
We can build c/c++ modules if the project contain xmake.lua
├── src
│ ├── test.c
│ └── test.h
└── xmake.lua
We need to use add_rules("luarocks.module")
to add build rules for luarocks modules.
add_rules("mode.debug", "mode.release")
target("example1.hello")
add_rules("luarocks.module")
add_files("src/test.c")
package = "example1"
version = "1.0-1"
source = {
url = "git://github.com/xmake-io/luarocks-build-xmake",
tag = "example1"
}
dependencies = {
"lua >= 5.1",
"luarocks-build-xmake"
}
build = {
type = "xmake",
copy_directories = {}
}
We can use xmake as builtin build type to build c/c++ modules if the project does not contain xmake.lua
├── src
├── test.c
└── test.h
package = "example2"
version = "1.0-1"
source = {
url = "git://github.com/xmake-io/luarocks-build-xmake",
tag = "example2"
}
dependencies = {
"lua >= 5.1",
"luarocks-build-xmake"
}
build = {
type = "xmake",
modules = {
["example2.hello"] = {
sources = "src/test.c"
}
},
copy_directories = {}
}
dependencies = {
"lua >= 5.1",
"luarocks-build-xmake"
}
build = {
type = "xmake",
variables = {
xmake = {
version = "2.5.1"
}
},
copy_directories = {}
}
dependencies = {
"lua >= 5.1",
"luarocks-build-xmake"
}
build = {
type = "xmake",
variables = {
xmake = {
plat = "mingw",
arch = "x86_64",
mode = "debug",
cflags = "-DTEST1",
cc = "gcc",
ld = "gcc",
ldflags = "...",
mingw = "mingw sdk path",
vs = "2019",
vs_runtime = "MT",
vs_toolset = "",
vs_sdkver = "",
}
},
copy_directories = {}
}