Code Monkey home page Code Monkey logo

tinyusd's Introduction

Tiny USD

A tutorial on creating the smallest possible viable USD program, using the dev branch of the official usd distribution.

In the spirit of minimalism, it skips Hydra, and Python bindings.

Prerequisites


  • git
  • cmake 3.26 or greater installed for the command line
  • Xcode command line tools, tested with Apple Clang 14

Building


Shallow clone the USD dev branch into this project's packages directory:

cd tinyusd
mkdir packages
cd packages
git clone --depth 1 https://github.com/PixarAnimationStudios/USD.git -b dev

boost

Fetch boost and unarchive it. Boost will not be built, the headers as is are sufficient.

./get_boost.sh

tbb

Fetch and build tbb. In the root directory:

./get_tbb.sh

OpenSubdiv

If you are building USD with Hydra, you'll need OpenSubdiv.

./get_opensubdiv.sh

Configure USD


Once again, starting in the packages directory:

mkdir usd-build;cd usd-build

We are going to build USD without python, as python adds complexity, by requiring that boost python be built.

First, configure the build, from within the usd-build directory.

In the command below, replace the PREFIX and TOOLCHAIN variable values with appropriate paths.

with Hydra

cmake -DPXR_ENABLE_PYTHON_SUPPORT=OFF -DPXR_BUILD_MONOLITHIC=ON -DPXR_BUILD_DOCUMENTATION=OFF -DPXR_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=..  -G "Xcode" ../USD

without Hydra

cmake -DPXR_ENABLE_PYTHON_SUPPORT=OFF -DPXR_BUILD_MONOLITHIC=ON -DPXR_BUILD_DOCUMENTATION=OFF -DPXR_BUILD_TESTS=OFF -DPXR_BUILD_IMAGING=OFF -DCMAKE_INSTALL_PREFIX=..  -G "Xcode" ../USD

Build USD


cmake --build . --config Release --target install

Finish up the installation


In a little while, packages/lib will contain the libusd_ms.dylib, and packages/include will have the headers, packages/bin will have sdfdump and sdffilter.

Double check your work


There is an executable in the bin directory called sdfdump. Running it should result in the executable describing its input arguments, without any complaints of missing dylibs.

TinyUsd


Go back into the packages directory we made earlier, and create a tinyusd-build directory, and cd into it.

mkdir tinyusd-build;cd tinyusd-build

Then, configure the cmake build files. Once again, make sure the INSTALL_PREFIX and TOOLCHAIN variables are pointed appropriately.

cmake -G "Xcode" ../.. -DCMAKE_INSTALL_PREFIX=.. -DCMAKE_PREFIX_PATH=..

Build tinyusd.

cmake --build . --config Release --target install

Haven't got the rpath installation set up correctly in the cmake file yet, so go to the bin directory, and add it.

cd ../bin
install_name_tool -add_rpath ../lib tinyusd

Now, run tinyusd.

./tinyusd

Sanity check that tinyusd generated a file named test.usd, containing the following:

#usda 1.0

def Cube "Box"
{
    float3 xformOp:scale = (5, 5, 5)
    uniform token[] xformOpOrder = ["xformOp:scale"]
}

tinyusd's People

Contributors

meshula avatar nporcino-pixar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.