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
21 changes: 21 additions & 0 deletions .agents/docs/2026-10-13-add-richdem-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add compat.richdem

The pinned revision 9a1c97bb2529e386451a7dd54768b8b74bb4d620 declares
project version 2.2.11 in upstream CMakeLists.txt. It is not a release tag;
the descriptor preserves the PR's requested source snapshot and version.
The archive hash was checked twice. License: MIT.

This Form B build compiles richdem.cpp, random.cpp and terrain generation
sources, exposing upstream include/. It is deliberately the serial core:
GDAL, Boost serialization and OpenMP are disabled. The proposed gdal feature
was removed because adding gdal.cpp alone leaves USEGDAL disabled and cannot
supply the required SDK and runtime. No unsupported feature is advertised.

The descriptor lives under pkgs/c/compat.richdem.lua, matching the full
package name; the consumer redirects compat to this checkout. It fills a
3x3 depression and verifies random-state save/restore, exercising both the
public terrain algorithm and linked core symbols.

No mirror upload was performed; plain-string GLOBAL URLs provide CN fallback.
Local validation with the CI-pinned mcpp 2026.10.1.2 and gcc 16.1.0:
`mcpp test -p richdem`: `test result ok. 1 passed; 0 failed`.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ the online index; open a PR and confirm CI is green.
A PR runs lint and tests only the workspace members that depend on the changed descriptors; after the merge,
`deploy-site` publishes the site.

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

## Documentation

- [Library shapes and descriptor templates](docs/package-types.md)
Expand Down
2 changes: 2 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ agent(如 Claude Code)即可:

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

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

## 文档

- [库形态与描述符模板](docs/zh/package-types.md)
Expand Down
1 change: 1 addition & 0 deletions mcpp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ members = [
"tests/examples/openssl",
"tests/examples/recastnavigation",
"tests/examples/recastnavigation-features",
"tests/examples/richdem",
"tests/examples/protobuf",
"tests/examples/protobuf-upb",
"tests/examples/protobuf-gzip",
Expand Down
51 changes: 51 additions & 0 deletions pkgs/c/compat.richdem.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-- Form B inline descriptor for RichDEM, a C++ library for high-performance
-- terrain analysis.
--
-- Serial core build: GDAL, Boost serialization and OpenMP are disabled.
-- GDAL needs a define, headers and a runtime dependency, so a sources-only
-- feature cannot enable it correctly. Do not advertise an inert gdal feature.
package = {
spec = "1",
namespace = "compat",
name = "richdem",
description = "High-performance terrain analysis library",
licenses = {"MIT"},
repo = "https://github.com/r-barnes/richdem",
type = "package",

xpm = {
linux = {
["2.2.11"] = {
url = "https://github.com/r-barnes/richdem/archive/9a1c97bb2529e386451a7dd54768b8b74bb4d620.tar.gz",
sha256 = "bfa98d00d1d1f3529b2efc6907c9977e65a3c3071f46e24f468fa0db0dc6118b",
},
},
macosx = {
["2.2.11"] = {
url = "https://github.com/r-barnes/richdem/archive/9a1c97bb2529e386451a7dd54768b8b74bb4d620.tar.gz",
sha256 = "bfa98d00d1d1f3529b2efc6907c9977e65a3c3071f46e24f468fa0db0dc6118b",
},
},
windows = {
["2.2.11"] = {
url = "https://github.com/r-barnes/richdem/archive/9a1c97bb2529e386451a7dd54768b8b74bb4d620.tar.gz",
sha256 = "bfa98d00d1d1f3529b2efc6907c9977e65a3c3071f46e24f468fa0db0dc6118b",
},
},
},

mcpp = {
language = "c++23",
import_std = false,
c_standard = "c11",
include_dirs = { "*/include" },
sources = {
"*/src/richdem.cpp",
"*/src/random.cpp",
"*/src/terrain_generation/terrain_generation.cpp",
"*/src/terrain_generation/PerlinNoise.cpp",
},
targets = { ["richdem"] = { kind = "lib" } },
deps = {},
},
}
9 changes: 9 additions & 0 deletions tests/examples/richdem/mcpp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "richdem-tests"
version = "0.1.0"

[dependencies.compat]
richdem = "2.2.11"

[indices]
compat = { path = "../../.." }
17 changes: 17 additions & 0 deletions tests/examples/richdem/tests/core.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <richdem/common/Array2D.hpp>
#include <richdem/common/random.hpp>
#include <richdem/depressions/depressions.hpp>

int main() {
richdem::Array2D<double> dem(3, 3, 5.0);
dem(1, 1) = 1.0;
richdem::FillDepressions<richdem::Topology::D8>(dem);
if (dem(1, 1) != 5.0 || dem(0, 0) != 5.0) return 1;

richdem::seed_rand(1);
const auto state = richdem::SaveRandomState();
const int first = richdem::uniform_rand_int(1, 10);
richdem::SetRandomState(state);
return first >= 1 && first <= 10 &&
richdem::uniform_rand_int(1, 10) == first ? 0 : 2;
}
Loading