Skip to content

Commit d3a328c

Browse files
tz12323Sunrisepeak
andauthored
feat: add etl package (#525)
* feat: add etl package fix: make onnxruntime CI build portable * fix(etl): resolve checkout package and repair selected LLVM tray test --------- Co-authored-by: sunrisepeak <speakshen@163.com>
1 parent 21b9a77 commit d3a328c

8 files changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Add compat.etl
2+
3+
ETL 20.49.0 is a MIT-licensed header-only upstream release. A generated C
4+
anchor gives mcpp a library target and exposes the original include directory.
5+
The three platform entries share the pinned archive and SHA-256. No optional
6+
compiled sources exist, so no sources-only features are advertised.
7+
8+
The GLOBAL URL is kept as a plain string; CN users fall back to upstream
9+
until a byte-identical mirror is published. The example redirects compat to
10+
this checkout and asserts fixed-capacity vector and queue ordering.
11+
12+
Local validation: mcpp 2026.10.1.2, gcc 16.1.0, `mcpp test -p etl`:
13+
`test result ok. 1 passed; 0 failed`. The original LLVM CI failure belonged
14+
to eui-neo-tray, which used setenv without stdlib.h; the follow-up includes
15+
that declaration so the already selected CI member compiles correctly.

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ the online index; open a PR and confirm CI is green.
6363
A PR runs lint and tests only the workspace members that depend on the changed descriptors; after the merge,
6464
`deploy-site` publishes the site.
6565

66+
Additional example: [`compat.etl`](pkgs/c/compat.etl.lua) — Header-only; [`consumer test`](tests/examples/etl/mcpp.toml).
6667
Additional example: [`compat.richdem`](pkgs/c/compat.richdem.lua) — C++ sources, serial terrain analysis; [`consumer test`](tests/examples/richdem/mcpp.toml).
6768

6869
## Documentation

‎README.zh-CN.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ agent(如 Claude Code)即可:
5959

6060
提交 PR 后,CI 执行 lint,并只测试依赖了被修改描述符的 workspace 成员;合并后,`deploy-site` 发布站点。
6161

62+
新增示例: [`compat.etl`](pkgs/c/compat.etl.lua) — Header-only; [`消费测试`](tests/examples/etl/mcpp.toml)。
6263
新增示例: [`compat.richdem`](pkgs/c/compat.richdem.lua) — C++ sources, serial terrain analysis; [`消费测试`](tests/examples/richdem/mcpp.toml)。
6364

6465
## 文档

‎mcpp.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ members = [
180180
"tests/examples/httplib-zstd",
181181
"tests/examples/msdfgen",
182182
"tests/examples/gtl",
183+
"tests/examples/etl",
183184
"tests/examples/galay",
184185
"tests/examples/miniaudio",
185186
"tests/examples/nanosvg",

‎pkgs/c/compat.etl.lua‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
-- Form B inline descriptor for the Embedded Template Library (ETL), a
2+
-- header-only collection of fixed-capacity containers and utilities for
3+
-- resource-constrained systems.
4+
--
5+
-- The upstream CMake target is INTERFACE-only and exposes `include/`, so a
6+
-- small C anchor gives mcpp a buildable library target while consumers use
7+
-- headers such as `<etl/vector.h>`.
8+
--
9+
-- ETL supports older language modes, but this package is built by mcpp, whose
10+
-- supported C++ standard starts at C++20. The package therefore uses C++23
11+
-- for its anchor and remains compatible with C++20 consumers.
12+
package = {
13+
spec = "1",
14+
namespace = "compat",
15+
name = "etl",
16+
description = "Embedded Template Library — fixed-capacity containers and utilities (header-only)",
17+
licenses = {"MIT"},
18+
repo = "https://github.com/ETLCPP/etl",
19+
type = "package",
20+
21+
xpm = {
22+
linux = {
23+
["20.49.0"] = {
24+
url = "https://github.com/ETLCPP/etl/archive/refs/tags/20.49.0.tar.gz",
25+
sha256 = "b3e7a5544795ec8f4a1b2ab46f6e88fdb78be5a07738f008ce11dd37ed14b6e4",
26+
},
27+
},
28+
macosx = {
29+
["20.49.0"] = {
30+
url = "https://github.com/ETLCPP/etl/archive/refs/tags/20.49.0.tar.gz",
31+
sha256 = "b3e7a5544795ec8f4a1b2ab46f6e88fdb78be5a07738f008ce11dd37ed14b6e4",
32+
},
33+
},
34+
windows = {
35+
["20.49.0"] = {
36+
url = "https://github.com/ETLCPP/etl/archive/refs/tags/20.49.0.tar.gz",
37+
sha256 = "b3e7a5544795ec8f4a1b2ab46f6e88fdb78be5a07738f008ce11dd37ed14b6e4",
38+
},
39+
},
40+
},
41+
42+
mcpp = {
43+
language = "c++23",
44+
import_std = false,
45+
c_standard = "c11",
46+
include_dirs = { "*/include" },
47+
generated_files = {
48+
["mcpp_generated/etl_anchor.c"] = [==[
49+
int mcpp_compat_etl_headers_anchor(void) { return 0; }
50+
]==],
51+
},
52+
sources = { "mcpp_generated/etl_anchor.c" },
53+
targets = { ["etl"] = { kind = "lib" } },
54+
deps = {},
55+
},
56+
}

‎tests/examples/etl/mcpp.toml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ETL test project: exercise a fixed-capacity vector and a queue without
2+
# requiring dynamic allocation from the library.
3+
[package]
4+
name = "etl-tests"
5+
version = "0.1.0"
6+
7+
[dependencies.compat]
8+
etl = "20.49.0"
9+
10+
[indices]
11+
compat = { path = "../../.." }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// compat.etl — exercise ETL's fixed-capacity containers and their observable
2+
// capacity/ordering behaviour.
3+
#include <etl/queue.h>
4+
#include <etl/vector.h>
5+
6+
int main() {
7+
etl::vector<int, 4> values;
8+
values.push_back(3);
9+
values.push_back(1);
10+
values.push_back(4);
11+
12+
if (values.size() != 3 || values.capacity() != 4 ||
13+
values[0] != 3 || values[2] != 4) {
14+
return 1;
15+
}
16+
17+
etl::queue<int, 4> queue;
18+
queue.push(10);
19+
queue.push(20);
20+
if (queue.front() != 10 || queue.back() != 20) {
21+
return 2;
22+
}
23+
queue.pop();
24+
if (queue.front() != 20 || queue.size() != 1) {
25+
return 3;
26+
}
27+
28+
return 0;
29+
}

‎tests/examples/eui-neo-tray/tests/tray.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
#if defined(__linux__)
4444
#include <limits.h>
45+
#include <stdlib.h>
4546
#include <unistd.h>
4647
#endif
4748

0 commit comments

Comments
 (0)