Merge #8526 (brett19/solidcore e30cfd2ac): solidcore as the default kernel, C++ SMLib behind --features smlib

Three conflicts:
- crates/smlib flat.rs and export.rs: #8526's export copies the C++
  arrays by id range; the ranges now run to the ball-patch arrays
  (FACE_DEFINITION_REAL_COUNT, FACE_DEFINITION_REALS), with
  WIRE_EDGE_NURBS_FORM (35) and FACE_DEFINITION_REAL_COUNT (36) both kept.
- tests/KNOWN_FAILING_TESTS: solidcore's lines and develop's, each test
  once; tests/KNOWN_FAILING_TESTS.smlib takes develop's SMLib a18bbe5 lines
  too. The first full run trims both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
jyvikoandClaude Opus 5.5 committed 2026-11-02 16:42:23 -05:00
commit 25175d68ca
114 files changed
+18649 -585

No files matched your search

+4 -3
View File
@@ -20,11 +20,12 @@ name = "solvecraft-cli"
path = "src/alias.rs"
[features]
default = ["raytrace-cpu", "smlib", "profile"]
default = ["raytrace-cpu", "profile"]
bundled-render-library = ["solidcraft-engine/bundled-render-library"]
raytrace-cpu = ["solidcraft-engine/raytrace-cpu"]
# Link SMLib into the kernel (solidcraft-engine/smlib; needs scripts/fetch-smlib.sh). SMLib is the
# only kernel, so without it the command line models nothing.
# Also link the C++ SMLib kernel (solidcraft-engine/smlib), off by default: needs a C++ toolchain
# and scripts/fetch-smlib.sh. solidcore, the Rust kernel, is always built and is the default either
# way; with this on, SOLIDCRAFT_KERNEL=smlib or the Geometry kernel preference can choose C++.
smlib = ["solidcraft-engine/smlib"]
# The profiler, compiled in so any build can say where its time goes (`--profile`,
# SOLIDCRAFT_PROFILE=1); it records nothing until asked.
+5 -2
View File
@@ -692,9 +692,12 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>, validation: solidcraft
return out;
}
};
if !solidcraft_engine::kernel::smlib_built() {
// The C++ kernel is needed only if it is the one asked for.
if !solidcraft_engine::kernel::smlib_built()
&& solidcraft_engine::kernel::kernel_route::backend() == solidcraft_engine::kernel::kernel_route::Backend::Smlib
{
out["status"] = json!("unsupported");
out["error"] = json!("this build has no SMLib: build solidcraft-cli with --features smlib");
out["error"] = json!("this build doesn't include the C++ SMLib kernel; build solidcraft-cli with --features smlib");
return out;
}
// `refused`: only a clean refusal is right; `solid_or_refused`: a clean refusal, or a result
+41
View File
@@ -386,3 +386,44 @@ fn a_design_saved_before_names_were_pinned_opens_pinned_and_unchanged() {
}
let _ = std::fs::remove_file(&path);
}
/// A saved model is its kernel's: the two differ in tolerances and in what they refuse, so a design
/// opened on the other kernel is evaluated on it, in both directions; on the kernel that saved it the
/// model is taken as it is. A process each, since the kernel is chosen for the process.
/// It reaches the C++ kernel on purpose: SOLIDCRAFT_KERNEL=smlib is the option under test.
#[cfg(feature = "smlib")]
#[test]
fn a_model_saved_on_one_kernel_is_evaluated_again_on_the_other() {
let cli = || {
let mut c = std::process::Command::new(env!("CARGO_BIN_EXE_solidcraft-cli"));
c.env_remove("SOLIDCRAFT_NO_MODEL_CACHE");
c
};
// Under the build's own temporary folder: the files are the command line's, not this process's.
let temp = |name: &str| Path::new(env!("CARGO_TARGET_TMPDIR")).join(format!("model-cache-{}-{name}.solidcraft", std::process::id()));
let script = temp("kernels-script").with_extension("json");
let recipe = json!({"commands": [
{"command": "solid.box", "params": {"length": 20, "width": 20, "height": 10, "body_name": "Plate"}},
{"command": "solid.cylinder", "params": {"diameter": 8, "height": 10, "base": [10, 10, 10], "operation": "join", "targets": ["Plate"]}},
]});
std::fs::write(&script, recipe.to_string()).unwrap();
// Whether opening found a model in the file it may take, whether it took it, and how many
// features it evaluated.
let open = |design: &Path, kernel: &str| {
let out = cli().env("SOLIDCRAFT_KERNEL", kernel).arg("bench-open").arg(design).output().unwrap();
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
let lines: Vec<Value> = String::from_utf8_lossy(&out.stdout).lines().filter_map(|l| serde_json::from_str(l).ok()).collect();
let step = |name: &str| lines.iter().find(|l| l["step"] == name).cloned().unwrap();
let (parse, evaluated) = (step("parse"), step("evaluate"));
(parse["saved_model"].as_bool().unwrap(), evaluated["adopted"].as_bool().unwrap(), evaluated["recomputed"].as_u64().unwrap())
};
for (saved, other) in [("solidcore", "smlib"), ("smlib", "solidcore")] {
let design = temp(&format!("kernels-{saved}"));
let out = cli().env("SOLIDCRAFT_KERNEL", saved).arg("run").arg(&script).arg("--save").arg(&design).output().unwrap();
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
assert_eq!(open(&design, saved), (true, true, 0), "saved on {saved}, opened on it");
assert_eq!(open(&design, other), (false, false, 2), "saved on {saved}, opened on {other}");
std::fs::remove_file(&design).unwrap();
}
std::fs::remove_file(&script).unwrap();
}