Houdini libraries that must be recompiled to use Houdini with a custom build of the USD library.
In order for this to work, there are a few requirements for how the USD library is built:
- You must define "_GLIBCXX_USE_CXX11_ABI=0"
- You must set the compile flag "-std=c++14"
These conditions can be met by editing USD/cmake/defaults/gccclangshareddefaults.cmake to set these options. Specifically, the following line:
set(_PXR_GCC_CLANG_SHARED_CXX_FLAGS "${_PXR_GCC_CLANG_SHARED_CXX_FLAGS} -std=c++11")
Should be replaced by:
set(_PXR_GCC_CLANG_SHARED_CXX_FLAGS "${_PXR_GCC_CLANG_SHARED_CXX_FLAGS} -std=c++14")
set(_PXR_GCC_CLANG_SHARED_CXX_FLAGS "${_PXR_GCC_CLANG_SHARED_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
In addition, the boost build used by USD must also set these options, which can be done by editing the USD/build_scripts/build_usd.py file. Specifically, the following lines must be added to the b2_settings variable:
'cflags="-fPIC -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0"'
'cxxflags="-fPIC -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0"'
Because the gusd library gets built into Houdini, you should not build the Houdini operators when doing your build of USD. Instead, you should build the Pixar operators from the $HT/samples/USD directory that comes with Houdini. You can of course update the source files in there from your USD repository if you have newer code than what ships with Houdini.
Once you have built USD, it is time to build the replacement libHoudiniUSD.so (libHUSD.dll and libgusd.dll on Windows), USD_Plugins.so, and other libraries. You must use CMake to build these libraries. CMake version 3.12 is required (due to the use of add_compile_definitions).
The following variables are used to configure the CMake build:
- HOUDINI_PATH: The path to the root of the Houdini install. If this is omitted, the $HFS environment variable will be checked as well.
- USD_ROOT: The path to the USD install.
- USD_LIB_PREFIX: The naming prefix of the USD libraries to build/link against.
This should match the value of the
PXR_LIB_PREFIX
CMake variable used to build USD, and defaults to "lib" (which matches the USD build default). - BOOST_NAMESPACE: The namespace of the Boost build used by the external USD build. This defaults to "boost".
- COPY_HOUDINI_USD_PLUGINS: Whether to copy the $HH/dso/usd_plugins directory from the Houdini install into the HoudiniUsdBridge install tree. This defaults to ON.
Once the libraries are built, copy libHoudiniUSD.so to the $HDSO ($HB on Windows) directory (where most Houdini shared libraries are installed). You will probably want to move aside the existing libraries first in case there is a problem with the new libraries. The USD_Plugins.so library should be copied to $HH/dso/usd. And the USD_Ops.so library should be copied to $HH/dso.
The libpxr_usd_ms.so library is an empty library with no actual functionality in it. It's purpose is simply to allow Houdini's other libraries to satisfy their link dependencies on that library name. The symbols that used to be exported from this library will instead come from your USD build which can be installed elsewhere. All the libpxr libraries in $HDSO or $HB should be replaced with this empty dummy library to avoid duplicate symbols.
The Houdini USD build has a number of directories automatically added to the USD plugin path ($HDSO/usd_plugins and $HH/dso/usd_plugins). You may need to add these explicitly to your USD plugin path environment variable to ensure that the Houdini USD plugins are loaded by your USD build.
Always build the HoudiniUsdBridge in Release mode. Even RelWithDebInfo has been reported to cause crashes and other bad behavior.
The USD library on which these libraries are built is created by Pixar: https://github.com/PixarAnimationStudios/USD SideFX also maintains a fork of this repository: https://github.com/sideeffects/USD
The code in the 'src/houdini/lib/H_USD/gusd' directory of this repository began as a direct copy of the 'third_party/houdini/lib/gusd' directory from this USD repository, and so still contains the original Pixar copyright notices.