Comments (7)
Closing as there is now h3o which provides a rust implementation of H3. That should allow targeting WASM without any linking issues.
from h3ron.
I did not have much time to look further into this, but I just stumbled over rustwasm/team#291 .
from h3ron.
Compiling to wasm32-wasi works now - see #51. Requires the unreleased version from the main branch.
This won't help when targeting browsers, though. For that the wasm32-unknown-unknown target would be required. That one is still problematic - see rust-lang/cc-rs#715
from h3ron.
That would indeed be a nice feature to have. H3 uses cmake as it buildsystem, h3-sys is using the cmake
-crate to build h3. Looking at the current state in cmake it seems cmake sadly still lacks WASM support. So it seems to cross-compile for WASM, the build needs to be done manually using emscripten.
Another aspect I am not sure how it can be done is the usage of the rayon
thread pools in WASM.
As WASM this is not my current usecase, I am not sure how much time I can invest in this issue, but it is definitively a good effort. Maybe something from https://github.com/uber/h3-js can be re-used, at least emscripten is used there to compile to js.
from h3ron.
From h3-js
we can get inspiration on how to compile with emscripten, they don't use cmake but rather compile with emcc
directly. For rayon I see its already an optional dependency, I guess WASM compilation wouldn't activate the rayon feature?
from h3ron.
The use-rayon
feature is optional for the h3ron
crate, yes. For the h3ron-ndarry
and h3ron-graph
it is required, though. I suppose it would not be to bad when these two crates would not be available for WASM.
Thanks for locating the call to emscripten, I guess using something like that should work. It would even open the opportunity to loose the cmake
dependency altogether and compile directly with the systems c-compiler for the non-WASM targets using cc
. I only have worked briefly with wasm_bindgen
and friends in the past, so I am not so deep into the topic.
from h3ron.
Seems the cc
crate automatically compiles with emscripten when the target is emscripten. So we should definitively use cc.
https://github.com/alexcrichton/cc-rs/blob/178fd031e74f643721605e25110ee6abce8dbe05/src/lib.rs#L2140
Edit: Correction, compiling to wasm is not supported: rust-lang/cc-rs#580
from h3ron.
Related Issues (20)
- Provide h3ronpy binaries for more platforms HOT 1
- Rust 1.53+ warns about undefined behavior in bindgen-generated code
- Implement more advanced routing algorithms HOT 2
- Create DOI HOT 1
- Publish h3ron 0.13 HOT 2
- Cleanup graph traits
- error: building the downstream libh3 C library using the Solana SDK via cmake HOT 23
- Rewrite C dependency in Rust? HOT 22
- Upgrade to H3 v4.0 HOT 1
- A faster h3IsValid HOT 3
- Reduce the number of dependencies HOT 1
- Use heap allocations for longedges to reduce memory usage of prepared graphs
- docs.rs build is currently broken due to cmake version HOT 2
- FYI: HexSet HOT 6
- Build ontop of arrow Extension datatype HOT 5
- Feature indexmap is not defined in Cargo.toml HOT 1
- Bumping h3ron-sys HOT 4
- Open to inline comments? HOT 1
- Build problem due to geo dependency HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h3ron.