Skip to content

Conversation

@jstone-lucasfilm
Copy link
Member

This changelist consolidates shared CMake logic in PyMaterialX, defining a new mx_add_python_module function to reduce duplication and improve maintainability.

This changelist consolidates shared CMake logic in PyMaterialX, defining a new `mx_add_python_module` function to reduce duplication and improve maintainability.
Copy link
Contributor

@JGamache-autodesk JGamache-autodesk left a comment

Choose a reason for hiding this comment

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

All good!

DESTINATION "${MATERIALX_PYTHON_FOLDER_NAME}")
mx_add_python_module(PyMaterialXGenMdl
LIBRARIES
MaterialXGenMdl)
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly add PyMaterialXGenShader for consistency with the other generators?

The simplification makes it easy to spot inconsistencies in this review.

mx_add_python_module(PyMaterialXRenderOsl
LIBRARIES
PyMaterialXRender
MaterialXRenderOsl)
Copy link
Contributor

Choose a reason for hiding this comment

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

Inconsistent with others, would need:
PyMaterialXGenOsl
MaterialXGenOsl

Copy link
Contributor

@ld-kerley ld-kerley left a comment

Choose a reason for hiding this comment

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

Looks like its heading in a good direction to me - sorry I had written this when you posted it but forgot to hit send

endif()

# Gather source and header files
file(GLOB module_source "${CMAKE_CURRENT_SOURCE_DIR}/*.${args_SOURCE_EXTENSION}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be cleaner - and simpler in the cmake - if we leave the file globing in the respective modules - as we do for the regular MaterialX library modules.

We wouldn't need the code to handle different file extensions, or excluded files then.

This makes it easier if there are ever special case file exceptions etc, as well as following the existing convention.

As some point in the future, personally, I think we should follow CMake recommendation, and not glob for the source files at all - but instead list them explicitly - but thats a debate for another day.

endif()
endif()

function(mx_add_python_module MODULE_NAME)
Copy link
Contributor

Choose a reason for hiding this comment

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

When I added the similar functions for the main MaterialX modules it was suggested these functions should all live in the main CMakeLists.txt file for easy location. So maybe we should follow that convention.

Personally I would prefer to move all the function to a new cmake/utils.cmake file - and simplify the amount of code that live in the main CMakeLists.txt file. Certalizing all the functions - we might find places we can re-use code even more - perhaps.

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.

3 participants