Fix blender failing to link WITH_USD when building for the first time

Blender would fail to link to USD before MaterialX files were
copied to the install targets lib/ directory.
Resolve by including ${LIBDIR}/materialx/lib in link_directories.
This commit is contained in:
Campbell Barton
2023-05-10 16:19:53 +10:00
parent 0d171bc5be
commit ed5dee857e

View File

@@ -75,6 +75,18 @@ if(WITH_TBB)
endif()
endif()
if(WITH_USD)
# USD links libMaterialX, when using pre-compiled libraries
# ensures `usd_ms` can find `MaterialXRender` and friends.
#
# NOTE: This is _only_ needed when linking blender before the install target runs.
# Once MATERIALX libraries have been copied into `TARGETDIR_LIB` then Blender will link.
# Don't rely on this though as failing on a fresh build is no good and the library
# files could get outdated too.
if(DEFINED LIBDIR)
link_directories(${LIBDIR}/materialx/lib)
endif()
endif()
if(WITH_PYTHON)
list(APPEND INC ../blender/python)