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

Refine MaterialX render module build configuration #1970

32 changes: 23 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ option(MATERIALX_BUILD_GEN_OSL "Build the OSL shader generator back-end." ON)
option(MATERIALX_BUILD_GEN_MDL "Build the MDL shader generator back-end." ON)
option(MATERIALX_BUILD_GEN_MSL "Build the MSL shader generator back-end." ON)
option(MATERIALX_BUILD_RENDER "Build the MaterialX Render modules." ON)
option(MATERIALX_BUILD_RENDER_PLATFORMS "Build platform-specific render modules for each shader generator." ON)
option(MATERIALX_BUILD_OIIO "Build OpenImageIO support for MaterialXRender." OFF)
option(MATERIALX_BUILD_TESTS "Build unit tests." OFF)
option(MATERIALX_BUILD_BENCHMARK_TESTS "Build benchmark tests." OFF)
Expand Down Expand Up @@ -104,6 +105,11 @@ if (MATERIALX_BUILD_JS)
set(MATERIALX_BUILD_TESTS OFF)
endif()

if(MATERIALX_BUILD_GEN_MSL)
# All hardware shading languages currently depend on the GLSL shader generator.
set(MATERIALX_BUILD_GEN_GLSL ON)
endif()

set(MATERIALX_PYTHON_VERSION "" CACHE STRING
"Python version to be used in building the MaterialX Python package (e.g. '3.9').")
set(MATERIALX_PYTHON_EXECUTABLE "" CACHE FILEPATH
Expand Down Expand Up @@ -160,6 +166,7 @@ mark_as_advanced(MATERIALX_BUILD_GEN_OSL)
mark_as_advanced(MATERIALX_BUILD_GEN_MDL)
mark_as_advanced(MATERIALX_BUILD_GEN_MSL)
mark_as_advanced(MATERIALX_BUILD_RENDER)
mark_as_advanced(MATERIALX_BUILD_RENDER_PLATFORMS)
mark_as_advanced(MATERIALX_BUILD_OIIO)
mark_as_advanced(MATERIALX_BUILD_BENCHMARK_TESTS)
mark_as_advanced(MATERIALX_BUILD_SHARED_LIBS)
Expand Down Expand Up @@ -465,15 +472,22 @@ endif()
# Add rendering and viewer subdirectories
if(MATERIALX_BUILD_RENDER)
add_subdirectory(source/MaterialXRender)
add_subdirectory(source/MaterialXRenderHw)
if (MATERIALX_BUILD_GEN_GLSL)
add_subdirectory(source/MaterialXRenderGlsl)
endif()
if (APPLE AND MATERIALX_BUILD_GEN_MSL)
add_subdirectory(source/MaterialXRenderMsl)
endif()
if (MATERIALX_BUILD_GEN_OSL)
add_subdirectory(source/MaterialXRenderOsl)
if(MATERIALX_BUILD_RENDER_PLATFORMS)
set(MATERIALX_BUILD_RENDER_HW OFF)
if(MATERIALX_BUILD_GEN_GLSL AND NOT MATERIALX_BUILD_APPLE_EMBEDDED)
set(MATERIALX_BUILD_RENDER_HW ON)
add_subdirectory(source/MaterialXRenderGlsl)
endif()
if(MATERIALX_BUILD_GEN_MSL AND APPLE)
set(MATERIALX_BUILD_RENDER_HW ON)
add_subdirectory(source/MaterialXRenderMsl)
endif()
if(MATERIALX_BUILD_RENDER_HW)
add_subdirectory(source/MaterialXRenderHw)
endif()
if(MATERIALX_BUILD_GEN_OSL)
add_subdirectory(source/MaterialXRenderOsl)
endif()
endif()
if(MATERIALX_BUILD_VIEWER)
add_subdirectory(source/MaterialXView)
Expand Down