Before building USD, set up your environment variables according to your platform. You can customize these paths to match your specific setup.
USD_SOURCE_DIR
: Location of the USD source codeUSD_DEPS_DIR
: Directory for building and installing dependenciesUSD_BUILD_DIR
: Directory for building USDUSD_INSTALL_DIR
: Directory where USD will be installedUSD_PYTHON_ROOT
: Base directory of your Python installationUSD_PYTHON_EXE
: Path to the Python executable
# Set up environment variables for paths
export USD_SOURCE_DIR=~/dev/usd-github-meshula # USD source code location
export USD_DEPS_DIR=/var/tmp/usd-test/__deps # Dependencies directory
export USD_BUILD_DIR=/var/tmp/usd-build # USD build directory
export USD_INSTALL_DIR=${USD_BUILD_DIR}/install # USD installation directory
export USD_PYTHON_ROOT=/usr/local/pixar/bin # Python installation directory
export USD_PYTHON_EXE=${USD_PYTHON_ROOT}/python # Python executable
# Create necessary directories
mkdir -p ${USD_DEPS_DIR}
mkdir -p ${USD_DEPS_DIR}/install
mkdir -p ${USD_BUILD_DIR}
:: Set up environment variables for paths
:: Adjust these paths according to your setup
set USD_SOURCE_DIR=%USERPROFILE%\dev\USD-meshula :: USD source code location
set USD_DEPS_DIR=%USERPROFILE%\dev\deps :: Dependencies directory
set USD_BUILD_DIR=%USERPROFILE%\dev\build\usd :: USD build directory
set USD_INSTALL_DIR=%USD_BUILD_DIR%\install :: USD installation directory
set USD_PYTHON_ROOT=%LOCALAPPDATA%\Programs\Python\Python39 :: Python installation directory
set USD_PYTHON_EXE=%USD_PYTHON_ROOT%\python.exe :: Python executable
:: Create necessary directories
mkdir %USD_DEPS_DIR%
mkdir %USD_DEPS_DIR%\install
mkdir %USD_BUILD_DIR%
# Set up environment variables for paths
export USD_SOURCE_DIR=~/dev/usd-github-meshula # USD source code location
export USD_DEPS_DIR=~/deps # Dependencies directory
export USD_BUILD_DIR=~/build/usd # USD build directory
export USD_INSTALL_DIR=~/install/USD # USD installation directory
# Python path - adjust based on your distribution and Python version
# For system Python:
export USD_PYTHON_ROOT=/usr/bin
export USD_PYTHON_EXE=${USD_PYTHON_ROOT}/python3
# For conda environments (uncomment if using conda):
#export USD_PYTHON_ROOT=$CONDA_PREFIX
#export USD_PYTHON_EXE=${USD_PYTHON_ROOT}/bin/python
# Create necessary directories
mkdir -p ${USD_DEPS_DIR}
mkdir -p ${USD_DEPS_DIR}/install
mkdir -p ${USD_BUILD_DIR}
# Change to dependencies directory
cd ${USD_DEPS_DIR}
# OneTBB
curl -L https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.9.0.zip --output oneTBB-2021.9.0.zip
unzip oneTBB-2021.9.0.zip && mv oneTBB-2021.9.0/ oneTBB
cd oneTBB && mkdir -p build && cd build
cmake .. -DTBB_TEST=OFF -DTBB_STRICT=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${USD_DEPS_DIR}/install
cmake --build . --config Release && cmake --install .
cd ../..
# OpenSubdiv
curl -L https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v3_6_0.zip --output OpenSubdiv.3.6.0.zip
unzip OpenSubdiv.3.6.0.zip && mv OpenSubdiv-3_6_0/ OpenSubdiv
cd OpenSubdiv && mkdir build && cd build
cmake .. -DNO_OPENGL=ON -DNO_EXAMPLES=ON -DNO_TUTORIALS=ON -DNO_REGRESSION=ON -DNO_DOC=ON -DNO_OMP=ON -DNO_CUDA=ON -DNO_OPENCL=ON -DNO_DX=ON -DNO_TESTS=ON -DNO_GLEW=ON -DNO_GLFW=ON -DNO_PTEX=ON -DNO_TBB=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${USD_DEPS_DIR}/install
cmake --build . --config Release && cmake --install .
cd ../..
cmake ${USD_SOURCE_DIR} -G Xcode -DCMAKE_INSTALL_PREFIX=${USD_INSTALL_DIR} -DPython3_ROOT="${USD_PYTHON_ROOT}" -DPython3_EXECUTABLE="${USD_PYTHON_EXE}"
Note that we may point to the python for tools to use even though we are building USD without python runtime support.
First, delete cmake/modules/FindOpenSubdiv.cmake as it is not compatible with the cmake config file OpenSubdiv installs.
cd ${USD_BUILD_DIR}
cmake ${USD_SOURCE_DIR} -G Xcode -DCMAKE_INSTALL_PREFIX=${USD_INSTALL_DIR} -DPython3_ROOT="${USD_PYTHON_ROOT}" -DPython3_EXECUTABLE="${USD_PYTHON_EXE}" -DPXR_ENABLE_PYTHON_SUPPORT=OFF -DCMAKE_PREFIX_PATH=${USD_DEPS_DIR}/install -DTBB_ROOT=${USD_DEPS_DIR}/install
# Build USD without Python support
${USD_PYTHON_EXE} ${USD_SOURCE_DIR}/build_scripts/build_usd.py \
--generator Xcode \
--tests \
--no-python \
--no-openimageio \
--opencolorio \
--build-variant relwithdebuginfo \
${USD_BUILD_DIR} \
| grep -v -e "note: Run script build phase" \
-e "RegisterExecutionPolicyException" \
-e "PhaseScriptExecution" \
-e "ClangStatCache" \
-e " cd" \
-e "note: Removed stale file" \
-e "ProcessProductPackaging"
# Build USD with Python support
${USD_PYTHON_EXE} ${USD_SOURCE_DIR}/build_scripts/build_usd.py \
--generator Xcode \
--tests \
--no-openimageio \
--opencolorio \
--build-variant relwithdebuginfo \
${USD_BUILD_DIR} \
| grep -v -e "note: Run script build phase" \
-e "RegisterExecutionPolicyException" \
-e "PhaseScriptExecution" \
-e "ClangStatCache" \
-e " cd" \
-e "note: Removed stale file" \
-e "ProcessProductPackaging"
:: Build USD without Python support
%USD_PYTHON_EXE% %USD_SOURCE_DIR%\build_scripts\build_usd.py ^
--no-openimageio ^
--opencolorio ^
--no-python ^
--build-variant=relwithdebuginfo ^
%USD_BUILD_DIR%
First, install required system dependencies:
sudo apt install libx11-dev libxt-dev libxrandr-dev
Set up Python environment:
- Create a venv or conda environment
- Install required packages:
pip install PySide6 pyopengl
Build USD without Python support:
${USD_PYTHON_EXE} ${USD_SOURCE_DIR}/build_scripts/build_usd.py \
--no-python \
${USD_INSTALL_DIR}
Note: If build fails, modify src/oneTBB-2020.3.1/build/common.inc
to add detection for "linux" in addition to "Linux"
Build USD with Python support (requires Python development libraries):
${USD_PYTHON_EXE} ${USD_SOURCE_DIR}/build_scripts/build_usd.py \
${USD_INSTALL_DIR}
Note: Ensure your conda environment includes the appropriate Python development libraries (e.g., python3.12.a)
To configure Xcode for USD development:
- Edit Scheme > Arguments
- Add a USD_INSTALL_DIR environment variable corresponding to the set up above.
- Add the PXR_PLUGINPATH_NAME variable so plugins will be discovered:
PXR_PLUGINPATH_NAME=${USD_INSTALL_DIR}/lib/usd
To start the SSH agent for repository access:
eval $(ssh-agent -s)