|
| 1 | + |
| 2 | +There are two ways to build pyodide ifcopenshell Python wrapper wheel. |
| 3 | + |
| 4 | +1. Using pyodide build system (`build_pyodide.yml` does it): |
| 5 | + |
| 6 | +- setup pyodide environment in `pyodide_root` folder - either by using image or build it from source - see https://pyodide.org/en/stable/development/building-from-sources.html |
| 7 | +- clone IfcOpenShell repo next to it to `IfcOpenShell` folder |
| 8 | +- create `packages/ifcopenshell` folder that will be used by pyodide build system |
| 9 | +- from `IfcOpenShell` move building recipe `pyodide/meta.yaml` to `packages/ifcopenshell` |
| 10 | +- run `pyodide build-recipes ifcopenshell --install`, it will |
| 11 | + - execute `meta.yaml` recipe - it will: |
| 12 | + - copy IfcOpenShell source to build folder `packages/ifcopenhell/build/ifcopenshell-0.8.0` |
| 13 | + - build ifcopenshell and its dependencies |
| 14 | + - note that rerunning `pyodide build-recipes` will remove previous build folder and rebuild all dependencies. |
| 15 | + The way to avoid it, if build fails, is to use `pyodide build-recipes-no-deps ifcopenshell --continue` instead. |
| 16 | + - run `pyodide/setup.py` in `IfcOpenShell` root, producing a wheel in `IfcOpenShell/dist` |
| 17 | + - copy that wheel to `packages/ifcopenshell/dist` |
| 18 | + - `--install` it to current build envrionment |
| 19 | + - copy the wheel next to `dist` folder (in root directory, next to `packages`) |
| 20 | + - add wheel to `dist/pyodide-lock.json` |
| 21 | + |
| 22 | +2. Build it outside of pyodide system. |
| 23 | + |
| 24 | +Building inside pyodide build system should be preferred, option to build it outside is useful for debugging purposes, |
| 25 | +since it's pure cmake without any additional moving parts. |
| 26 | + |
| 27 | +- setup pyodide environment in `pyodide_root` folder, see above |
| 28 | +- clone IfcOpenShell repo next to it to `IfcOpenShell` folder |
| 29 | +- setup debug build environment using `source pyodide/debug_build_env.sh /path/to/pyodide_root` |
| 30 | +- run `python nix/build-all.py -wasm -py-313` in `IfcOpenShell` |
| 31 | + - it will produce Python package in `IfcOpenShell/ifcopenshell` |
| 32 | +- move `IfcOpenShell/pyodide/setup.py` to `IfcOpenShell` root |
| 33 | +- run `pyodide build` |
| 34 | + - it will produce a wheel in `IfcOpenShell/dist` |
0 commit comments