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
14 changes: 11 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:
contents: read

env:
# compat.slint 1.19.0 and mcpplibs.slintgen 1.19.0 are in an mcpp-index
# compat.slint 1.19.0 is in an mcpp-index
# PR and not yet in the published index: until they are, the run resolves
# against that PR's candidate commit, the complete unchanged index layout
# installed as the built-in index of the run's home. Drop this pin and the step
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
done
mcpp --version

- name: Candidate index (compat.slint, slintgen)
- name: Candidate index (compat.slint)
run: |
mcpp index update
# No early exit in awk: mcpp would take SIGPIPE, and pipefail report it.
Expand All @@ -101,7 +101,15 @@ jobs:
- name: Tests, release profile
run: mcpp test --profile release

- name: mcpp.mcpplibs.slintgen generates a component, its module, and runs it headless with the SDK the project declares
- name: The rule's module is its package id (mcpp-index docs/build-plugins.md)
run: |
# A build plugin `<owner>.mplugin.<name>` exports a module of exactly that
# name; the index cannot read the archive's sources, so the check is here.
grep -qE '^export module mcpplibs\.mplugin\.slint;' rules/src/slint.cppm
grep -qE '^export namespace mcpplibs::mplugin::slint ' rules/src/slint.cppm
grep -qE '^name += "slint"' rules/mcpp.toml

- name: mcpplibs.mplugin.slint generates a component, its module, and runs it headless with the SDK the project declares
run: MCPP="$(command -v mcpp)" bash tests/rule-consumer/check-slint.sh

- name: Export audit (the generated surface is fresh; every public name, key code and feature of the SDK's headers)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: true
env:
MCPP_VERSION: "2026.11.18.1"
# See ci.yml: the candidate index until compat.slint and mcpplibs.slintgen are published.
# See ci.yml: the candidate index until compat.slint is published.
MCPP_INDEX_CANDIDATE: "4191fe3e1193ae4ce4360201ae0a45ca1c2e5463"
jobs:
templates:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The upstream API is unchanged: `slint::ComponentHandle`, `slint::SharedString`,
`slint::VectorModel`, `slint::interpreter::ComponentCompiler` are the names of
`<slint.h>`. The SDK is `compat.slint` 1.19.0 (xim:slint: `libslint_cpp`, its
headers and `slint-compiler`, built from the release tag with upstream CMake's
default features). A `.slint` file is compiled by `mcpp.mcpplibs.slintgen` (package
`mcpplibs.slintgen`, in `rules/` of this repository), which the project's `build.mcpp`
default features). A `.slint` file is compiled by `mcpplibs.mplugin.slint` (package
`mcpplibs.mplugin.slint`, in `rules/` of this repository), which the project's `build.mcpp`
imports; with `module` set, each file becomes a module the program imports.

## Modules
Expand All @@ -23,7 +23,7 @@ imports; with `module` set, each file becomes a module the program imports.
- `import mcpplibs.mwrap.slint.interpreter;`: `slint::interpreter` -- `.slint` sources loaded at run time
- `import mcpplibs.mwrap.slint.platform;`: `slint::platform` -- a custom platform, the software renderer (Clang; with GCC include `<slint-platform.h>`)
- `import mcpplibs.mwrap.slint.macros;`: `SLINT_FEATURE_*` as `constexpr bool` in `mcpplibs::mwrap::slint::macros`
- `import app.ui;`: a component of yours, from `ui/app.slint` (`mcpp.mcpplibs.slintgen`, `options::module`)
- `import app.ui;`: a component of yours, from `ui/app.slint` (`mcpplibs.mplugin.slint`, `options::module`)

> More Modules API -> [Usage and API](docs/usage.md)

Expand All @@ -40,18 +40,18 @@ The default template opens a window with a counter; without a display (or with

```toml
[dependencies]
mcpplibs.mwrap.slint = "1.19.0.2"
mcpplibs.mwrap.slint = "1.19.0.3"
```

```cpp
// build.mcpp
import mcpp;
import mcpp.mcpplibs.slintgen;
import mcpplibs.mplugin.slint;
int main() {
mcpp::mcpplibs::slintgen::options o;
mcpplibs::mplugin::slint::options o;
o.sources = {"ui/app.slint"};
o.module = "app.ui";
return mcpp::mcpplibs::slintgen::compile(o) ? 0 : 1;
return mcpplibs::mplugin::slint::compile(o) ? 0 : 1;
}
```

Expand Down Expand Up @@ -85,7 +85,7 @@ the runtime types through the module, and a component compiled at run time by
export audit ([tools/check_exports.py](tools/check_exports.py)) reads clang's AST of
the SDK's headers: every public name exported, the key codes and features mapped,
the SDK's features upstream CMake's defaults. A separate job scaffolds the default
template as an installed package, builds it with `mcpp.mcpplibs.slintgen` and runs it
template as an installed package, builds it with `mcpplibs.mplugin.slint` and runs it
headless.

## License
Expand Down
14 changes: 7 additions & 7 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
上游 API 保持不变:`slint::ComponentHandle`、`slint::SharedString`、`slint::VectorModel`、
`slint::interpreter::ComponentCompiler` 就是 `<slint.h>` 里的名字。SDK 是 `compat.slint`
1.19.0(xim:slint:`libslint_cpp`、头文件和 `slint-compiler`,由发布 tag 按上游 CMake
默认功能构建)。`.slint` 文件由 `mcpp.mcpplibs.slintgen`(包 `mcpplibs.slintgen`,在本仓库的 `rules/`)编译,
默认功能构建)。`.slint` 文件由 `mcpplibs.mplugin.slint`(包 `mcpplibs.mplugin.slint`,在本仓库的 `rules/`)编译,
由工程的 `build.mcpp` 导入;设置 `module` 后,每个文件都成为程序可以 import 的模块。

## 模块
Expand All @@ -21,7 +21,7 @@
- `import mcpplibs.mwrap.slint.interpreter;`:`slint::interpreter`,运行时加载 `.slint` 源码
- `import mcpplibs.mwrap.slint.platform;`:`slint::platform`,自定义平台与软件渲染器(Clang;GCC 下请 include `<slint-platform.h>`)
- `import mcpplibs.mwrap.slint.macros;`:`SLINT_FEATURE_*` 映射为 `constexpr bool`,位于 `mcpplibs::mwrap::slint::macros`
- `import app.ui;`:你自己的组件,来自 `ui/app.slint`(`mcpp.mcpplibs.slintgen` 的 `options::module`)
- `import app.ui;`:你自己的组件,来自 `ui/app.slint`(`mcpplibs.mplugin.slint` 的 `options::module`)

> 更多模块 API -> [用法和 API](docs/usage.md)

Expand All @@ -38,18 +38,18 @@ mcpp run

```toml
[dependencies]
mcpplibs.mwrap.slint = "1.19.0.2"
mcpplibs.mwrap.slint = "1.19.0.3"
```

```cpp
// build.mcpp
import mcpp;
import mcpp.mcpplibs.slintgen;
import mcpplibs.mplugin.slint;
int main() {
mcpp::mcpplibs::slintgen::options o;
mcpplibs::mplugin::slint::options o;
o.sources = {"ui/app.slint"};
o.module = "app.ui";
return mcpp::mcpplibs::slintgen::compile(o) ? 0 : 1;
return mcpplibs::mplugin::slint::compile(o) ? 0 : 1;
}
```

Expand Down Expand Up @@ -79,7 +79,7 @@ Linux、macOS 与 Windows 的 CI 用 GCC 和 Clang 构建模块并运行测试
以及由 `slint::interpreter` 在运行时编译组件、在无头平台上通过属性和回调驱动它。导出审计
([tools/check_exports.py](tools/check_exports.py))读取 SDK 头文件的 clang AST:每个公开名字都已导出,
按键码与功能都已映射,SDK 的功能即上游 CMake 默认值。另有一个任务把默认模板当作已安装包生成项目,
经 `mcpp.mcpplibs.slintgen` 构建并无头运行。
经 `mcpplibs.mplugin.slint` 构建并无头运行。

## 许可

Expand Down
18 changes: 9 additions & 9 deletions docs/rules.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# `mcpp.mcpplibs.slintgen`
# `mcpplibs.mplugin.slint`

`mcpp.mcpplibs.slintgen` compiles [Slint](https://slint.dev) user interfaces: each `.slint` file becomes, through `slint-compiler`, a C++ header (and on request a number of `.cpp` units and a C++ module) the program uses. It is what upstream's CMake function `slint_target_sources` does. The rule declares no SDK and pins no version: the compiler and the runtime the program links come from one Slint SDK the project chooses. Package `mcpplibs.slintgen` (`rules/` of this repository), module `mcpp.mcpplibs.slintgen`; engine floor 2026.10.1.3.
`mcpplibs.mplugin.slint` compiles [Slint](https://slint.dev) user interfaces: each `.slint` file becomes, through `slint-compiler`, a C++ header (and on request a number of `.cpp` units and a C++ module) the program uses. It is what upstream's CMake function `slint_target_sources` does. The rule declares no SDK and pins no version: the compiler and the runtime the program links come from one Slint SDK the project chooses. Package `mcpplibs.mplugin.slint` (`rules/` of this repository), module `mcpplibs.mplugin.slint`; engine floor 2026.10.1.3.

## Use

```toml
[dependencies]
mcpplibs.mwrap.slint = "1.19.0.2" # re-exports this rule and the SDK (compat.slint)
mcpplibs.mwrap.slint = "1.19.0.3" # re-exports this rule and the SDK (compat.slint)
```

The wrapper hands the rule to the project's build program, so this one dependency is enough. A project that does not use 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 wrapper hands the rule to the project's build program, so this one dependency is enough. A project that does not use the wrapper writes `mcpplibs.mplugin.slint = { version = "1.19.0", host-module = true }` under `[build-dependencies]` and depends on `compat.slint` for the SDK.

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`, C++ namespace `mcpp::mcpplibs::slintgen`.
One name in three spellings: a build plugin's id is `<owner>.mplugin.<name>` (mcpp-index `docs/build-plugins.md`), and its module and C++ namespace are that id: package `mcpplibs.mplugin.slint`, module `mcpplibs.mplugin.slint`, C++ namespace `mcpplibs::mplugin::slint`. The rule's own version is the Slint it drives (`1.19.0`); this wrapper's revisions (`1.19.0.3`) are its own.

The `.slint` files are the rule's `options::sources`, relative to the package root; they are not listed in `[build] sources`, which mcpp reads as C++.

```cpp
// build.mcpp
import mcpp.mcpplibs.slintgen;
import mcpplibs.mplugin.slint;

int main() {
mcpp::mcpplibs::slintgen::options o;
mcpplibs::mplugin::slint::options o;
o.sources = {"ui/app.slint"};
o.module = "app.ui"; // also write `export module app.ui;`
return mcpp::mcpplibs::slintgen::compile(o) ? 0 : 1;
return mcpplibs::mplugin::slint::compile(o) ? 0 : 1;
}
```

Expand Down Expand Up @@ -67,7 +67,7 @@ The rule reads the `.slint` files while the build program runs, so a change to t

## The SDK

The first that answers decides, recorded as the fact `mcpp.mcpplibs.slintgen.sdk`:
The first that answers decides, recorded as the fact `mcpplibs.mplugin.slint.sdk`:

| level | how |
|---|---|
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import mcpplibs.mwrap.slint;

## Components from `.slint` files

`mcpp.mcpplibs.slintgen` (package `mcpplibs.slintgen`, `rules/` of this repository; this package re-exports it to the project's build program, and compat.slint re-exports `slint-compiler`) runs `slint-compiler` on each `.slint` file the build program names in `options::sources`: one action per file, regenerated when the file or one it imports changes. Its options are upstream CMake's `slint_target_sources` and target properties (`ns`, `library_paths`, `compilation_units`, `edition`, `style`, `embed_resources`, `scale_factor`, `translation_domain`, `bundle_translations`); with `module = "app.ui"` each file also becomes a module exporting its windows, structs, enums and globals. See [rules.md](rules.md).
`mcpplibs.mplugin.slint` (package `mcpplibs.mplugin.slint`, `rules/` of this repository; this package re-exports it to the project's build program, and compat.slint re-exports `slint-compiler`) runs `slint-compiler` on each `.slint` file the build program names in `options::sources`: one action per file, regenerated when the file or one it imports changes. Its options are upstream CMake's `slint_target_sources` and target properties (`ns`, `library_paths`, `compilation_units`, `edition`, `style`, `embed_resources`, `scale_factor`, `translation_domain`, `bundle_translations`); with `module = "app.ui"` each file also becomes a module exporting its windows, structs, enums and globals. See [rules.md](rules.md).

## The SDK's features

Expand Down
8 changes: 4 additions & 4 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[package]
namespace = "mcpplibs.mwrap"
name = "slint"
version = "1.19.0.2"
description = "Slint 1.19.0 C++ modules for mcpp (import mcpplibs.mwrap.slint;): the runtime API, the interpreter and the platform API over compat.slint, the features as constants; .slint files compile with mcpp.mcpplibs.slintgen"
version = "1.19.0.3"
description = "Slint 1.19.0 C++ modules for mcpp (import mcpplibs.mwrap.slint;): the runtime API, the interpreter and the platform API over compat.slint, the features as constants; .slint files compile with mcpplibs.mplugin.slint"
license = "Apache-2.0"
authors = ["mcpp-community"]
repo = "https://github.com/mcpplibs/slint-m"
Expand All @@ -22,12 +22,12 @@ include_dirs = ["include"]
# consumer's build program finds slint-compiler in it.
compat.slint = { version = "1.19.0", reexport = true }

# The build rule (module mcpp.mcpplibs.slintgen, rules/): handed to the
# The build rule (module mcpplibs.mplugin.slint, rules/): handed to the
# consumer's build program, so this one dependency is enough to import it in
# build.mcpp -- the shape grpc-m gives grpcgen. It runs slint-compiler from
# compat.slint above: one SDK, one version.
[build-dependencies]
mcpplibs.slintgen = { path = "rules", host-module = true, reexport = true }
mcpplibs.mplugin.slint = { path = "rules", host-module = true, reexport = true }

[package.metadata.mwrap]
upstream-version = "1.19.0"
Expand Down
Loading
Loading