Skip to content

Commit 7587d95

Browse files
committed
fix(richdem): correct package lookup and validate serial terrain core
1 parent 04df346 commit 7587d95

6 files changed

Lines changed: 43 additions & 14 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add compat.richdem
2+
3+
The pinned revision 9a1c97bb2529e386451a7dd54768b8b74bb4d620 declares
4+
project version 2.2.11 in upstream CMakeLists.txt. It is not a release tag;
5+
the descriptor preserves the PR's requested source snapshot and version.
6+
The archive hash was checked twice. License: MIT.
7+
8+
This Form B build compiles richdem.cpp, random.cpp and terrain generation
9+
sources, exposing upstream include/. It is deliberately the serial core:
10+
GDAL, Boost serialization and OpenMP are disabled. The proposed gdal feature
11+
was removed because adding gdal.cpp alone leaves USEGDAL disabled and cannot
12+
supply the required SDK and runtime. No unsupported feature is advertised.
13+
14+
The descriptor lives under pkgs/c/compat.richdem.lua, matching the full
15+
package name; the consumer redirects compat to this checkout. It fills a
16+
3x3 depression and verifies random-state save/restore, exercising both the
17+
public terrain algorithm and linked core symbols.
18+
19+
No mirror upload was performed; plain-string GLOBAL URLs provide CN fallback.
20+
Local validation with the CI-pinned mcpp 2026.10.1.2 and gcc 16.1.0:
21+
`mcpp test -p richdem`: `test result ok. 1 passed; 0 failed`.

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ 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.richdem`](pkgs/c/compat.richdem.lua) — C++ sources, serial terrain analysis; [`consumer test`](tests/examples/richdem/mcpp.toml).
67+
6668
## Documentation
6769

6870
- [Library shapes and descriptor templates](docs/package-types.md)

‎README.zh-CN.md‎

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

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

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

6466
- [库形态与描述符模板](docs/zh/package-types.md)
Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
-- Form B inline descriptor for RichDEM, a C++ library for high-performance
22
-- terrain analysis.
33
--
4-
-- RichDEM's public headers are under include/richdem and its standalone
5-
-- library sources are under src/. GDAL support is optional upstream: enabling
6-
-- the feature matches CMake's USE_GDAL option by defining USEGDAL and adding
7-
-- the GDAL implementation source. Consumers enabling that feature must also
8-
-- provide GDAL headers and the GDAL library in their environment.
4+
-- Serial core build: GDAL, Boost serialization and OpenMP are disabled.
5+
-- GDAL needs a define, headers and a runtime dependency, so a sources-only
6+
-- feature cannot enable it correctly. Do not advertise an inert gdal feature.
97
package = {
108
spec = "1",
119
namespace = "compat",
@@ -48,12 +46,6 @@ package = {
4846
"*/src/terrain_generation/PerlinNoise.cpp",
4947
},
5048
targets = { ["richdem"] = { kind = "lib" } },
51-
features = {
52-
["gdal"] = {
53-
defines = { "USEGDAL" },
54-
sources = { "*/src/gdal.cpp" },
55-
},
56-
},
5749
deps = {},
5850
},
5951
}

‎tests/examples/richdem/mcpp.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ version = "0.1.0"
44

55
[dependencies.compat]
66
richdem = "2.2.11"
7+
8+
[indices]
9+
compat = { path = "../../.." }
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
#include <richdem/common/constants.hpp>
1+
#include <richdem/common/Array2D.hpp>
22
#include <richdem/common/random.hpp>
3+
#include <richdem/depressions/depressions.hpp>
34

45
int main() {
6+
richdem::Array2D<double> dem(3, 3, 5.0);
7+
dem(1, 1) = 1.0;
8+
richdem::FillDepressions<richdem::Topology::D8>(dem);
9+
if (dem(1, 1) != 5.0 || dem(0, 0) != 5.0) return 1;
10+
511
richdem::seed_rand(1);
6-
const auto value = richdem::uniform_rand_int(1, 10);
7-
return value >= 1 && value <= 10 ? 0 : 1;
12+
const auto state = richdem::SaveRandomState();
13+
const int first = richdem::uniform_rand_int(1, 10);
14+
richdem::SetRandomState(state);
15+
return first >= 1 && first <= 10 &&
16+
richdem::uniform_rand_int(1, 10) == first ? 0 : 2;
817
}

0 commit comments

Comments
 (0)