Skip to content

Add package descriptor for CLI11 library - #169

Merged
Sunrisepeak merged 2 commits into
mcpplibs:mainfrom
tz12323:main
Aug 6, 2026
Merged

Add package descriptor for CLI11 library#169
Sunrisepeak merged 2 commits into
mcpplibs:mainfrom
tz12323:main

Conversation

@tz12323

@tz12323 tz12323 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This file provides a package descriptor for the CLI11 library, detailing its specifications, dependencies, and source information.


Maintainer follow-up (c9d3cac) — 补齐收录流程剩下的部分,并修掉两处会让它构建不了 / lint 红的地方。设计文档:.agents/docs/2026-08-06-add-cli11-plan.md

修正

  • include_dirs = { "include" }{ "*/include" }mcpp 段里的路径都是相对 verdir 的 glob,前导 * 用来吸收 CLI11-2.7.2/ 这层 wrap 目录;原样的话消费者的 #include <CLI/CLI.hpp> 落不到任何目录。
  • language c++17 → c++23,与仓内其余 61 个描述符一致。它只作用于本包那个 anchor TU(CLI11 自身只要 C++11,消费者按自己声明的标准编头文件)。
  • CN 两个键原本复制的是 GLOBAL 的 github 地址。tests/check_mirror_urls.lua 要求 CN 必须在 gitcode.com/mcpp-res/ 之下,照原样 lint 是红的。

CN 镜像

新建 mcpp-res/cli11 并发布 2.7.2:

GLOBAL: https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.7.2.tar.gz
CN:     https://gitcode.com/mcpp-res/cli11/releases/download/2.7.2/cli11-2.7.2.tar.gz
sha256: 46eef3101da70852ec7af026e09d485ccee81813331c8c6052d39344443b83da

CN http=200,size=1446996,与 GLOBAL 字节一致。

测试(workspace 成员 tests/examples/cli11)

tests/parse.cpp 断言一次完整 parse(取值 / 默认值保持 / flag / 多值选项 / 子命令)与两条失败路径(未声明的选项抛 CLI::ParseErrorcheck(CLI::Range(1,10)) 越界抛 CLI::ValidationError),外加 CLI11_VERSION == "2.7.2" 和包自身的 anchor 符号 —— header-only 包的 lib target 里就只有那一个 TU,引用它才能证明包确实被编译并链接,而不是只有头文件被 include。

本地用 CI 同版本 mcpp 2026.8.6.1、清掉 target/.mcpp/ 冷启动:

 Downloading compat.CLI11 v2.7.2
   Compiling cli11-tests v0.1.0 (.)
   Compiling compat.CLI11 v2.7.2
   Compiling parse (test)
     Running bin/parse
parse ... ok (0.02s)

 test result ok. 1 passed; 0 failed; finished in 87.28s (build 3.06s + run 0.02s)

产出 obj 两个:obj/parse.oobj/compat_CLI11/mcpp_generated/cli11_anchor.o。lint 全套(含 mcpp xpkg parse 严格模式)本地复现通过。

不收的两个上游额外件

  • src/Precompile.cpp:只有当 CLI11_COMPILE 同时到达消费者的 TU 时才有意义 —— 那是 interface define,不是 sources 门控,feature 表达不了完整语义。
  • src/modules/CLI11.cppm:模块层是另一种包形态(参见 pkgs/n/nlohmann.json.lua),不是 compat 包的 feature。

因此本包没有 feature,也就没有需要做负向验证的门控。

tz12323 and others added 2 commits August 6, 2026 16:39
This file provides a package descriptor for the CLI11 library, detailing its specifications, dependencies, and source information.
描述符原样是构建不了的:`mcpp` 段里的路径都是相对 verdir 的 glob,
`include_dirs = { "include" }` 少了吸收 `CLI11-2.7.2/` wrap 层的前导 `*`,
消费者的 `#include <CLI/CLI.hpp>` 落不到任何目录 —— 改成 `*/include`。
`language` 跟仓内其余 61 个描述符一起用 c++23(它只作用于本包那个 anchor TU,
CLI11 自身只要 C++11,消费者按自己声明的标准编头文件)。

CN 那两个键原本复制的是 GLOBAL 的 github 地址,lint(check_mirror_urls.lua)
要求 CN 必须在 gitcode mcpp-res 之下,照原样是红的。现建 mcpp-res/cli11 并
发布 2.7.2:CN http=200,与 GLOBAL 字节一致(sha256 46eef310…)。

成员 tests/examples/cli11 断言一次完整 parse(取值/默认值/flag/多值/子命令)
与两条失败路径(未声明选项抛 ParseError、Range 越界抛 ValidationError),
外加 CLI11_VERSION 与包自身的 anchor 符号 —— header-only 包的 lib 里就这一个
TU,引用它才能证明包真的被编译并链接,而不是只有头文件被 include。

本地(CI 同版本 mcpp 2026.8.6.1、冷启动)`mcpp test -p cli11` 通过,
两个 obj:parse.o 与 compat_CLI11/mcpp_generated/cli11_anchor.o。
lint 全套(含 mcpp xpkg parse)本地复现通过。
@Sunrisepeak
Sunrisepeak merged commit 424c323 into mcpplibs:main Aug 6, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants