Skip to content

Commit

Permalink
Update readme for JsMaterialX (#1214)
Browse files Browse the repository at this point in the history
* Update readme for JsMaterialX
  • Loading branch information
aGuluzade authored Jun 23, 2021
1 parent b4168e2 commit 8d015d7
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions source/JsMaterialX/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,31 @@ The emscripten toolchain is documented [here](https://emscripten.org/docs/buildi
### Build
In the root of directory of this repository run the following:

#### Docker (recommended on Windows machines, not required otherwise)
It is recommended to build the project with [docker](https://docs.docker.com/) here are the required steps:
#### Docker
It is recommended to build the project with Docker, here are the required steps:

1. Download and install [Docker](https://docs.docker.com/) as instructed on the documentation.

For Windows make sure to use Linux containers and that File Sharing is set up to allow local directories on Windows to be shared with Linux containers.

1. For Windows make sure to use Linux containers and that File Sharing is set up to allow local directories on Windows to be shared with Linux containers.

For example, if the path to MaterialX is ```"c:\git\MaterialXrepo"``` then the ```"c"``` drive should be set. (See https://docs.docker.com/docker-for-windows/#file-sharing for more details)

If you work on WSL (Windows Subsystem for Linux), install [Docker](https://docs.docker.com/docker-for-windows/install/) for Windows.

2. Get the `emscripten` docker image
```sh
docker run -dit --name emscripten -v {path_to_MaterialX}:/src trzeci/emscripten:1.39.7-upstream bash
docker run -p 8080:8080 -dit --name emscripten -v {path_to_MaterialX}:/src trzeci/emscripten:1.39.7-upstream bash
```
For WSL, make sure to run the command on a Windows terminal and also to adjust the path (e.g, `"C:\Users\{windows_username}\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_{local_code}\LocalState\rootfs\{WSL_path_to_MaterialX}"`).

3. Build the JavaScript bindings.
3. Create a build directory.
```sh
docker exec -it emscripten sh -c "[ -d build ] || mkdir build"
```
4. Build the JavaScript bindings.
```sh
docker exec -it emscripten sh -c "cd build && cmake .. -DMATERIALX_BUILD_JS=ON -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_TESTS=OFF -DMATERIALX_EMSDK_PATH=/emsdk_portable/ && cmake --build . --target install"
```

#### CMake
The JavaScript library can be built using cmake and make.

Expand Down Expand Up @@ -83,7 +91,7 @@ After building the project the `JsMaterialX.wasm` and `JsMaterialX.js` files can
### Install
To install the results into the test directory run
```sh
cmake --build --target install
cmake --build . --target install
```
from the build directory.

Expand Down

0 comments on commit 8d015d7

Please sign in to comment.