Skip to content
Snippets Groups Projects
Commit 13b1d8d5 authored by Brecht Van Lommel's avatar Brecht Van Lommel
Browse files

Fix build failure when WITH_USD=OFF and WITH_MATERIALX=ON

parent fb2f77d0
No related branches found
No related tags found
No related merge requests found
...@@ -139,10 +139,6 @@ set(LIB ...@@ -139,10 +139,6 @@ set(LIB
if(WITH_MATERIALX) if(WITH_MATERIALX)
add_definitions(-DWITH_MATERIALX) add_definitions(-DWITH_MATERIALX)
list(APPEND INC
${USD_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
)
list(APPEND SRC list(APPEND SRC
materialx/material.cc materialx/material.cc
materialx/node_item.cc materialx/node_item.cc
...@@ -158,6 +154,14 @@ if(WITH_MATERIALX) ...@@ -158,6 +154,14 @@ if(WITH_MATERIALX)
MaterialXCore MaterialXCore
MaterialXFormat MaterialXFormat
) )
if(WITH_USD)
add_definitions(-DWITH_USD)
list(APPEND INC_SYS
${USD_INCLUDE_DIRS}
${BOOST_INCLUDE_DIR}
)
endif()
endif() endif()
if(WITH_FREESTYLE) if(WITH_FREESTYLE)
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
* *
* SPDX-License-Identifier: GPL-2.0-or-later */ * SPDX-License-Identifier: GPL-2.0-or-later */
#ifdef WITH_USD
# include <pxr/base/tf/stringUtils.h> # include <pxr/base/tf/stringUtils.h>
#endif
#include "node_parser.h" #include "node_parser.h"
...@@ -63,9 +65,13 @@ NodeItem NodeParser::compute_full() ...@@ -63,9 +65,13 @@ NodeItem NodeParser::compute_full()
std::string NodeParser::node_name(bool with_out_socket) const std::string NodeParser::node_name(bool with_out_socket) const
{ {
auto valid_name = [](const std::string &name) { auto valid_name = [](const std::string &name) {
#ifdef WITH_USD
/* Node name should suite to MatX and USD valid names. /* Node name should suite to MatX and USD valid names.
* It shouldn't start from '_', due to error occured in Storm delegate. */ * It shouldn't start from '_', due to error occured in Storm delegate. */
std::string res = MaterialX::createValidName(pxr::TfMakeValidIdentifier(name)); std::string res = MaterialX::createValidName(pxr::TfMakeValidIdentifier(name));
#else
std::string res = MaterialX::createValidName(name);
#endif
if (res[0] == '_') { if (res[0] == '_') {
res = "node" + res; res = "node" + res;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment