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/boost-config",
"tests/examples/boost-ext.ut",
"tests/examples/boost-family",
"tests/examples/boost-module",
"tests/examples/boost-throw-exception",
"tests/examples/boost-type-traits",
"tests/examples/boost-uuid",
Expand Down
46 changes: 46 additions & 0 deletions pkgs/z/ZheFeng7110.boost.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- Form A descriptor: boost-module ships its own mcpp.toml at the archive root,
-- and that manifest IS the build. The `mcpp` field therefore points at it
-- rather than inlining a Form B descriptor, because the package needs things an
-- inline descriptor cannot express: a build.mcpp umbrella generator, the
-- vendored Boost source tree (deps/boost/), and the committed generator output
-- under src/gen_exports/.
--
-- Version naming is upstream's wrapper scheme `v<boost version>.<wrapper
-- version>` (this release is Boost 1.91.0 x modules wrapper 0.1.0). Upstream
-- tags are bare semver, so the xpm key carries that string verbatim.
--
-- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL
-- url is the documented fallback for CN consumers until a maintainer creates
-- the mirror.
package = {
spec = "1",
namespace = "ZheFeng7110",
name = "boost",
description = "Boost 1.91.0 as C++23 named modules — import boost.<lib>; or the umbrella import boost;",
licenses = {"BSL-1.0"},
repo = "https://github.com/ZheFeng7110/boost-module",
type = "package",

xpm = {
linux = {
["1.91.0.0.1.0"] = {
url = "https://github.com/ZheFeng7110/boost-module/releases/download/v1.91.0.0.1.0/boost-module-v1.91.0.0.1.0.tar.xz",
sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010",
},
},
macosx = {
["1.91.0.0.1.0"] = {
url = "https://github.com/ZheFeng7110/boost-module/releases/download/v1.91.0.0.1.0/boost-module-v1.91.0.0.1.0.tar.xz",
sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010",
},
},
windows = {
["1.91.0.0.1.0"] = {
url = "https://github.com/ZheFeng7110/boost-module/releases/download/v1.91.0.0.1.0/boost-module-v1.91.0.0.1.0.tar.xz",
sha256 = "63a9aae63140f22e518a4ee758332afd5b5037d916731dc9c8339dea1a1e1010",
},
},
},

mcpp = "*/mcpp.toml",
}
25 changes: 25 additions & 0 deletions tests/examples/boost-module/mcpp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# boost.boost C++23-module package test: selective feature consumption of the
# Boost named-modules wrapper — `import boost.optional;` plus the umbrella
# `import boost;`. The package is Form A (upstream ships its own mcpp.toml), so
# this member is also the only place the descriptor's `mcpp = "*/mcpp.toml"`
# default lookup is exercised.
#
# Overrides the workspace-root redirect: root declares `compat`, this member
# needs `ZheFeng7110`. The table is keyed by NAMESPACE, so the key must be the
# dependency's namespace (`ZheFeng7110`), not the package name (`boost`). A
# member-level [indices] REPLACES the inherited table rather than merging with
# it, which keeps this to ONE project index repo — two repos pointing at the
# same tree make every lookup ambiguous.
[indices]
ZheFeng7110 = { path = "../../.." }

[package]
name = "boost-module-tests"
version = "0.1.0"

# Selective, NOT the package's 49-library default closure: opt out of the
# default set and pick a core sample (header-only optional/type_traits, the
# compiled json, and the version constants). This keeps index CI on the
# validated module surface without building the whole wrapper.
[dependencies.ZheFeng7110]
boost = { version = "1.91.0.0.1.0", default-features = false, features = ["optional", "type_traits", "json", "version"] }
55 changes: 55 additions & 0 deletions tests/examples/boost-module/tests/boost_module.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Public boost.boost module-package end-to-end assertion: consume the Boost
// named-modules wrapper by import only (no `#include <boost/...>` at all).
//
// * `import boost.optional;` — a classic header-only library
// * `import boost.json;` — a compiled library (library TU linked in)
// * `import boost.version;` — the version constants module
// * `import boost;` — the umbrella, re-exporting the active set

import std;

import boost.optional;
import boost.json;
import boost.version;
import boost;

int main() {
int failures = 0;
auto check = [&failures](bool ok, const char* what) {
if (!ok) {
std::println("FAIL: {}", what);
++failures;
}
};

// optional (header-only module)
boost::optional<int> empty;
check(!empty.has_value(), "optional: empty has no value");
boost::optional<int> v(42);
check(v.has_value() && *v == 42, "optional: value round-trip");
check(v.value_or(0) == 42, "optional: value_or hits the value");
empty = 7;
check(empty.value_or(0) == 7, "optional: assignment activates");

// json (compiled library)
boost::json::value j = boost::json::parse(R"({"lib":"boost","ok":true})");
check(j.is_object(), "json: parsed to an object");
boost::json::object& o = j.as_object();
check(o["lib"].as_string() == "boost", "json: string member");
check(o["ok"].as_bool(), "json: bool member");
const std::string ser = boost::json::serialize(j);
check(boost::json::parse(ser).as_object()["lib"].as_string() == "boost",
"json: serialize/parse round-trip");

// version constants
check(boost::BOOST_VERSION == 109100, "version: BOOST_VERSION == 109100");
check(boost::BOOST_LIB_VERSION[0] == '1', "version: BOOST_LIB_VERSION");

// type_traits (reached through the umbrella's active set as well)
check(boost::is_same<int, int>::value, "type_traits: is_same");

if (failures == 0) {
std::println("boost.boost modules ok: BOOST_VERSION={}", boost::BOOST_VERSION);
}
return failures == 0 ? 0 : 1;
}
Loading