Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ members = [
"tests/examples/catch2-main",
"tests/examples/catch2-v2",
"tests/examples/catch2-v2-main",
"tests/examples/capi-lua",
"tests/examples/cjson",
"tests/examples/cmdline",
"tests/examples/cli11",
Expand Down
22 changes: 19 additions & 3 deletions pkgs/m/mcpplibs.capi.lua.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Form A descriptor: the upstream repo ships its own mcpp.toml from
-- 0.0.3 onwards, so we omit the `mcpp` field — mcpp default-look-up
-- finds <verdir>/lua-<tag>/mcpp.toml inside the GitHub tarball wrap.
-- Form B descriptor for the immutable 0.0.3 payload. Its upstream
-- mcpp.toml predates exact package selectors and declares bare `lua`, which
-- now means `(mcpplibs, lua)` and cannot identify the real C library at
-- `(compat, lua)`. Keep the release bytes unchanged and carry the canonical
-- dependency here until a newer upstream release can return to Form A.
package = {
spec = "1",
namespace = "mcpplibs.capi",
Expand Down Expand Up @@ -39,4 +41,18 @@ package = {
},
},
},

mcpp = {
schema = "0.1",
language = "c++23",
import_std = false,
modules = { "mcpplibs.capi.lua" },
include_dirs = { "*/src/capi" },
sources = {
"*/src/capi/lua.cppm",
"*/src/capi/lua.cpp",
},
targets = { ["capi-lua"] = { kind = "lib" } },
deps = { ["compat.lua"] = "5.4.7" },
},
}
9 changes: 9 additions & 0 deletions tests/examples/capi-lua/mcpp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[indices]
"mcpplibs.capi" = { path = "../../.." }

[package]
name = "capi-lua-tests"
version = "0.1.0"

[dependencies.mcpplibs]
capi.lua = "0.0.3"
13 changes: 13 additions & 0 deletions tests/examples/capi-lua/tests/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import mcpplibs.capi.lua;

namespace lua = mcpplibs::capi::lua;

int main() {
auto* state = lua::L_newstate();
if (state == nullptr) return 1;

const int status = lua::L_dostring(state, "return 6 * 7");
const auto answer = lua::tointeger(state, -1);
lua::close(state);
return status == lua::OK && answer == 42 ? 0 : 1;
}
Loading