Giter VIP home page Giter VIP logo

Comments (7)

nmandery avatar nmandery commented on May 27, 2024 2

Closing as there is now h3o which provides a rust implementation of H3. That should allow targeting WASM without any linking issues.

from h3ron.

nmandery avatar nmandery commented on May 27, 2024 1

I did not have much time to look further into this, but I just stumbled over rustwasm/team#291 .

from h3ron.

nmandery avatar nmandery commented on May 27, 2024 1

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.

nmandery avatar nmandery commented on May 27, 2024

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.

olanod avatar olanod commented on May 27, 2024

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.

nmandery avatar nmandery commented on May 27, 2024

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.

nmandery avatar nmandery commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.