Skip to content

Project Build Instructions

oh-yes-0-fps edited this page Feb 7, 2023 · 1 revision

This project is not meant to be "run", it is meant tp be compiled as an API to be used in Python and JavaScript.

Both

  • Make sure you have the rust toolchain installed

JavaScript / Web Assembly

  • Open a cli in the directory of the cargo.toml
  • If you do not already have wasm-pack installed, do so with cargo install wasm-pack
  • run wasm-pack build --target {TARGET} --features wasm with ur desired target (web, nodejs, bundler) instead of {TARGET}
  • it will create a folder in the project directory called pkg with your wasm and glue code

Python

  • There are tools to help make this more painless but i will explain a tool free way
  • Open a cli in the directory of the cargo.toml
  • Run cargo build --features python --release (you can optionally give it targets but will default to ur pcs target)
  • In the Target/release folder in ur project there will be a .dll(for windows)
  • Take the dll and rename it to a .pyd(on windows), this can be used as a normal module from here on out
  • I would also reccomend grabbing the .pyi from the associated release to have IDE hints on functions
  • if on mac or linux i would reccomend reading this

Clone this wiki locally