A coworker of mine has started looking into more robust build and deployment for USD at our studio, and a roadblock we’ve been running into is how CMake will bake absolute paths into the linking targets (examples of this behavior can be found in some open GitHub issues, like here and here). This makes it difficult to use remote machines with different file paths to build USD plugins.
For reference the resulting pxrTargets.cmake file has blocks like this:
set_target_properties(tf PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;C:/usr/bin/python3/Include;C:/path/to/OpenUSD/Install/Release/include/boost-1_78;C:/path/to/OpenUSD/Install/Release/include"
INTERFACE_LINK_LIBRARIES "arch;Shlwapi.lib;Python3::Python;C:/path/to/OpenUSD/Install/Release/lib/boost_python39-vc143-mt-x64-1_78.lib;C:/path/to/OpenUSD/Install/Release/lib/tbb.lib"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "C:/usr/bin/python3/Include;C:/path/to/OpenUSD/Install/Release/include/boost-1_78;C:/path/to/OpenUSD/Install/Release/include"
)
While trying to find a good fix or workaround for this problem, we noticed that NVIDIA’s pre-built plugins found at their USD landing page don’t have this issue and instead use ${_IMPORT_PREFIX}
even with “external” libraries like boost:
set_target_properties(tf PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/boost-1_78"
INTERFACE_LINK_LIBRARIES "arch;Shlwapi.lib;Python3::Python;${_IMPORT_PREFIX}/lib/boost_python310-vc142-mt-x64-1_78.lib;${_IMPORT_PREFIX}/lib/tbb.lib"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/boost-1_78;${_IMPORT_PREFIX}/include"
)
Does anybody have insight on how to configure CMake or otherwise get a result like NIVIDA’s?