Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS Bindings: Improve setup and build instructions #1258

Merged
merged 2 commits into from
Jul 9, 2021

Conversation

frericp
Copy link
Collaborator

@frericp frericp commented Jul 5, 2021

This PR consolidates the setup and build instructions in the readme by

  • delegating specific steps to original tool documentation pages (e.g. emscripten, Docker)
  • adding more details on using the emsdk directly
  • explaining alternatives to using the emsdk directly
  • clarifying usage of the official Docker image

Furthermore, once of the examples in codeExamples.md is updated. The other ones still need to changed, once we know how they should look like (C++ and Python and outdated atm).

A note for reviewers: It might make sense to look at the updated document separately to read the instructions in one piece, instead of trying to follow them in the diff view.

The different sections of this readme will be moved to their official locations in a follow-up PR.

Update #1184

@frericp frericp force-pushed the adsk_contrib/consolidate_documentation branch from 4e29b8d to c7891f4 Compare July 6, 2021 16:06
@@ -107,7 +107,7 @@ describe('Code Examples', () => {
}
}
expect(elementCount).to.equal(21);
expect(nodeCount).to.equal(5);
expect(nodeCount).to.equal(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this passing before? What params takes isANode, sounds weird to take params but, I guess it is just part of the API.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was passing before, because we used another check in the loop (instanceof mx.Node vs isANode('image')). So now we're only looking at image nodes explicitly, whereas before all nodes where counted. That's also the answer the other question: The parameter of isANode is the node type to check for, e.g. image.


#### Docker
It is recommended to build the project with Docker, here are the required steps:
Setting the environment variables permanently is also possible, either by adding a `--permanent` flag to the `activate` command, or by sourcing the `emsdk_env` script every time a shell is launched, e.g. by adding the `source` call to `~/.bash_profile` or an equivalent file. Note however, that the environment variables set by the emscripten SDK might override existing system settings, like the default Python, Java or NodeJs version, so setting them permanently might not be desired on all systems.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, learned something new with the --permanent flag 😄

```sh
cmake .. -DMATERIALX_BUILD_JS=ON -DMATERIALX_BUILD_RENDER=OFF -DMATERIALX_BUILD_TESTS=OFF -DMATERIALX_EMSDK_PATH=C:\GitHub\PUBLIC\emsdk -G "Ninja"
cmake --build .
docker run --rm -v {path_to_MaterialX_repo}:/src emscripten/emsdk sh -c "cd build && <cmake generator command> && <cmake build command>"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just personal flavor since I skim through readmes looking for the most important info. Can we link cmake generator command to the command above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do that, but I couldn't find a way to link from within a code block.

@frericp frericp merged commit b5eec1f into adsk_contrib/dev Jul 9, 2021
@frericp frericp deleted the adsk_contrib/consolidate_documentation branch July 9, 2021 09:38
jstone-lucasfilm pushed a commit that referenced this pull request Mar 16, 2023
- Adds Metal Support to MaterialXShaderGen Backend
- Adds Metal Support to MaterialX Rendering code for testing generated shaders
- Adds Metal Support to MaterialXView Rendering Support (switchable between Metal and OpenGL, default is Metal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants