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 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 13:01:19 +03:00
1 parent 3666c7fa69
commit b2e20c95fe
12 files changed
+123 -20

No files matched your search

+3 -3
View File
@@ -2489,7 +2489,7 @@ impl OpenCADStudio {
}
"DONATE" => {
let _ = open::that("https://patreon.com/HakanSeven12");
crate::sys::open_url("https://patreon.com/HakanSeven12");
self.command_line.push_info("Opening Patreon page...");
}
@@ -2669,7 +2669,7 @@ impl OpenCADStudio {
}
"REPORT" => {
let _ = open::that("https://github.com/HakanSeven12/OpenCADStudio/issues/new");
crate::sys::open_url("https://github.com/HakanSeven12/OpenCADStudio/issues/new");
self.command_line.push_info("Opening feedback page...");
}
@@ -2682,7 +2682,7 @@ impl OpenCADStudio {
}
"CHANGELOG" => {
let _ = open::that("https://github.com/HakanSeven12/OpenCADStudio/releases");
crate::sys::open_url("https://github.com/HakanSeven12/OpenCADStudio/releases");
self.command_line.push_info("Opening release notes...");
}
+8 -8
View File
@@ -408,7 +408,7 @@ impl OpenCADStudio {
.pick_file()
.await;
match handle {
Some(h) => Ok(h.path().to_path_buf()),
Some(h) => Ok(crate::sys::handle_path(&h)),
None => Err("Cancelled".to_string()),
}
},
@@ -443,7 +443,7 @@ impl OpenCADStudio {
.add_filter("DWG Files", &["dwg"])
.save_file()
.await
.map(|h| h.path().to_path_buf());
.map(|h| crate::sys::handle_path(&h));
(name, path)
},
|(name, path)| Message::WblockSaveResult(name, path),
@@ -497,7 +497,7 @@ impl OpenCADStudio {
.add_filter("All Files", &["*"])
.save_file()
.await
.map(|h| h.path().to_path_buf());
.map(|h| crate::sys::handle_path(&h));
(csv_clone, path)
},
|(csv, path)| Message::DataExtractionSaveResult(csv, path),
@@ -540,7 +540,7 @@ impl OpenCADStudio {
.add_filter("All Files", &["*"])
.save_file()
.await
.map(|h| h.path().to_path_buf())
.map(|h| crate::sys::handle_path(&h))
},
Message::StlExportPath,
)
@@ -594,7 +594,7 @@ impl OpenCADStudio {
.add_filter("All Files", &["*"])
.save_file()
.await
.map(|h| h.path().to_path_buf())
.map(|h| crate::sys::handle_path(&h))
},
Message::StepExportPath,
)
@@ -637,7 +637,7 @@ impl OpenCADStudio {
.add_filter("All Files", &["*"])
.pick_file()
.await
.map(|h| h.path().to_path_buf())
.map(|h| crate::sys::handle_path(&h))
},
Message::ObjImportPath,
),
@@ -5730,7 +5730,7 @@ impl OpenCADStudio {
}
}
Message::UpdateNoticeOpenRelease => {
let _ = open::that(crate::update_check::RELEASES_PAGE);
crate::sys::open_url(crate::update_check::RELEASES_PAGE);
if let Some(id) = self.update_notice_window.take() {
window::close(id)
} else {
@@ -6313,7 +6313,7 @@ impl OpenCADStudio {
.add_filter("All Files", &["*"])
.save_file()
.await
.map(|h| h.path().to_path_buf())
.map(|h| crate::sys::handle_path(&h))
},
Message::PlotStylePanelSavePath,
)