Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion source/MaterialXTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ endif()

add_custom_command(TARGET MaterialXTest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/../../libraries ${CMAKE_CURRENT_BINARY_DIR}/libraries)
${CMAKE_CURRENT_SOURCE_DIR}/../../libraries ${CMAKE_CURRENT_BINARY_DIR}/libraries)
install(DIRECTORY DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/libraries/stdlib/reference/osl)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../libraries/stdlib/osl/"
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/libraries/stdlib/reference/osl
FILES_MATCHING PATTERN "*.h")
add_custom_command(TARGET MaterialXTest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/../../resources ${CMAKE_CURRENT_BINARY_DIR}/resources)
Expand Down
16 changes: 12 additions & 4 deletions source/MaterialXTest/GenReference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,14 @@ TEST_CASE("GenReference: OSL Reference", "[genreference]")
context.registerSourceCodeSearchPath(librariesPath);
context.getOptions().fileTextureVerticalFlip = true;

mx::OslRendererPtr oslRenderer = mx::OslRenderer::create();
oslRenderer->setOslCompilerExecutable(MATERIALX_OSLC_EXECUTABLE);
oslRenderer->setOslIncludePath(MATERIALX_OSL_INCLUDE_PATH);
bool runCompileTest = !std::string(MATERIALX_OSLC_EXECUTABLE).empty();
mx::OslRendererPtr oslRenderer = nullptr;
if (runCompileTest)
{
oslRenderer = mx::OslRenderer::create();
oslRenderer->setOslCompilerExecutable(MATERIALX_OSLC_EXECUTABLE);
oslRenderer->setOslIncludePath(MATERIALX_OSL_INCLUDE_PATH);
}

const mx::FilePath logPath("genosl_reference_generate_test.txt");
std::ofstream logFile;
Expand Down Expand Up @@ -200,7 +205,10 @@ TEST_CASE("GenReference: OSL Reference", "[genreference]")
file << shader->getSourceCode();
file.close();

oslRenderer->compileOSL(filepath);
if (oslRenderer)
{
oslRenderer->compileOSL(filepath);
}

mx::ImplementationPtr impl = implDoc->addImplementation(node->getName());
impl->setAttribute("node", nodedef->getNodeString());
Expand Down