diff --git a/source/JsMaterialX/README.md b/source/JsMaterialX/README.md index 64a530b244..500a4271c3 100644 --- a/source/JsMaterialX/README.md +++ b/source/JsMaterialX/README.md @@ -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. @@ -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.