Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xmake-io/luarocks-build-xmake

A luarocks build module based on xmake
https://github.com/xmake-io/luarocks-build-xmake

cplusplus lua luarocks makefile xmake

Last synced: about 1 month ago
JSON representation

A luarocks build module based on xmake

Awesome Lists containing this project

README

        




luarocks-build-xmake



github-ci


github-ci


github-ci




Reddit


Gitter


Telegram


QQ


Discord


license


Donate

A luarocks build module based on xmake


## Introduction ([中文](/README_zh.md))

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](https://github.com/xmake-io/xmake).

## Example1 (with xmake.lua)

We can build c/c++ modules if the project contain xmake.lua

```
├── src
│   ├── test.c
│   └── test.h
└── xmake.lua
```

#### xmake.lua

We need to use `add_rules("luarocks.module")` to add build rules for luarocks modules.

```lua
add_rules("mode.debug", "mode.release")

target("example1.hello")
add_rules("luarocks.module")
add_files("src/test.c")
```

#### rockspec

```lua
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 = {}
}
```

## Example2 (without xmake.lua)

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
```

#### rockspec

```lua
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 = {}
}
```

## Set special xmake version

```lua
dependencies = {
"lua >= 5.1",
"luarocks-build-xmake"
}
build = {
type = "xmake",
variables = {
xmake = {
version = "2.5.1"
}
},
copy_directories = {}
}
```

## Set xmake compilation configuration

```lua
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 = {}
}
```