feat(pkgs): add compat.spdlog 1.17.0 (header-only + declarative compi…#72
Merged
Conversation
…led feature) spdlog is dual-modal: default header-only (self-contained via bundled fmt in FMT_HEADER_ONLY mode, no external fmt dep) and a precompiled mode gated on SPDLOG_COMPILED_LIB. The `compiled` feature declares the correct intent (sources = src/*.cpp + the SPDLOG_COMPILED_LIB interface define), but mcpp 0.0.91 does not yet compile a dependency's feature-gated sources — verified three ways (this package, compat.cjson's utils, compat.eigen's eigen_blas all leave feature sources uncompiled → link-time undefined reference). The feature's `defines` DO propagate to the consumer. So CI asserts the fully-working header-only mode; the compiled feature works unchanged once the engine links feature sources (same follow-up as eigen_blas). No CN mirror (no mcpp-res write access): plain-string upstream url per the docs/cn-mirror.md fallback (tensorvia-cpu precedent). Verified on mcpp 0.0.91 (GLOBAL): xpkg parse OK, `mcpp test -p spdlog` passes.
初版把「feature sources 不编译」判为引擎级限制,是**误判**:该 bug 只影响 `mcpp test` 路径,`mcpp build` 一直是好的(7 个 src TU 全进 build.ninja、 二进制真跑)。三重佐证(spdlog/cjson/eigen)现象属实,但三次都只走了 test 一条路径 —— 本仓 CI 是 workspace/test 模型。 真因(mcpp/src/build/prepare.cppm):feature 源集解析被整段门在 `!includeDevDeps`,test 模式跳过 → 激活 feature 的 sources 从不加回构建图; 叠加 xpkg 的 `features.X.sources` 只落进 featureSources、从不进 base sources。 已由 mcpp#218 修复并发布 0.0.94(drop 仍只在 build 模式,add 两模式都做+去重)。 - 描述符 Lua **一行未改** —— `compiled` feature 的建模本来就是对的; 只把注释从「引擎不支持、请用 header-only」改为如实的「test 下需 ≥0.0.94」。 - 新增 workspace 成员 `tests/examples/spdlog-compiled/`:**compiled 模态进 CI**。 静态断言 SPDLOG_COMPILED_LIB 已定义 + SPDLOG_HEADER_ONLY 未定义(退化回 inline 路径是编译错误而非静默通过),再跑行为断言 —— 调用解析到 default_logger_raw / log_msg ctor / logger::log_it_ / bundled fmt vformat 等非 inline 符号,正是 feature sources 没编译时链不上的那批。 - CI pin 0.0.91 → 0.0.94;index floor `min_mcpp` 不动(它追踪描述符**语法**, 本描述符在 0.0.87 上就能解析;header-only 模态任何版本都可用)。 - 修 `tests/examples/spdlog/mcpp.toml` 里 `pkgs/s/` 陈旧路径 → `pkgs/c/`。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
形态
header-only + source-gated feature(与
compat.eigen同类)。spdlog 双模态:FMT_HEADER_ONLY,无需外部 fmt 依赖。common.h在未定义SPDLOG_COMPILED_LIB时打开SPDLOG_HEADER_ONLY,头文件末尾#include "*-inl.h"把实现内联。compiledfeature 声明sources = {"*/src/*.cpp"}+SPDLOG_COMPILED_LIBinterface define(该宏须同时到达库源与消费者头)。mcpp 0.0.91 引擎限制(如实记录)
依赖包被激活 feature 的
sources当前不编译,三重佐证:compiledsrc/*.cpp未编译 → 大量undefined referencecompat.cjsonutilscJSON_Utils.c未编译 →undefined reference to cJSONUtils_*compat.eigeneigen_blasblas/*.cpp未编译 →undefined reference to dgemm_feature 的
defines确实传播到消费者(实测-DSPDLOG_COMPILED_LIB出现在消费者TU 编译行)。故本 PR 的 CI 只断言 header-only 模态;
compiledfeature 待引擎支持"编译并链接 feature sources"后无需改描述符即可生效(与
eigen_blas同一 follow-up)。feature 评估
未为
tweakme.h的编译期开关(SPDLOG_USE_STD_FORMAT、SPDLOG_NO_SOURCE_LOC等)新增 feature:header-only 模态下 spdlog 全在头文件里随消费者 TU 编译,消费者可在自己的
mcpp.toml用defines/cxxflags直接注入(更灵活,还能带值),做成 feature 属冗余。唯一"消费者
-D够不着、必须包侧统一注入"的是SPDLOG_COMPILED_LIB,已由compiledfeature 承载。详见设计文档。
CN 镜像
无
mcpp-res写权限(本环境无 gitcode token),按docs/cn-mirror.md回退方案:三平台
url用纯字符串上游 GitHub release,lint 对纯字符串 url 不施加镜像约束。先例:
pkgs/t/tensorvia-cpu.lua。后续可由维护者补充{ GLOBAL, CN }镜像表(sha256 不变)。验证(mcpp 0.0.91,GLOBAL)
mcpp xpkg parse pkgs/c/compat.spdlog.lua→parse OK(strict floor/grammar)mcpp test -p spdlog→test result ok. 1 passedALL LINT PASSspdlog_anchor.o(src 未默认编入);compiled 请求时消费者带
-DSPDLOG_COMPILED_LIB(define 门控生效)设计文档:
.agents/docs/2026-07-15-add-spdlog-plan.mdTest plan
lint通过workspace(linux/macos/windows) 的 spdlog 成员通过mirror-cn-reachable通过(spdlog 无需校验的 CN url)