Skip to content

v1.7.2 - occtkit builds for wasm again

Latest

Choose a tag to compare

@gsdali gsdali released this 28 Nov 02:35
675769d

occtkit builds for wasm32-unknown-wasip1 again (#150, refs #148 and SecondMouseAU/OCCTSwift#3291). It had not built since OCCTSwift 4.0.0-beta.6 removed the WASI-only simd shim this package relied on. No behaviour changes on Apple platforms: the same simd module is imported there, and the file writes are the same.

.package(url: "https://github.com/SecondMouseAU/OCCTSwiftScripts.git", from: "1.7.2")

Fixed

  • simd on WASI. Each import simd in the files WASI compiles is now #if canImport(simd), and simd_length, simd_normalize, simd_dot, simd_min and simd_max are written over the standard library's SIMD types for a build with no simd module (Sources/occtkit/WASICompat.swift and a new Sources/DrawingComposer/SIMDCompat.swift).
  • .atomic writes on WASI. ManifestIO wrote with .atomic, which WASI's Foundation marks unavailable because temporary files are not supported (#144, beta.4). It now takes ManifestIO.atomicWrite, empty on WASI. A manifest or failure marker written on WASI is therefore not written atomically: a write that fails partway can leave a partial file.

Verification

Scripts/build-wasm.sh with the swift.org 6.4.0 toolchain, its wasm SDK and wasi-sdk 34.0 builds occtkit.wasm. Run under Node's node:wasi and compared with a native occtkit built from the same tree, on a 10 x 10 x 5 block with a 4 mm bore: mesh, check-thickness, measure-distance, measure-deviation, query-topology, transform (translate and rotate) and drawing-export agree to 1e-6, and the drawing's DXF is byte for byte the same; metrics agrees except the order of two principal axes whose moments are equal, which is arbitrary; and load-brep --emit-manifest writes and merges a manifest. The other verbs were not compared, and no run of mine reached AssemblyComposer's simd_min, simd_max and simd_length (an assembly drawing). There is no unit test for this: nothing in Tests runs on WASI and CI has no wasm job.

CI on the PR: tests, verbs, integration, code-style, build-all, lockfile and policies. On the merge commit: tests, verbs, integration, code-style and docs-consistency.