Files
tinyusdz/aousd/setup_openusd_nopython_monolithic.sh
Syoyo Fujita fb0a9e9619 Add no-Python build variants for OpenUSD
Adds two new C++-only build variants without Python bindings:
- Standard no-python build (43 modular libraries, 320 MB)
- Monolithic no-python build (single libusd_ms.so, 417 MB)

These builds are ideal for:
- Pure C++ applications without Python dependencies
- Embedded systems with limited resources
- Server-side processing deployments
- Production environments requiring minimal footprint

New scripts:
- setup_openusd_nopython.sh - Build standard C++-only variant
- setup_openusd_nopython_monolithic.sh - Build monolithic C++-only variant
- setup_env_nopython.sh - Environment setup (auto-generated)
- setup_env_nopython_monolithic.sh - Environment setup (auto-generated)

Documentation:
- Updated aousd/README.md with all four build variants
- Added README_BUILD_COMPARISON.md for detailed comparison

All four OpenUSD build variants now available:
1. Standard (with Python, 45+ libs, with tools)
2. Monolithic (with Python, 1 lib, with tools)
3. No-Python Standard (C++-only, 43 libs, library-only)
4. No-Python Monolithic (C++-only, 1 lib, library-only)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 01:47:18 +09:00

169 lines
5.1 KiB
Bash
Executable File

#!/bin/bash
# OpenUSD No-Python Monolithic Build Setup Script for comparison with TinyUSDZ
# This script clones, builds, and installs OpenUSD as a single monolithic library
# WITHOUT Python bindings - ideal for C++-only production deployments
set -e # Exit on error
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OPENUSD_DIR="${SCRIPT_DIR}/OpenUSD"
DIST_DIR="${SCRIPT_DIR}/dist_nopython_monolithic"
echo "================================================"
echo "OpenUSD No-Python Monolithic Build Setup Script"
echo "================================================"
echo "Working directory: ${SCRIPT_DIR}"
echo ""
# Step 1: Clone OpenUSD repository
echo "Step 1: Cloning OpenUSD repository (release branch)..."
if [ -d "${OPENUSD_DIR}" ]; then
echo "OpenUSD directory already exists. Pulling latest changes..."
cd "${OPENUSD_DIR}"
git fetch origin
git checkout release
git pull origin release
else
git clone -b release https://github.com/lighttransport/OpenUSD.git "${OPENUSD_DIR}"
fi
# Step 2: Setup compilers
echo ""
echo "Step 2: Setting up C/C++ compilers..."
# Allow user to override compilers via environment variables
# If not set, try to find suitable defaults
if [ -z "$CC" ]; then
if command -v gcc &> /dev/null; then
export CC=gcc
elif command -v clang &> /dev/null; then
export CC=clang
else
echo "Error: No C compiler found. Please install gcc or clang."
exit 1
fi
fi
if [ -z "$CXX" ]; then
if command -v g++ &> /dev/null; then
export CXX=g++
elif command -v clang++ &> /dev/null; then
export CXX=clang++
else
echo "Error: No C++ compiler found. Please install g++ or clang++."
exit 1
fi
fi
echo "Using C compiler: $CC"
echo "Using C++ compiler: $CXX"
# Step 3: Build OpenUSD with Monolithic option and without Python
echo ""
echo "Step 3: Building OpenUSD with MONOLITHIC option and NO Python..."
echo "This may take a while..."
cd "${OPENUSD_DIR}"
# Prepare build arguments for monolithic no-python build
BUILD_ARGS=(
"${DIST_DIR}"
--no-tests
--no-examples
--no-tutorials
--no-tools
--no-docs
--no-python
--no-imaging
--no-usdview
--no-materialx
--no-embree
--no-ptex
--no-openvdb
--no-draco
--build-args
"USD,\"-DPXR_BUILD_MONOLITHIC=ON\",\"-DPXR_BUILD_ALEMBIC_PLUGIN=OFF\""
)
echo "Build configuration:"
echo " - Installation directory: ${DIST_DIR}"
echo " - Python bindings: OFF"
echo " - Monolithic build: ON (single shared library)"
echo " - Minimal dependencies (no imaging, materialx, etc.)"
echo " - C++ libraries and headers only"
echo ""
# Run build script
python3 build_scripts/build_usd.py "${BUILD_ARGS[@]}"
# Step 4: Create environment setup script
echo ""
echo "Step 4: Creating environment setup script..."
cat > "${SCRIPT_DIR}/setup_env_nopython_monolithic.sh" << 'EOF'
#!/bin/bash
# OpenUSD No-Python Monolithic Build Environment Setup Script
# Source this script to set up the environment for using OpenUSD C++ libraries and tools
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
USD_INSTALL_ROOT="${SCRIPT_DIR}/dist_nopython_monolithic"
if [ ! -d "${USD_INSTALL_ROOT}" ]; then
echo "Error: OpenUSD no-python monolithic installation not found at ${USD_INSTALL_ROOT}"
echo "Please run setup_openusd_nopython_monolithic.sh first."
return 1
fi
# Set up USD environment variables
export USD_INSTALL_ROOT="${USD_INSTALL_ROOT}"
export PATH="${USD_INSTALL_ROOT}/bin:${PATH}"
# Set library paths
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
export DYLD_LIBRARY_PATH="${USD_INSTALL_ROOT}/lib:${DYLD_LIBRARY_PATH}"
else
# Linux
export LD_LIBRARY_PATH="${USD_INSTALL_ROOT}/lib:${LD_LIBRARY_PATH}"
fi
echo "================================================"
echo "OpenUSD No-Python Monolithic environment configured!"
echo "================================================"
echo "USD_INSTALL_ROOT: ${USD_INSTALL_ROOT}"
echo "Build type: Monolithic C++-only (single shared library, no Python)"
echo ""
echo "Available commands:"
echo " - usdcat: Display USD files in text format"
echo " - usddiff: Compare two USD files"
echo " - usdtree: Display USD scene hierarchy"
echo " - usdchecker: Validate USD files"
echo " - usdzip: Create USDZ archives"
echo ""
echo "C++ Development:"
echo " Include path: ${USD_INSTALL_ROOT}/include"
echo " Library path: ${USD_INSTALL_ROOT}/lib"
echo " Library name: libusd_ms.so (monolithic)"
echo "================================================"
EOF
chmod +x "${SCRIPT_DIR}/setup_env_nopython_monolithic.sh"
echo ""
echo "================================================"
echo "OpenUSD No-Python Monolithic build completed!"
echo "================================================"
echo ""
echo "Installation directory: ${DIST_DIR}"
echo "Build type: Monolithic C++-only (single shared library, no Python)"
echo ""
echo "To use OpenUSD tools and C++ libraries, run:"
echo " source ${SCRIPT_DIR}/setup_env_nopython_monolithic.sh"
echo ""
echo "Then you can:"
echo " - Use command-line tools: usdcat <file.usd>"
echo " - Link against single monolithic library: libusd_ms.so"
echo "================================================"