Skip to content

Commit 45f0564

Browse files
committed
Add boost.boost package from https://github.com/ZheFeng7110/boost-module
1 parent 049ac18 commit 45f0564

4 files changed

Lines changed: 125 additions & 0 deletions

File tree

‎mcpp.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ members = [
1818
"tests/examples/boost-config",
1919
"tests/examples/boost-ext.ut",
2020
"tests/examples/boost-family",
21+
"tests/examples/boost-module",
2122
"tests/examples/boost-throw-exception",
2223
"tests/examples/boost-type-traits",
2324
"tests/examples/boost-uuid",

‎pkgs/b/boost.lua‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
-- Form A descriptor: boost-module ships its own mcpp.toml at the archive root,
2+
-- and that manifest IS the build. The `mcpp` field therefore points at it
3+
-- rather than inlining a Form B descriptor, because the package needs things an
4+
-- inline descriptor cannot express: a build.mcpp umbrella generator, the
5+
-- vendored Boost source tree (deps/boost/), and the committed generator output
6+
-- under src/gen_exports/.
7+
--
8+
-- Version naming is upstream's wrapper scheme `b<boost version>w<wrapper
9+
-- version>` (this release is Boost 1.91.0 x modules wrapper 0.0.0). Upstream
10+
-- tags are not bare semver, so the xpm key carries that string verbatim.
11+
--
12+
-- No mcpp-res mirror is configured yet (no CN access): the plain-string GLOBAL
13+
-- url is the documented fallback for CN consumers until a maintainer creates
14+
-- the mirror.
15+
package = {
16+
spec = "1",
17+
namespace = "boost",
18+
name = "boost",
19+
description = "Boost 1.91.0 as C++23 named modules — import boost.<lib>; or the umbrella import boost;",
20+
licenses = {"BSL-1.0"},
21+
repo = "https://github.com/ZheFeng7110/boost-module",
22+
type = "package",
23+
24+
xpm = {
25+
linux = {
26+
["b1.91.0w0.0.0"] = {
27+
url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz",
28+
sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7",
29+
},
30+
},
31+
macosx = {
32+
["b1.91.0w0.0.0"] = {
33+
url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz",
34+
sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7",
35+
},
36+
},
37+
windows = {
38+
["b1.91.0w0.0.0"] = {
39+
url = "https://github.com/ZheFeng7110/boost-module/archive/refs/tags/b1.91.0w0.0.0.tar.gz",
40+
sha256 = "7b6434d67383a8598f41bfd563eabb2be7ee23578cc7a65094ff6926c3d23df7",
41+
},
42+
},
43+
},
44+
45+
mcpp = "*/mcpp.toml",
46+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# boost.boost C++23-module package test: selective feature consumption of the
2+
# Boost named-modules wrapper — `import boost.optional;` plus the umbrella
3+
# `import boost;`. The package is Form A (upstream ships its own mcpp.toml), so
4+
# this member is also the only place the descriptor's `mcpp = "*/mcpp.toml"`
5+
# default lookup is exercised.
6+
#
7+
# Overrides the workspace-root redirect: root declares `compat`, this member
8+
# needs `boost`. A member-level [indices] REPLACES the inherited table rather
9+
# than merging with it, which keeps this to ONE project index repo — two repos
10+
# pointing at the same tree make every lookup ambiguous.
11+
[indices]
12+
boost = { path = "../../.." }
13+
14+
[package]
15+
name = "boost-module-tests"
16+
version = "0.1.0"
17+
18+
# Selective, NOT the package's 49-library default closure: opt out of the
19+
# default set and pick a core sample (header-only optional/type_traits, the
20+
# compiled json, and the version constants). This keeps index CI on the
21+
# validated module surface without building the whole wrapper.
22+
[dependencies.boost]
23+
boost = { version = "b1.91.0w0.0.0", default-features = false, features = ["optional", "type_traits", "json", "version"] }
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Public boost.boost module-package end-to-end assertion: consume the Boost
2+
// named-modules wrapper by import only (no `#include <boost/...>` at all).
3+
//
4+
// * `import boost.optional;` — a classic header-only library
5+
// * `import boost.json;` — a compiled library (library TU linked in)
6+
// * `import boost.version;` — the version constants module
7+
// * `import boost;` — the umbrella, re-exporting the active set
8+
9+
import std;
10+
11+
import boost.optional;
12+
import boost.json;
13+
import boost.version;
14+
import boost;
15+
16+
int main() {
17+
int failures = 0;
18+
auto check = [&failures](bool ok, const char* what) {
19+
if (!ok) {
20+
std::println("FAIL: {}", what);
21+
++failures;
22+
}
23+
};
24+
25+
// optional (header-only module)
26+
boost::optional<int> empty;
27+
check(!empty.has_value(), "optional: empty has no value");
28+
boost::optional<int> v(42);
29+
check(v.has_value() && *v == 42, "optional: value round-trip");
30+
check(v.value_or(0) == 42, "optional: value_or hits the value");
31+
empty = 7;
32+
check(empty.value_or(0) == 7, "optional: assignment activates");
33+
34+
// json (compiled library)
35+
boost::json::value j = boost::json::parse(R"({"lib":"boost","ok":true})");
36+
check(j.is_object(), "json: parsed to an object");
37+
boost::json::object& o = j.as_object();
38+
check(o["lib"].as_string() == "boost", "json: string member");
39+
check(o["ok"].as_bool(), "json: bool member");
40+
const std::string ser = boost::json::serialize(j);
41+
check(boost::json::parse(ser).as_object()["lib"].as_string() == "boost",
42+
"json: serialize/parse round-trip");
43+
44+
// version constants
45+
check(boost::BOOST_VERSION == 109100, "version: BOOST_VERSION == 109100");
46+
check(boost::BOOST_LIB_VERSION[0] == '1', "version: BOOST_LIB_VERSION");
47+
48+
// type_traits (reached through the umbrella's active set as well)
49+
check(boost::is_same<int, int>::value, "type_traits: is_same");
50+
51+
if (failures == 0) {
52+
std::println("boost.boost modules ok: BOOST_VERSION={}", boost::BOOST_VERSION);
53+
}
54+
return failures == 0 ? 0 : 1;
55+
}

0 commit comments

Comments
 (0)