cad-editor/Cargo.toml

173 lines
7.7 KiB
TOML
Raw Normal View History

2026-03-22 14:56:27 +03:00
[package]
name = "OpenCADStudio"
2026-07-28 12:51:38 +03:00
version = "0.8.9"
2026-03-22 14:56:27 +03:00
edition = "2021"
build = "build.rs"
[workspace]
feat(thumbnails): embed DWG previews and wire cross-platform file thumbnails Round-trip a raster preview through the DWG's embedded preview slot and surface it to the OS file managers, so drawings show their contents in Explorer / Finder / Nautilus instead of a generic document icon. OCS: * io::thumbnail — rasterize the scene to a BMP DIB on save (embedded via acadrust's new Preview type) and read it back on open for the Start page recent list; `--dwg-thumbnail IN OUT SIZE` CLI extracts a badged PNG for external thumbnailers. * io::file_association::install_thumbnailer — self-install the OS integration on startup: Linux writes a .thumbnailer + hicolor mimetype icons; Windows registers the IThumbnailProvider DLL under HKCU. Shared core: * crates/dwg-thumbnailer — lean (image-only) preview extractor + the `badge_dwg` full-width "DWG" band, used by every platform so the ribbon is single-sourced. Ships an rlib+staticlib. * crates/dwg-thumbnailer-win — IThumbnailProvider COM in-proc server (cfg(windows), CI-built as a workspace member). * macos/ — QuickLook thumbnail extension (Swift + C-ABI bridge to the core staticlib), assembled into a .appex. Icons & packaging (single SVG source -> per-platform assets in CI): * assets/mimetypes/image-vnd.{dwg,dxf}.svg — themed file icons. * packaging: WiX ships dwg/dxf.ico + the thumbnail DLL and points the ProgIds at them; Info.plist gets CFBundleTypeIconFile + the QuickLook extension in Contents/PlugIns. * release.yml — generate .ico (Windows) and .icns (macOS) from the SVGs, build the QuickLook .appex, and bundle everything. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 01:27:17 +03:00
# `dwg-thumbnailer-win` is a Windows-only COM DLL (`#![cfg(windows)]`): it
# compiles to an empty cdylib on Linux/macOS and to the real handler on Windows,
# where the `build-windows` CI job (`cargo build --release`) compiles and thus
# verifies it.
members = [
"crates/ocs_plugin_api",
2026-07-25 18:49:18 +03:00
"crates/ocs_web_worker",
feat(thumbnails): embed DWG previews and wire cross-platform file thumbnails Round-trip a raster preview through the DWG's embedded preview slot and surface it to the OS file managers, so drawings show their contents in Explorer / Finder / Nautilus instead of a generic document icon. OCS: * io::thumbnail — rasterize the scene to a BMP DIB on save (embedded via acadrust's new Preview type) and read it back on open for the Start page recent list; `--dwg-thumbnail IN OUT SIZE` CLI extracts a badged PNG for external thumbnailers. * io::file_association::install_thumbnailer — self-install the OS integration on startup: Linux writes a .thumbnailer + hicolor mimetype icons; Windows registers the IThumbnailProvider DLL under HKCU. Shared core: * crates/dwg-thumbnailer — lean (image-only) preview extractor + the `badge_dwg` full-width "DWG" band, used by every platform so the ribbon is single-sourced. Ships an rlib+staticlib. * crates/dwg-thumbnailer-win — IThumbnailProvider COM in-proc server (cfg(windows), CI-built as a workspace member). * macos/ — QuickLook thumbnail extension (Swift + C-ABI bridge to the core staticlib), assembled into a .appex. Icons & packaging (single SVG source -> per-platform assets in CI): * assets/mimetypes/image-vnd.{dwg,dxf}.svg — themed file icons. * packaging: WiX ships dwg/dxf.ico + the thumbnail DLL and points the ProgIds at them; Info.plist gets CFBundleTypeIconFile + the QuickLook extension in Contents/PlugIns. * release.yml — generate .ico (Windows) and .icns (macOS) from the SVGs, build the QuickLook .appex, and bundle everything. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 01:27:17 +03:00
"crates/dwg-thumbnailer",
"crates/dwg-thumbnailer-win",
]
# Embed the application icon into the Windows .exe so Explorer, the taskbar,
# the Start-menu tile and file-association entries show it (issue #107).
[target.'cfg(windows)'.build-dependencies]
winresource = "0.1"
[features]
default = ["solid3d"]
# 3-D solid modelling: B-rep tessellation (truck-meshalgo) and booleans
# (truck-shapeops). Disabled for wasm builds — truck-meshalgo pulls
# vtkio → xz2 → lzma-sys (a C library) that does not cross-compile to
# wasm32. Without this feature the app is a 2-D CAD editor; the Model tab,
# solid tessellation and ACIS import become no-ops.
solid3d = ["dep:truck-meshalgo", "dep:truck-shapeops", "dep:lzma-sys"]
2026-03-22 14:56:27 +03:00
[dependencies]
# JSON: plugin marketplace / Patreon fetch (native) + web supporters.json parse,
# and the consolidated user config (settings.json) via serde-derived structs.
serde_json = "1"
serde = { version = "1", features = ["derive"] }
# Stable, dependency-free add-on contract (manifest + ribbon/CadModule types).
# Plugin authors target this crate's semver, not OpenCADStudio internals.
# The `host` feature (out-of-process plugin runtime: interprocess, libloading,
# memmap2, rkyv) is native-only — see the per-target sections below; the web
# build gets the dependency-free manifest/ribbon contract.
# vtkio (pulled in transitively via truck-meshalgo) depends on xz2 → lzma-sys,
# which by default links the system liblzma dynamically. On macOS that bakes a
# Homebrew dylib path (/opt/homebrew/.../liblzma.5.dylib) into the binary, so
# the .app crashes on launch on machines without that exact library (#56).
# Forcing the `static` feature builds liblzma from the bundled source, making
# the binary self-contained on every platform.
lzma-sys = { version = "0.1", features = ["static"], optional = true }
iced = { version = "0.14", features = ["image", "svg", "advanced", "canvas", "smol"] }
2026-07-28 01:02:00 +03:00
iced_aw = { version = "0.14.1", features = ["menu"] }
bytemuck = { version = "1.25", features = ["derive"] }
glam = { version = "0.33", features = ["bytemuck"] }
2026-03-22 14:56:27 +03:00
truck-modeling = "0.6"
truck-meshalgo = { version = "0.4", default-features = false, features = ["tessellation"], optional = true }
2026-03-22 14:56:27 +03:00
truck-polymesh = "0.6"
rfd = "0.17"
# Command-line parsing: file arg, --serve/--export/--script and the headless flags.
clap = { version = "4", features = ["derive"] }
# Opt-in logging via --log / RUST_LOG (surfaces wgpu / iced / winit diagnostics).
env_logger = "0.11"
2026-07-25 18:49:18 +03:00
acadrust = { version = "0.4", features = ["serde"] }
feat(thumbnails): embed DWG previews and wire cross-platform file thumbnails Round-trip a raster preview through the DWG's embedded preview slot and surface it to the OS file managers, so drawings show their contents in Explorer / Finder / Nautilus instead of a generic document icon. OCS: * io::thumbnail — rasterize the scene to a BMP DIB on save (embedded via acadrust's new Preview type) and read it back on open for the Start page recent list; `--dwg-thumbnail IN OUT SIZE` CLI extracts a badged PNG for external thumbnailers. * io::file_association::install_thumbnailer — self-install the OS integration on startup: Linux writes a .thumbnailer + hicolor mimetype icons; Windows registers the IThumbnailProvider DLL under HKCU. Shared core: * crates/dwg-thumbnailer — lean (image-only) preview extractor + the `badge_dwg` full-width "DWG" band, used by every platform so the ribbon is single-sourced. Ships an rlib+staticlib. * crates/dwg-thumbnailer-win — IThumbnailProvider COM in-proc server (cfg(windows), CI-built as a workspace member). * macos/ — QuickLook thumbnail extension (Swift + C-ABI bridge to the core staticlib), assembled into a .appex. Icons & packaging (single SVG source -> per-platform assets in CI): * assets/mimetypes/image-vnd.{dwg,dxf}.svg — themed file icons. * packaging: WiX ships dwg/dxf.ico + the thumbnail DLL and points the ProgIds at them; Info.plist gets CFBundleTypeIconFile + the QuickLook extension in Contents/PlugIns. * release.yml — generate .ico (Windows) and .icns (macOS) from the SVGs, build the QuickLook .appex, and bundle everything. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 01:27:17 +03:00
# Shared DWG embedded-preview extraction (Start-page + file-manager thumbnails).
dwg-thumbnailer = { path = "crates/dwg-thumbnailer" }
flate2 = "1"
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
inventory = "0.3"
truck-shapeops = { version = "0.4", optional = true }
# Fast non-cryptographic hasher. Handle/u64 keys dominate the hot block,
# hatch, draw-depth and wire caches; the default SipHash is overkill there.
rustc-hash = "2"
# TrueType/OpenType support: fontdb enumerates the user's installed system
# fonts; ttf-parser extracts glyph outlines we flatten into CAD wire strokes.
# Both are already in the tree transitively via iced's cosmic-text, so pinning
# them here adds no new downloads.
fontdb = "0.23"
ttf-parser = "0.25"
# Full text-layout engine: shaping (ligatures, Arabic joining, kerning), bidi
# reordering, and — crucially — automatic font fallback (a glyph missing from
# the chosen family is shaped from another installed font). We use it only to
# obtain positioned (font, glyph-id) runs; outlines come from ttf-parser and
# render through our own wire pipeline.
cosmic-text = "0.15"
lyon_tessellation = "1.0.20"
[target.'cfg(target_os = "windows")'.dependencies]
# Win32_System_Com — COM behind "Set as default app"
# (IApplicationAssociationRegistrationUI dialog).
# Win32_System_Registry — HKCU registration that lists the app under
# "Open with" for the portable .exe.
2026-07-25 02:58:46 +03:00
windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging", "Win32_System_Com", "Win32_System_Registry", "Win32_Storage_FileSystem", "Win32_Foundation"] }
[patch.crates-io]
2026-07-26 23:38:38 +03:00
# Track standard DWG object relationships used by the scene integration.
acadrust = { git = "https://github.com/OpenAEC-Foundation/acadifc.git", rev = "a66b0d9" }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Native enables the plugin host runtime (out-of-process plugins).
ocs_plugin_api = { path = "crates/ocs_plugin_api", features = ["host"] }
rayon = "1"
open = "5"
# PDF export / printing. Native-only: printpdf pulls a wasm-incompatible
# `memchr` (1.0.2) via lopdf → nom_locate, and the web build has no filesystem.
printpdf = { version = "0.9.1", default-features = false }
ureq = { version = "3", default-features = false, features = ["rustls"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
# Web gets the dependency-free manifest/ribbon contract only (no plugin host).
ocs_plugin_api = { path = "crates/ocs_plugin_api" }
console_error_panic_hook = "0.1"
# Log facade (already in the tree via wgpu/iced): lets the web build install a
# logger that mirrors wgpu/naga pipeline errors into a copyable on-page banner —
# a WebGL2 pipeline that fails to build otherwise just leaves the canvas empty.
log = "0.4"
# ahash (via acadrust) pulls getrandom 0.3, which needs the `wasm_js` backend
# enabled to support wasm32-unknown-unknown (plus the matching rustflag in
# .cargo/config.toml).
getrandom = { version = "0.3", features = ["wasm_js"] }
wasm-bindgen = "0.2"
# fetch() returns a JS Promise; bridge it to a Rust future for the per-script
# web font loader (#141).
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
2026-07-25 18:49:18 +03:00
bincode = "1.3"
# window.open (external URLs) + Blob/anchor file downloads (Save) + fetch()
# (Response) for the lazy per-script web font loader (#141).
web-sys = { version = "0.3", features = [
"Window",
"Storage",
"StorageManager",
"Navigator",
"Document",
"Element",
"HtmlAnchorElement",
"Blob",
"File",
"FileSystemDirectoryHandle",
"FileSystemFileHandle",
"FileSystemGetDirectoryOptions",
"FileSystemGetFileOptions",
"FileSystemWritableFileStream",
"WritableStream",
"Url",
"Response",
2026-07-25 18:49:18 +03:00
"Worker",
"WorkerOptions",
"WorkerType",
"MessageEvent",
"ErrorEvent",
# Async clipboard read for paste into the text/MText editors (iced's own
# clipboard read is a no-op on the web).
"Clipboard",
# Web copy/paste in plain text_input fields (#346): Ctrl+C writes the
# focused field's text; Ctrl+V replays the clipboard as synthetic
# KeyboardEvents on the canvas (the only route into a focused text_input).
"KeyboardEvent",
"KeyboardEventInit",
"EventInit",
"EventTarget",
# Error banner (web_diag): forward wgpu/naga errors to the browser console
# and inject a copyable DOM overlay (document.body → append_child).
"console",
"Node",
"HtmlElement",
] }
# Browsers without WebGPU (e.g. Firefox by default) need wgpu's WebGL2 backend;
# `webgl` enables it. `fira-sans` embeds the default UI font — the web has no
# system fonts, so without it all iced text (ribbon labels, command line) is
# blank. Features merge with the main `iced` dependency.
iced = { version = "0.14", features = ["webgl", "fira-sans"] }
2026-07-09 02:24:38 +03:00
[profile.release]
strip = true