Compiles a molfile to InChI function written in C and linked to the InChI C library to WebAssembly. There is also a task to compile a macOS dylib for comparison.
For an overview of the procedure, see Compiling C to WebAssembly and Running It - without Emscripten.
To summarize:
- Install LLVM on your platform. On macOS, that probably means installing through Homebrew.
- Activate LLVM, if necessary. macOS users will need to append the LLVM
binpath to thePATHenvironment variable. Something likeexport PATH=/usr/local/opt/llvm/bin:$PATHshould work. - Verify that LLVM is working with
llc --version. The output should includewasm32andwasm64. - Clone, compile, and install wasi-libc.
- Copy the file libclang_rt.builtins-wasm32.a to your local LLVM
bin/wasidirectory.
From there, you can compile this project with:
cd inchi-wasm
bin/build-wasm.shUse the script bin/build-dylib.sh to build a macOS dynamic library. This can be used from a Node.js environment and may be helpful for benchmarking purposes. Build scripts for other platforms can uses this script as a starting point.
The build directory contains a complete WebAssembly distribution and test. To run it start a local Web server and browse to dist/index.html.
InchI-Wasm is distributed under the terms of the MIT License. See LICENSE-MIT and COPYRIGHT for details.
This project uses an unmodified copy (git submodule) of the InChI Core Software v1.06, which is licensed under the terms of the InChI Trust License.