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

libGLFW is not installed as part of the MaterialXGraphEditor target #1245

Closed
dgovil opened this issue Feb 14, 2023 · 7 comments · Fixed by #1680
Closed

libGLFW is not installed as part of the MaterialXGraphEditor target #1245

dgovil opened this issue Feb 14, 2023 · 7 comments · Fixed by #1680

Comments

@dgovil
Copy link
Contributor

dgovil commented Feb 14, 2023

The MaterialXGraphEditor target has a dependency on libGLFW. However this does not get installed when building the graph editor, causing it to be non functional unless the libraries get copied over.

I see that it sets GLFW_INSTALL to OFF , which is oddly what the NanoGUI build does for the Viewer too.
I do however see that NanoGUI says this in its cmake

# Two targets have now been defined: `glfw_objects`, which will be merged into
  # NanoGUI at the end, and `glfw`.  The `glfw` target is the library itself
  # (e.g., libglfw.so), but can be skipped as we do not need to link against it
  # (because we merge `glfw_objects` into NanoGUI).  Skipping is required for
  # XCode, but preferable for all build systems (reduces build artifacts).

Perhaps something similar needs to be done for the GraphEditor so it doesn't have a hard link against libGLFW? or we need to enable the install.

Enabling the install however does cause this error to pop up during the build despite that file existing.

source/MaterialXGraphEditor/External/Glfw/CMake/cmake_uninstall.cmake.in does not exist.

However I do see the file exists on the nanogui side: MaterialXView/NanoGUI/ext/glfw/CMake/cmake_uninstall.cmake.in
So I just wanted to see if there was any insight on why the file was removed, and why the install is disabled? also if there were any ways we could move forward and either inline the symbols or install the lib?

@jstone-lucasfilm
Copy link
Member

These are great notes, @dgovil, and we'd be happy to move forward with either NanoGUI-style GLFW merging or reenabling of GLFW installation. We disabled GLFW installation to keep its footprint as minimal as possible within MaterialX, but it would be fine to add this support back if that proves to be the most natural path forward.

@dgovil
Copy link
Contributor Author

dgovil commented Feb 15, 2023

Ah yeah that makes sense why you did that.

I think either option you mentioned would be good. It would make the default build+install more intuitive for folks.

@nicolaspopravka
Copy link

nicolaspopravka commented Oct 13, 2023

Is this still an issue ?

My default macOS build of MaterialXGraphEditor for Dev Days seems functional without an install of GLFW, afaict. The resulting executable is simply statically linked against libglfw3.a at build time. Here are my steps to build and run it:

mkdir build
cd build
cmake  -DMATERIALX_BUILD_GRAPH_EDITOR=ON ..
cmake --build .
cmake --install .
installed/bin/MaterialXGraphEditor

Happy to look into this further if needed.

@jstone-lucasfilm
Copy link
Member

Thanks for that note, @nicolaspopravka, and I'm CC'ing @dgovil to see if this is still an issue that needs to be resolved on macOS. I haven't encountered this issue in our Linux and Windows builds of MaterialXGraphEditor, but there may be dependencies on specific build choices or environments.

@dgovil
Copy link
Contributor Author

dgovil commented Jan 9, 2024

Ah yeah I haven't hit this in a while either so I think it all works. I'll close this out.

@dgovil dgovil closed this as completed Jan 9, 2024
@dgovil
Copy link
Contributor Author

dgovil commented Jan 29, 2024

Actually, @jstone-lucasfilm we're seeing this again so maybe my testing wasn't thorough. I'll reopen and Lee has a proposed solution.

@dgovil dgovil reopened this Jan 29, 2024
@ld-kerley
Copy link
Contributor

I was digging through some stuff on outside and I think what Nicolas is saying above is 99% correct. If we link against glfw statically, then all will be good. But if MATERIALX_BUILD_SHARED_LIBS is set to ON (which is NOT the default). Then that propagates BUILD_SHARED_LIBS=ON down in to the glfw cmake build.

It looks trivial to amend that so we force glfw to always build static, which I think will take us that final 1% of the way to success - I'll put up a PR soon.

jstone-lucasfilm pushed a commit that referenced this issue Jan 30, 2024
Currently the embedded glfw build for MaterialXGraphEditor inherits the value of BUILD_SHARED_LIBS from MATERIALX_BUILD_SHARED_LIBS, but we're not installing libglfw, per #1245 the intention was to statically link.
kwokcb added a commit to kwokcb/MaterialX that referenced this issue Jan 30, 2024
* Web viewer formatting improvements and fixes (AcademySoftwareFoundation#1635)

- Add colouring to items and folders which can be set vis CSS. This makes it easier to tell what areas are under what folders.
- Fix string disable setting (was using old API).
- Fix parenting of enum widgets to be under current folder instead of top level.

* Add HwImplementation class

This changelist adds an intermediate HwImplementation class, allowing the sharing of common features between node implementations in hardware shading languages.

* Merge geometry node implementations

This changelist merges the implementations of geometry nodes across hardware shading languages, allowing a greater degree of code sharing.

* Merge application node implementations

This changelist merges the implementations of application and NPR nodes across hardware shading languages, allowing a greater degree of code sharing.

* Add vector2 variant of normalmap (AcademySoftwareFoundation#1355)

The materialx specification defines the scale attribute of the normalmap to be either a float or a vector2 but the vector2 variant was missing from the implementation. This PR adds it.

* Renderable logic improvements to web viewer (AcademySoftwareFoundation#1644)

- Adds in proper parsing of renderable elements vs always just picking the first surface shader found.
  - The test suite files which have (multiple) nodegraph outputs and top level outputs will now load properly.
- Adds in UI to mark folders as renderable (using a shaderball icon) 
- Adds in "soloing" capability to allow picking a renderable and have it show up on all geometry. When nothing is solo'ed the default material assignment is used.
- Includes fixes for:
  - Dag path assignment matching .
  - Missing exposure of NodeGraph::getDownStreamPorts() in JS.
  - Addressing the big performance hit when binding materials to geometry in ThreeJS. The code by default is some quite slow code for reflection / debugging purposes which is now turned off. Chess set load is seconds vs minutes. This affects the 'solo'ing workflow significantly as each switch is a geometry re-bind. If the material is not already cached then slow code will be hit which can cause seconds to pass when selecting a new material -- which appears like a "hang" from a user perspective.

* Fix irradiance generation in MaterialXView (AcademySoftwareFoundation#1647)

This changelist fixes a regression to environment irradiance generation in MaterialXView, caused by a change to image caching logic for GLSL rendering in MaterialX 1.38.8.  This fix restores the ability to render environment maps that are missing their pre-generated irradiance data, with irradiance being generated on the fly via spherical harmonics.

* Add UI limits for useSpecularWorkflow and normal in UsdPreviewSurface (AcademySoftwareFoundation#1646)

UsdPreviewSurface allows useSpecularWorkflow to be 0 or 1. Normals should have values between -1 to 1, inclusive. This PR puts these limits into place.

* Unify noise unit tests

This changelist merges two sets of noise unit tests into a single document, and aligns their implementations for clarity.

* Static analysis optimizations

This changelist addresses a handful of static analysis optimizations flagged by PVS-Studio and cppcheck, including the following:

- Pass immutable std::string, FilePath, and FileSearchPath arguments by const reference.
- Mark immutable ShaderGenerator references as const.
- Prefer std::string::empty over comparison against an empty string.
- Remove unused private methods Graph::findLinkId, Graph::findInput, and Graph::selectMaterial.
- Remove variable assignments with no impact on code behavior.

* Improvements to noise implementations (AcademySoftwareFoundation#1653)

- Leverage node graphs to share the conversion aspects of noise implementations across languages.
- Simplify noise unit tests to cover only unique implementations.

* Fix shader generation typos

This changelist fixes a handful of minor typos in shader generation, introduced in AcademySoftwareFoundation#1355 and AcademySoftwareFoundation#1553.

* Add frame capture to web viewer (AcademySoftwareFoundation#1636)

Add frame capture code to trigger on 'f' key. This is the same key as used for the desktop viewer.

* Document format updates

This changelist applies the mxformat.py script to the libraries and resources folders in the repository, updating formatting for a handful of documents.

* Add versioning rules to Developer Guide (AcademySoftwareFoundation#1664)

This changelist adds two new sections to the Developer Guide, describing the categories of changes to the MaterialX API and data libraries that are allowed in version upgrades.

* Improve robustness of TypeDesc pointer comparisons (AcademySoftwareFoundation#1665)

- The globals presets defined for TypeDesc are pointers which may not be shared between shared modules. This occurs for instance in Python where the pointers are declared locally for each module.
- Any pointer comparison between the same TypeDesc preset can thus result in a failure status.

* Improvements to smoothstep implementations

- Leverage node graphs to share the conversion aspects of smoothstep implementations across languages.
- Simplify smoothstep unit tests to cover only unique implementations.

* Update changelog for recent work

* Update comments in stdlib_ng.mtlx

This changelist updates the comments in stdlib_ng, aligning them with the conventions for nodegraph definitions in the data libraries.

* Fix orphaned links when deleting node in graph editor (AcademySoftwareFoundation#1667)

This PR introduces fixes related to the removal of orphaned links when deleting a node in the Graph Editor:
- remove the attribute `INTERFACE_NAME_ATTRIBUTE` of input pins that were connected to the deleted node
(Fixes AcademySoftwareFoundation#1577) 
- iterate over all of the output pins instead of only handling the first one.
(Fixes AcademySoftwareFoundation#1666)

* Add facingratio node to nprlib (AcademySoftwareFoundation#1671)

This changelist adds a `facingratio` node to the NPR data library, providing an additional intermediate node for building NPR graphs.

* Add geometry drag & drop to web viewer (AcademySoftwareFoundation#1663)

- Add support to recognize dropping of individual geometry (glb) files.
- Minor cleanup to stop if no MTLX or GLB files loaded.

* Apply JavaScript formatting

This changelist applies automated formatting to the MaterialX JavaScript codebase, aligning it with the 4-space indentation and Allman braces used in MaterialX C++.

* Add missing classification of VolumeShader nodes (AcademySoftwareFoundation#1675)

ShaderNodes.cpp had missing classification information for Volume Shaders. This PR is a simple addition of that classification.

* Add invert node to specification (AcademySoftwareFoundation#1676)

The node exists in the standard library code, but is missing from the specification.

* Improvements to facingratio

- Fix syntax of input default values.
- Use the invert node in facingratio for compactness.
- Clarify the edge brighten example material.

* Always build GLFW as a static library (AcademySoftwareFoundation#1680)

Currently the embedded glfw build for MaterialXGraphEditor inherits the value of BUILD_SHARED_LIBS from MATERIALX_BUILD_SHARED_LIBS, but we're not installing libglfw, per AcademySoftwareFoundation#1245 the intention was to statically link.

---------

Co-authored-by: Jonathan Stone <jstone@lucasfilm.com>
Co-authored-by: mnikelsky <michael.nikelsky@autodesk.com>
Co-authored-by: Eric Haines <erich@acm.org>
Co-authored-by: Leo Belda <leo.belda@wanadoo.fr>
Co-authored-by: Dhruv Govil <dgovil2@apple.com>
Co-authored-by: ld-kerley <154285602+ld-kerley@users.noreply.github.com>
kwokcb added a commit to kwokcb/MaterialX that referenced this issue Jan 30, 2024
* Apply JavaScript formatting

This changelist applies automated formatting to the MaterialX JavaScript codebase, aligning it with the 4-space indentation and Allman braces used in MaterialX C++.

* Add missing classification of VolumeShader nodes (AcademySoftwareFoundation#1675)

ShaderNodes.cpp had missing classification information for Volume Shaders. This PR is a simple addition of that classification.

* Add invert node to specification (AcademySoftwareFoundation#1676)

The node exists in the standard library code, but is missing from the specification.

* Improvements to facingratio

- Fix syntax of input default values.
- Use the invert node in facingratio for compactness.
- Clarify the edge brighten example material.

* Always build GLFW as a static library (AcademySoftwareFoundation#1680)

Currently the embedded glfw build for MaterialXGraphEditor inherits the value of BUILD_SHARED_LIBS from MATERIALX_BUILD_SHARED_LIBS, but we're not installing libglfw, per AcademySoftwareFoundation#1245 the intention was to statically link.

---------

Co-authored-by: Jonathan Stone <jstone@lucasfilm.com>
Co-authored-by: Dhruv Govil <dgovil2@apple.com>
Co-authored-by: ld-kerley <154285602+ld-kerley@users.noreply.github.com>
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 a pull request may close this issue.

4 participants