feat(wasm): compile the library for wasm32 (issue #45 groundwork)
First step toward a web build: the library now compiles for wasm32-unknown-unknown with --no-default-features. - Add a `solid3d` feature (default on) gating truck-meshalgo / truck-shapeops / lzma-sys. These pull vtkio → xz2 → lzma-sys (C), which cannot cross-compile to wasm. Without the feature the 3-D solid path (tessellation, booleans, ACIS import) becomes no-ops; 2-D CAD is unaffected. Native builds keep the feature by default. - Move native-only crates (ureq, open) to non-wasm target deps and add cfg shims: update-check is a no-op on wasm, and a new `sys` module provides open_url + handle_path (rfd FileHandle → PathBuf; synthesizes a name-based path on the web). Native build + all 75 tests unchanged. Browser runtime wiring (entry point, trunk, real file I/O) is a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3666c7fa69
commit
b2e20c95fe
12 changed files with 123 additions and 20 deletions
|
|
@ -28,6 +28,7 @@ pub struct UpdateInfo {
|
|||
pub body: String,
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub async fn check_for_update() -> Option<UpdateInfo> {
|
||||
std::thread::spawn(fetch_latest_if_outdated)
|
||||
.join()
|
||||
|
|
@ -35,6 +36,14 @@ pub async fn check_for_update() -> Option<UpdateInfo> {
|
|||
.flatten()
|
||||
}
|
||||
|
||||
/// On wasm there is no background thread or blocking HTTP client; the web build
|
||||
/// skips the self-update check (the page is always served fresh).
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
pub async fn check_for_update() -> Option<UpdateInfo> {
|
||||
None
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn fetch_latest_if_outdated() -> Option<UpdateInfo> {
|
||||
let agent: ureq::Agent = ureq::Agent::config_builder()
|
||||
.timeout_global(Some(std::time::Duration::from_secs(5)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue