Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jgsogo/blog-emsdk-magnum-viewer
Example using `magnum` to render 3D in the browser
https://github.com/jgsogo/blog-emsdk-magnum-viewer
conan emscripten emsdk magnum
Last synced: about 1 month ago
JSON representation
Example using `magnum` to render 3D in the browser
- Host: GitHub
- URL: https://github.com/jgsogo/blog-emsdk-magnum-viewer
- Owner: jgsogo
- License: mit
- Created: 2021-10-06T20:55:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-18T21:34:03.000Z (over 3 years ago)
- Last Synced: 2024-10-15T02:12:57.242Z (3 months ago)
- Topics: conan, emscripten, emsdk, magnum
- Language: Python
- Homepage: https://jgsogo.es/blog-20211008-example-emsdk-magnum/viewer.html
- Size: 323 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Example using Emscripten to build Magnum
Example using `magnum` to render 3D in the browser### Build & Run locally
This example is using a recipe for `magnum` that is modified a little bit from the
one you can find in `conan-center-index` repository. These modifications are needed
in order to build it for Emscripten.Steps to follow:
1. (Optional) Configure Conan client
```
export CONAN_USER_HOME=$(pwd)
conan config set general.revisions_enabled=1
```1. Export some slightly modified recipes to local cache:
* `magnum` prepared for emscripten (using SDL2 port)
* `libjpeg` with a workaround for https://github.com/conan-io/conan/issues/7526```
conan export .conan/recipes/magnum/all/conanfile.py magnum/2020.06@
conan export .conan/recipes/libjpeg/all/conanfile.py libjpeg/9d@
```1. Create and move to your folder directory
```
mkdir cmake-build-emsdk && cd cmake-build-emsdk
```1. Create the lockfile for your configuration
```
conan lock create --profile:host=../.conan/profiles/emsdk --profile:build=default --lockfile=../lockfile.json --lockfile-out=lockfile.json --name=viewer --version=0.1 ../conanfile.txt --build --update
```
1. Install and build missing packages (ConanCenter doesn´t provide binaries for Emscripten)```
conan install --lockfile=lockfile.json ../conanfile.txt --build=missing --generator=virtualenv
```1. Configure and cross-build using CMake
```
source activate.sh
cmake .. -DCMAKE_MODULE_PATH=$(pwd) -DCMAKE_TOOLCHAIN_FILE=$CONAN_CMAKE_TOOLCHAIN_FILE
make
```1. Run and enjoy
```
python -m http.server --directory bin
```And open your browser at `http://localhost:8000/viewer.html`
### Update dependencies
In order to update the lockfile, just modify the `conanfile.txt` with new requirements
and then regenerate the base lockfile:```
conan lock create --name=viewer --version=0.1 --base --lockfile-out lockfile.json conanfile.txt --build --profile:host=.conan/profiles/emsdk --profile:build=default
```