-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to build with emscripten #306
Add support to build with emscripten #306
Conversation
Thanks, Nick! This is a pretty neat PR. Two questions:
Two comments:
|
Unfortunately, I'm not able to test.
I've turned off intrinsics as enabling it will reduce performance by ~40-60%. I think this is caused by the #defines that are lowered to WASM instructions that are suboptimal in the files where To keep the same semantics for turning on/off intrinsics, I've included the
This is dependent on the
Yes! I'll do some more house keeping. |
If this helps, I can test it on my Windows machine. However, I'm not sure what exactly should be tested - Should just I test the WASM build and make sure it works? |
It would certainly help to see if the steps produce the WASM artifacts work on Windows. We may need to further modify the emscripten configuration changes to work with MSVC. Including the intrinsics changes. |
Okay, it seems like it builds just fine using the latest emscripten sdk on my Windows 10 machine. Here is the complete build log:
Here (inside the zip) are the two files you mentioned, which I got from the build. |
Great! Does it work if you enable intrinsics? |
Seems like it is. The emcc command does not give any output, but I guess this is because of some sort of caching mechanism. The two files are created nevertheless. |
@lielfr Did you use MinGW as generator? |
I have not successfully built it on Windows yet. First, |
@WeiDaiWD No, I didn't need to. All I had to do is make sure I have Python >3.6 and git, then I followed the installation instructions for Emscripten (I used emsdk and followed the instructions using |
I installed a win 10 VM, installed CMake and the installation package had an option to add it to my path. It was not the default option. My path to cmake:
I've been able to run
|
I've found the issue. |
Yep I was using the |
It's straightforward if you run |
Yeah, hadn't realized that it used Ninja by default. Thanks again! Hopefully I'll be able to put it to good use. |
This PR adds support to build SEAL out of the box with emscripten.
There are a few small changes:
ar
is replaced with emscripten'semar
.defines.h
needs to have an entry to build on a unix-like system.Things not included:
Building with emscripten will now compile without any errors, but it will not build anything useful due to lack of JS bindings. This PR will not include any JS bindings. Users are free to add their own ad-hoc changes for JavaScript bindings to use SEAL in their WASM or JS applications without committing to a standard. This allows flexible builds to minimize bundle size.
Example build instructions for WASM:
Download/clone and setup emsdk by following their instructions.
Source the environment:
source ./emsdk_env.sh
Navigate to the SEAL root directory and run emcmake:
Make the static library:
emmake make -j
Build a WASM module:
Generated output files. Note they're extremely small because there are no JS bindings: