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
26 changes: 13 additions & 13 deletions .agents/docs/2026-11-20-add-slint-mwrap-plan.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 实施方案:Slint 进入 mcpp 生态(compat.slint + mcpplibs.mwrap.slint + 构建规则 slint.mcpp.plugins)
# 实施方案:Slint 进入 mcpp 生态(compat.slint + mcpplibs.mwrap.slint + 构建规则 mcpp.mcpplibs.slintgen)

状态:已按维护者决定修订(2026-11-20):规则放入 slint-m,模块名 `slint.mcpp.plugins`(`slint.mcpp.plugins` 被索引的 R9.6 收录门拒绝,见 §1 修订记录)。上游版本:Slint 1.19.0(2026-11-16)。
状态:已按维护者决定修订(2026-11-20):规则放入 slint-m,模块名 `mcpp.mcpplibs.slintgen`(`mcpp.mcpplibs.slintgen` 被索引的 R9.6 收录门拒绝,见 §1 修订记录)。上游版本:Slint 1.19.0(2026-11-16)。
本文的事实均为实测或读源码所得,出处写在各条之后;未验证的部分列在 §9。

## 0. 目标
Expand All @@ -11,7 +11,7 @@
|---|---|
| `find_package(Slint)` + 预构建 SDK | `compat.slint` 的预构建档位(xlings-res,GitHub + GitCode) |
| `FetchContent(... SOURCE_SUBDIR api/cpp)` + `SLINT_FEATURE_*` | `compat.slint` 的同名 feature;未预构建的组合走源码构建(cargo,§4.3) |
| `slint_target_sources(...)` 与目标属性 | 构建规则 `slint.mcpp.plugins`(包 `mcpplibs.slintgen`,slint-m 的 `rules/`,§5) |
| `slint_target_sources(...)` 与目标属性 | 构建规则 `mcpp.mcpplibs.slintgen`(包 `mcpplibs.slintgen`,slint-m 的 `rules/`,§5) |
| `#include "app.h"` | 同上,另可 `import` 生成的组件模块(§5.3) |
| — | `import mcpplibs.mwrap.slint;`(§6) |

Expand All @@ -21,14 +21,14 @@
|---|---|---|
| 上游库原样构建 | `compat.<名>` | `compat.slint` |
| 通用 C++ 库的模块封装 | `mcpplibs.mwrap.<名>`(docs/mwrap.md) | `mcpplibs.mwrap.slint`,仓库 `mcpplibs/slint-m` |
| mcpp 专用构建插件(导入引擎接口 `mcpp`) | 通常 `mcpp.<命名空间>.*`(R9.6);保留的第二段只属于命名空间为 `mcpp` 的包 | 包 `mcpplibs.slintgen`(slint-m 的 `rules/`,与 grpc-m 的 `grpcgen` 同形),模块 `slint.mcpp.plugins` |
| mcpp 专用构建插件(导入引擎接口 `mcpp`) | 通常 `mcpp.<命名空间>.*`(R9.6);保留的第二段只属于命名空间为 `mcpp` 的包 | 包 `mcpplibs.slintgen`(slint-m 的 `rules/`,与 grpc-m 的 `grpcgen` 同形),模块 `mcpp.mcpplibs.slintgen` |

**修订记录。** 初版把规则放进官方插件包 `mcpp.plugins`(feature `rules-slint`,模块 `mcpp.rules.slint`),依据是 `rules-qt`
等先例与 R9.6。维护者决定改为放入 slint-m、模块名 `slint.mcpp.plugins`(mcpp-plugins#64 已不合入关闭)。代价已核实:
等先例与 R9.6。维护者决定改为放入 slint-m、模块名 `mcpp.mcpplibs.slintgen`(mcpp-plugins#64 已不合入关闭)。代价已核实:
(1) 实测:`mcpp.plugins.slint` 由命名空间不是 `mcpp` 的包提供,引擎每次构建警告,而索引的成员门(tests/run_members.sh)
拒绝此类包,mcpp-index#861 因此失败;维护者改定模块名为 `slint.mcpp.plugins`(不以 `mcpp.` 起头,不受 R9.6 约束),
以修订号 1.19.0.1 发布(mwrap-1.19.0 已打标签、未收录);(2) `device_extensions` 的认领不经 `reexport` 传递,所以工程须自己在
`[build-dependencies]` 写 `mcpplibs.slintgen = { …, features = ["slint"] }`,slint-m 不再 reexport 规则;
拒绝此类包,mcpp-index#861 因此失败;维护者先改为 `slint.mcpp.plugins`(1.19.0.1),随后统一为同形的一个名字的三种拼写(1.19.0.2):包 `mcpplibs.slintgen`、
模块 `mcpp.mcpplibs.slintgen`、命名空间 `mcpp::mcpplibs::slintgen`(与 openkal-bind 同形,R9.6 的第三方写法);mwrap-1.19.0 已打标签、未收录;(2) `device_extensions` 的认领不经 `reexport` 传递,故规则不带 feature:`.slint` 以 `options::sources` 传入,slint-m reexport
规则(grpcgen 的形态),工程只依赖 `mcpplibs.mwrap.slint`;
(3) 规则对 `mcpp.plugins`(feature `plugins-core`)的依赖写在规则包自己的 `[dependencies]`(mcpp 2026.10.11.1+ 形态)。

规则不声明 SDK、不固定版本(与 `rules-qt` 相同):`slint-compiler` 与运行时出自同一个 SDK,版本一致由载荷保证。
Expand Down Expand Up @@ -76,7 +76,7 @@ xlings-res(GitHub + GitCode)
slint-vendor/<ver>/slint-<ver>-vendor.tar.zst cargo vendor(源码构建离线依赖)
skia-binaries/<key>/... rust-skia 预构建的逐字节镜像
mcpplibs/slint-m
src/*.cppm include/mwrap/slint/macros.hpp rules/(slintgen,模块 slint.mcpp.plugins) templates/hello tests tools
src/*.cppm include/mwrap/slint/macros.hpp rules/(slintgen,模块 mcpp.mcpplibs.slintgen) templates/hello tests tools
```

## 4. compat.slint
Expand Down Expand Up @@ -115,7 +115,7 @@ feature 名与上游 cargo 功能名逐一相同(kebab-case,与 mwrap 规范
(如 `mcpp:slint-runtime`)互斥,`mcpplibs.mwrap.slint` 的 feature 经 `feature-deps` 选择提供者;或单一包内由
install / build 程序按功能集选择载荷。以 S2 的实测结果定稿。

## 5. 构建规则 slint.mcpp.plugins(slint-m 的 rules/)
## 5. 构建规则 mcpp.mcpplibs.slintgen(slint-m 的 rules/)

### 5.1 形态

Expand All @@ -126,7 +126,7 @@ mcpp.plugins = { version = "0.26.1", features = ["plugins-core"] }

[features.slint]
sources = ["src/slint.cppm"]
rule_module = "slint.mcpp.plugins"
rule_module = "mcpp.mcpplibs.slintgen"
device_extensions = [".slint"]
```
与 `rules-qt` 相同:不声明 SDK、不固定版本。`slint-compiler` 的来源按序:`options::compiler`;环境变量 `SLINT_COMPILER`;
Expand Down Expand Up @@ -165,7 +165,7 @@ device_extensions = [".slint"]
- GCC 16 与 `.platform`:先以最小复现报告上游(lambda 位于 requires 子句);在修复前 `.platform` 在 GCC 上以文本
`#include <slint-platform.h>`(在 import 之前,规范已有此写法)提供,Clang 上导出;README 写明。
- feature:与 compat.slint 同名转发;`slint-compiler` 经 compat.slint 的 `reexport` 到达使用方的构建程序;规则包
`mcpplibs.slintgen` 由使用方在 `[build-dependencies]` 写 `features = ["slint"]`(见 §1 修订记录)。
`mcpplibs.slintgen`(模块 `mcpp.mcpplibs.slintgen`)由封装包 reexport,使用方只依赖 `mcpplibs.mwrap.slint`(见 §1 修订记录)。
- 模板 `hello`(默认):计数器窗口;CI 中以软件渲染无头平台运行并断言;有桌面时开窗。
- 许可:上游三选一(GPL-3.0-only / Royalty-free-2.0 / 商业),描述符列出三者,README 写明由使用方选择、Royalty-free
不含嵌入式;封装层 Apache-2.0。
Expand All @@ -175,7 +175,7 @@ device_extensions = [".slint"]
| 阶段 | 交付 | 验收 |
|---|---|---|
| 0(实测) | S1–S3(§9) | 结论写回本文 |
| 1 | xlings-res `slint` 的 `default` 档(4 平台,GLOBAL + CN);compat.slint 1.19.0(default 档,feature 与上游同名);`slint.mcpp.plugins`;slint-m(核心、`.interpreter`、`.platform`、`.macros`)与 `hello` 模板 | Linux(gcc/llvm)、Linux arm64、macOS、Windows 的 CI:模板严格构建并无头运行;规则的增量测试;运行时依赖闭包只含声明的提供者;导出审计 |
| 1 | xlings-res `slint` 的 `default` 档(4 平台,GLOBAL + CN);compat.slint 1.19.0(default 档,feature 与上游同名);`mcpp.mcpplibs.slintgen`;slint-m(核心、`.interpreter`、`.platform`、`.macros`)与 `hello` 模板 | Linux(gcc/llvm)、Linux arm64、macOS、Windows 的 CI:模板严格构建并无头运行;规则的增量测试;运行时依赖闭包只含声明的提供者;导出审计 |
| 2 | `slint-vendor` 载荷;源码构建路径(任意功能组合) | 一个非档位组合(如 `default` + `gettext`)冷构建与二次缓存命中 |
| 3 | `skia-binaries` 镜像;`full` 档;`renderer-skia*` | CN 镜像下无 GitHub 访问构建成功;Skia 渲染无头截图比对 |
| 4 | linuxkms(compat.libinput soname)、Android / iOS / wasm / MCU 行、`backend-qt`、`gettext` | 各平台行的模板构建;KMS 以无显示设备的冒烟测试 |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ jobs:
shell: bash
env:
SLINT_HEADLESS: "1"
run: python3 tests/mwrap/check_installed_template.py --mcpp "$MCPP" --package mcpplibs.mwrap.slint@1.19.0.1 --deploy
run: python3 tests/mwrap/check_installed_template.py --mcpp "$MCPP" --package mcpplibs.mwrap.slint@1.19.0.2 --deploy

- name: Installed Wuffs wrapper archive, actual default decode template and its relocated notices
if: contains(format(' {0} ', env.MEMBERS), ' wuffs-decode ') && matrix.toolchain == 'default'
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Added

- **mcpplibs.mwrap.slint 1.19.0.2 与 mcpplibs.slintgen 1.19.0.2:规则的三个名字合为一个名字的三种拼写,使用方只依赖封装包。** 包 `mcpplibs.slintgen`、模块 `mcpp.mcpplibs.slintgen`、命名空间 `mcpp::mcpplibs::slintgen`(与 mcpplibs.openkal-bind 同形,SPEC-007 R9.6);规则不再带 feature,`.slint` 文件是 `options::sources`,封装包 reexport 规则与 SDK,工程的 `mcpp.toml` 只需 `mcpplibs.mwrap.slint`,不需要 `[build-dependencies]`,`[build] sources` 里也不再列 `.slint`。1.19.0.1(模块 `slint.mcpp.plugins` 加 `features = ["slint"]`)保持已发布的字节。
- **mcpplibs.mwrap.slint 1.19.0.1:slint-m,Slint 作为 C++23 模块;mcpplibs.slintgen 1.19.0.1:构建规则,模块 `slint.mcpp.plugins`。** 模块 `mcpplibs.mwrap.slint`(slint、slint::language)、`.interpreter`、`.platform`(仅 Clang;GCC 16 在包着 `slint-platform.h` 的模块上 ICE,故以文本 `#include` 提供)与 `.macros`(13 个 `SLINT_FEATURE_*` 常量),导出面由 SDK 头文件的 AST 生成并审计;链接 compat.slint 1.19.0。规则包 slintgen(同一归档的 `rules/`,与 grpcgen 同形)为每个 `.slint` 文件运行 `slint-compiler`(上游 `slint_target_sources` 的选项、每个输入一条带 depfile 的 action),设置 `module` 后每个文件还生成一个模块单元(`import app.ui;`);工程在 `[build-dependencies]` 写 `features = ["slint"]` 以认领 `.slint`。模块以库名命名而不用 `mcpp.plugins.*`(R9.6 把它留给 mcpp 命名空间,索引不收录此类包);1.19.0 已打标签与镜像但未收录,改名以修订号 1.19.0.1 发布。成员 tests/mwrap/slint-ui;默认模板 `hello`(无头时用软件渲染器)。Linux x86_64、macOS arm64、Windows x86_64(compat.slint 的载荷暂无 Linux aarch64)。
- **compat.slint 1.19.0:Slint 的 C++ SDK(`libslint_cpp`、头文件 `slint/`、`slint-compiler`),上游 CMake 的桌面默认功能集(GPL-3.0-only / Royalty-free-2.0 / Software-3.0 三选一)。** 载荷是生态里的 `xim:slint`(xlings-res/slint,GitHub 与 GitCode 逐字节相同;Linux x86_64、macOS arm64、Windows x86_64),由发布 tag 经 cargo 按默认功能集构建:Linux 上 `libslint_cpp` 只 NEEDED fontconfig 与 C 运行时(X11、Wayland、GL 均 dlopen)。描述符把载荷的 include、lib(Windows 为 bin 的 DLL)与 `slint-compiler` 放进包的目录,`SLINT_FEATURE_*` 由 `<slint.h>` 的默认功能集定义。成员 tests/examples/slint:SharedString、VectorModel、Color,解释器编译一段源码并在无头平台上驱动组件。Linux aarch64 暂缺:`xim:fontconfig` 尚无 aarch64 载荷。
- **mcpplibs.mwrap.wuffs 0.3.6:wuffs-m(Wuffs 的 C++23 模块),基于 compat.wuffs 0.3.6。** 每个上游包一个模块(`.base`、`.png`、`.gif`、`.json`、`.gzip` 等 16 个)、`.aux`(`wuffs_aux`)与 `.macros`;由 clang AST 生成并审计:429 个全局名导出,315 个 `static inline` 函数在 `mcpplibs::mwrap::wuffs` 中同名同签名适配,296 个宏常量与 34 个函数名宏映射,11 个附原因列出。上游 `convert-to-nia` 的模块移植版与上游程序在 `test/data` 的 246 个文件上逐字节一致,82/82 个 NIA 校验和一致。成员 tests/mwrap/wuffs-decode;validate.yml 以真实归档做已安装模板与部署通知检查。CN:mcpp-res/mwrap-wuffs。
Expand Down
28 changes: 25 additions & 3 deletions pkgs/mwrap/slint.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- Immutable upstream-aligned mwrap source release (slint-m mwrap-1.19.0.1);
-- Immutable upstream-aligned mwrap source releases (slint-m mwrap-1.19.0.2, and
-- mwrap-1.19.0.1 with its published bytes);
-- GLOBAL and CN bytes are identical.
--
-- The wrapper is Apache-2.0. The library it links, compat.slint (Slint 1.19.0,
Expand All @@ -8,8 +9,8 @@
-- license texts beside programs (runtime.deploy). Linux x86_64, macOS arm64 and
-- Windows x86_64: compat.slint's payload has no Linux aarch64 row yet.
--
-- The build rule slint.mcpp.plugins is the separate package mcpplibs.slintgen
-- (rules/ of the same archive).
-- The build rule mcpp.mcpplibs.slintgen is the separate package
-- mcpplibs.slintgen (rules/ of the same archive), re-exported from 1.19.0.2 on.
package = {
spec = "1",
namespace = "mcpplibs.mwrap",
Expand All @@ -26,6 +27,13 @@ package = {
},
xpm = {
linux = {
["1.19.0.2"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.2/slint-m-1.19.0.2.tar.gz",
CN = "https://gitcode.com/mcpp-res/mwrap-slint/releases/download/1.19.0.2/slint-m-1.19.0.2.tar.gz",
},
sha256 = "95021ff52af53930f2b9306f5612f421e9f79741d7465ec3d586e7eb1948c62d",
},
["1.19.0.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.1/slint-m-1.19.0.1.tar.gz",
Expand All @@ -35,6 +43,13 @@ package = {
},
},
macosx = {
["1.19.0.2"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.2/slint-m-1.19.0.2.tar.gz",
CN = "https://gitcode.com/mcpp-res/mwrap-slint/releases/download/1.19.0.2/slint-m-1.19.0.2.tar.gz",
},
sha256 = "95021ff52af53930f2b9306f5612f421e9f79741d7465ec3d586e7eb1948c62d",
},
["1.19.0.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.1/slint-m-1.19.0.1.tar.gz",
Expand All @@ -44,6 +59,13 @@ package = {
},
},
windows = {
["1.19.0.2"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.2/slint-m-1.19.0.2.tar.gz",
CN = "https://gitcode.com/mcpp-res/mwrap-slint/releases/download/1.19.0.2/slint-m-1.19.0.2.tar.gz",
},
sha256 = "95021ff52af53930f2b9306f5612f421e9f79741d7465ec3d586e7eb1948c62d",
},
["1.19.0.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.1/slint-m-1.19.0.1.tar.gz",
Expand Down
60 changes: 48 additions & 12 deletions pkgs/s/slintgen.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,55 @@
-- slintgen -- slint-compiler as an importable build rule (module slint.mcpp.plugins).
-- slintgen -- slint-compiler as an importable build rule.
--
-- [build-dependencies]
-- mcpplibs.slintgen = { version = "1.19.0.1", features = ["slint"] }
-- One name in three spellings, as mcpplibs.openkal-bind is (SPEC-007 R9.6, a
-- third-party plugin's `mcpp.<namespace>.<name>`):
--
-- package mcpplibs.slintgen
-- module mcpp.mcpplibs.slintgen
-- namespace mcpp::mcpplibs::slintgen
--
-- Most projects never name it: mcpplibs.mwrap.slint re-exports it, so
--
-- [dependencies]
-- mcpplibs.mwrap.slint = "1.19.0.2"
--
-- // build.mcpp
-- import mcpp;
-- import slint.mcpp.plugins;
-- int main() { return mcpp::plugins::slint::compile({}) ? 0 : 1; }
-- import mcpp.mcpplibs.slintgen;
-- int main() {
-- mcpp::mcpplibs::slintgen::options o;
-- o.sources = {"ui/app.slint"};
-- return mcpp::mcpplibs::slintgen::compile(o) ? 0 : 1;
-- }
--
-- A project without the wrapper writes `mcpplibs.slintgen = { version =
-- "1.19.0.2", host-module = true }` under [build-dependencies] and depends on
-- compat.slint for the SDK.
--
-- The rule is this ecosystem's own C++ (not upstream's), so it stays in
-- `mcpplibs`; it ships in the rules/ directory of the slint-m archive, as
-- grpcgen ships in grpc-m's. The feature `slint` claims `.slint` as a source
-- the rule compiles; the project names it.
-- grpcgen ships in grpc-m's.
--
-- The module is named under the library's name, not `mcpp.plugins.*`: SPEC-007
-- R9.6 keeps that for the mcpp namespace and the index admits no package that
-- provides such a module (tests/run_members.sh). 1.19.0.1 is the wrapper
-- revision that renamed it; mwrap-1.19.0 was tagged and never indexed.
-- 1.19.0 and 1.19.0.1: the module was `mcpp.plugins.slint` (never indexed) and
-- `slint.mcpp.plugins` with a feature that claimed `.slint`; 1.19.0.2 is the
-- name above and no feature. 1.19.0.1 keeps its published bytes.
package = {
spec = "1",
namespace = "mcpplibs",
name = "slintgen",
description = "slint-compiler as an importable mcpp build rule (host-module slint.mcpp.plugins)",
description = "slint-compiler as an importable mcpp build rule (host-module mcpp.mcpplibs.slintgen)",
licenses = {"Apache-2.0"},
repo = "https://github.com/mcpplibs/slint-m",
type = "package",

xpm = {
linux = {
["1.19.0.2"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.2/slint-m-1.19.0.2.tar.gz",
CN = "https://gitcode.com/mcpp-res/mwrap-slint/releases/download/1.19.0.2/slint-m-1.19.0.2.tar.gz",
},
sha256 = "95021ff52af53930f2b9306f5612f421e9f79741d7465ec3d586e7eb1948c62d",
},
["1.19.0.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.1/slint-m-1.19.0.1.tar.gz",
Expand All @@ -37,6 +59,13 @@ package = {
},
},
macosx = {
["1.19.0.2"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.2/slint-m-1.19.0.2.tar.gz",
CN = "https://gitcode.com/mcpp-res/mwrap-slint/releases/download/1.19.0.2/slint-m-1.19.0.2.tar.gz",
},
sha256 = "95021ff52af53930f2b9306f5612f421e9f79741d7465ec3d586e7eb1948c62d",
},
["1.19.0.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.1/slint-m-1.19.0.1.tar.gz",
Expand All @@ -46,6 +75,13 @@ package = {
},
},
windows = {
["1.19.0.2"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.2/slint-m-1.19.0.2.tar.gz",
CN = "https://gitcode.com/mcpp-res/mwrap-slint/releases/download/1.19.0.2/slint-m-1.19.0.2.tar.gz",
},
sha256 = "95021ff52af53930f2b9306f5612f421e9f79741d7465ec3d586e7eb1948c62d",
},
["1.19.0.1"] = {
url = {
GLOBAL = "https://github.com/mcpplibs/slint-m/releases/download/mwrap-1.19.0.1/slint-m-1.19.0.1.tar.gz",
Expand Down
Loading
Loading