Simo Virokannas

Writings and ramblings

Compiling Pixar’s USD natively on Windows 11 / VS 2022

If you’ve tried it, you’ve probably run into the endless catch-22 that is getting everything to behave when trying to compile the Universal Scene Description on a newly setup Windows machine.

NOTE: if there’s any way for you to avoid this in your life, don’t look back, rejoice.

Prerequisites

You’ll need to install at least the following to get your toolset ready:

  • Python 3.7 or newer (I used 3.11 as it was just released) – install system-wide
  • Git – install system-wide
  • NASM – install system-wide
  • CMake 3.24 or newer – install system-wide
  • Visual Studio 2022 – install just the basic components, no C# or other bloatware (it’s still >9GB)

Add NASM and CMake to your PATH environment variable – you can do this right before building too, by typing:

set PATH=%PATH%;C:\Program Files\NASM;C:\Program Files\CMake\bin

This depends on where you installed them, in my case I used the zipped version of CMake and extracted it under C:\Program Files\CMake

Pip modules

Install at least the pyopengl and pyside6 packages with pip:

pip install pyopengl pyside6

Building

Go to wherever you keep your sources, and pull down the USD git repository:

git clone https://github.com/PixarAnimationStudios/USD.git

Patch the boost version used – the build script build_scripts/build_usd.py will want to use 1.70 on windows, but that won’t support VS 2022. Find this segment and modify the Windows part to use 1.79 instead:

elif Windows():
    # ... a comment here about why 1.70 is used to support older VS
    BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.gz"
    BOOST_VERSION_FILE = "include/boost-1_79/boost/version.hpp"

Decide where you want your built USD to go, in this example we’ll use C:\opt\USD as the target folder. Now you’re ready to run the build script (with your preferred build flags, of course):

python build_scripts\build_usd.py --no-examples --no-tutorials --tools --python --no-docs --usd-imaging --usdview --embree --alembic --hdf5 --generator "Visual Studio 17 2022" --toolset=v143 C:\opt\USD

Comments

3 responses to “Compiling Pixar’s USD natively on Windows 11 / VS 2022”

  1. hi when building (after all the dependencies have been built and USD is finally being built) i get the following error:

    LINK : fatal error LNK1104: cannot open file ‘boost_python310-vc143-mt-x64-1_78.lib’ [C:\Pixar\USD\build\USD\pxr\base\tf\tf.vcxproj]

    when looking in i find vc142 versions of everything even though i used the v143 argument that you did. do you have any idea what might be up with that. (i’m on windows 11, with vs2022. everything up until that point worked)

    1. Funnily enough, I remember seeing the same thing earlier in the process. I think it should’ve been the –toolset=v143 flag that fixes that. However; as long as you’re sure you don’t have an older VS installed, you could just try making copies of the files with vc143 instead of vc142 to see if they work in the first place. As it took ages for me to respond, you may already have figured out where it was coming from…

    2. After quite some time, I had to go back and recompile this and ran into the same issue as you. You may need to add support for msvc-14.3 toolset in the build_usd.py script, around line 845 (I just replaced 142 with 143 and the matching toolset entry from 14.2 to 14.3)

Leave a Reply to Simo Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.