How to build usd to allow for static linking

Hello all,
First, thanks for all that work on removing boost, building a “core” version of openusd feels so clean now, that will reduce the friction with sticking this in our build system by quite a bit!

Next,
I am trying to build usd so my applications can statically link to it instead of relying on the usd_ms.dll. I am looking at this document:

OpenUSD/BUILDING.md at release · PixarAnimationStudios/OpenUSD

and am trying the following build command based on this:
python build_scripts/build_usd.py --no-examples --no-tutorials --no-tools --no-python --no-imaging --no-usdview --no-materialx --cmake-build-args BUILD_SHARED_LIBS=OFF %INSTALL_DIR%

but this still gives me all the dll’s. What would be the correct flag to build_usd.py to just get the static libs?

Thanks,
Koen

1 Like

I might be wrong, but I believe you also need to enable monolithic builds too?

I’ll try that, thanks, I had taken that out, that’s out default build method. For now, I just hacked build_usd.py to pass build shared_libs off to see how far I get. I’m not sure I’ll be able to get tbb to static link. As long as I have a dll, I dont mind two :slight_smile:

Cheers,
Koen

I believe some of the changes I have in my framework build might be of interest

It targets Apple platforms of course, but I changed how the shared/monolithic builds get passed in to build_usd.py, and also changed how TBB + other dependencies get statically built.

1 Like

Sorry for interjecting but did anyone succeed in having a static build without the normal plugin search?

I’m building static libraries (either monolithic or single static libraries it doesn’t seem to matter) but I’m still getting failures by the unbuilt plugins (and why is it searching for plugins at all?)

see Cannot find plugins even in static build?

You’ll need the plugin search to still look for the plugInfo.json to find what to register. See my PR above.

The JSON files still include various metadata about how each plugin is used, which is why they can’t simply be elided.

However I think it might be worth having a setup where static or monolithic builds pull the JSON data as internalized static data.