microsoft / arcana.cpp

Arcana.cpp is a collection of helpers and utility code for low overhead, cross platform C++ implementation of task-based asynchrony.
MIT License
78 stars 24 forks source link

Support webassembly target #32

Closed unicomp21 closed 2 years ago

unicomp21 commented 2 years ago

Maybe just the inline scheduler or manual scheduler?

unicomp21 commented 2 years ago

@GorNishanov what are the chances of getting MS resources here? For webassembly support?

syntheticmagus commented 2 years ago

@unicomp21 We're not currently planning to put resources on this. As I understand it, threading in WASM is a bit of a flaky space in general, and none of the scenarios we're focusing on feature it, so I don't see it becoming a priority in the near future.

However, I can tell you that I personally have compiled and used both of the schedulers you mentioned in a proof-of-concept branch for a different project that uses Arcana, so as of the middle of this year it already should have been possible to use these with Emscripten. If you're encountering a specific compilation or usage error, that might be something we can look into, especially if it isn't WASM-specific. Thanks!

unicomp21 commented 2 years ago

Thanks @syntheticmagus ! Any chance the emscripten build is in a public repo? I'm not really interested in wasm threading, just co_await based coroutines, and the inline scheduler.

syntheticmagus commented 2 years ago

@unicomp21 No, the changes I made to target Emscripten aren't really public-facing. However, I didn't actually change the code itself much, if at all; the project in question used CMake to generate its build system, so I just used Emscripten's CMake integration to configure the project and fixed whatever errors the compiler ran into.

unicomp21 commented 2 years ago

@syntheticmagus I'm really struggling w/ my own ignorance on this one. Part of my problem might be I'm trying to make my emscripten build run on linux. Any chance I could beg for a fork of this repo showing how to make the emscripten build work for arcana.cpp?

syntheticmagus commented 2 years ago

https://github.com/syntheticmagus/example_arcana_unix

@unicomp21 Here is an example of an extremely minimal project that has Arcana as a dependency. Arcana is depended upon as a submodule, so the following should give you all the code you need.

git clone https://github.com/syntheticmagus/example_arcana_unix
cd example_arcana_unix
git submodule update --init --recursive

Following the steps described in the provided README, I was able to build this project for both Linux and WASM. I haven't tried to run the WASM one, but the Linux one runs exactly as expected, and both build just fine.

unicomp21 commented 2 years ago

Thanks @syntheticmagus !