Skip to content

Commit d3991f7

Browse files
sunyabpixar-oss
authored andcommitted
hdPrmanXpuLoader: Fix link issues on Linux and macOS
The hdPrmanXpuLoader plugin currently links against hdPrmanLoader, which is also a plugin. However, the build system assumes that plugins are leaf libraries with no dependents and does not set up an RPATH entry pointing to the plugin install directory. This leads to an error when trying to switch to RenderMan XPU in usdview: loading hdPrmanXpuLoader fails because it can't find its hdPrmanLoader dependency at runtime. This fix works around the issue by forcing the addition of the plugin install directory to hdPrmanXpuLoader's RPATH. This is intended to be a short term patch while we explore other ways to structure these loader plugins. (Internal change: 2372879)
1 parent 7812b47 commit d3991f7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

third_party/renderman-26/plugin/hdPrmanXpuLoader/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ pxr_plugin(hdPrmanXpuLoader
1919
)
2020

2121
if(TARGET hdPrmanXpuLoader)
22+
# XXX:
23+
# The build system does not expect plugins to link against other
24+
# plugins, so it does not automatically set up an RPATH that lets
25+
# us find hdPrmanLoader at runtime. We do that manually here,
26+
# assuming that hdPrmanLoader will be installed into the same
27+
# directory.
28+
get_target_property(rpath ${PXR_PACKAGE} INSTALL_RPATH)
29+
if (rpath)
30+
if (APPLE)
31+
list(APPEND rpath "@loader_path")
32+
else()
33+
list(APPEND rpath "$ORIGIN")
34+
endif()
35+
36+
set_target_properties(${PXR_PACKAGE}
37+
PROPERTIES
38+
INSTALL_RPATH "${rpath}"
39+
)
40+
endif()
41+
2242
target_include_directories(${PXR_PACKAGE}
2343
PRIVATE
2444
"${PROJECT_BINARY_DIR}/include/pxr/imaging"

0 commit comments

Comments
 (0)