So I need to support .usd/.usda/.usdc for my renderer application, and I need to distribute the resulting project .exe and usd .libs/.dlls to our users on install. How do I build the library in a way that I can distribute? If I can't distribute it due to how the library is structured, how do I have the user install the needed dependencies automatically?
I was able to get oneTBB I believe (as TBB is a dependency of the library, but I don't know if USD can use it, here is how I compiled it)
::Issue this creates a .dll, would have been nice to have a static lib for not needed function culling
download: https://github.com/oneapi-src/oneTBB
extract: oneTBB-master folder
copy: include folder to destination (/I.\include in cl command when compiling)
open: cmd inside oneTBB-master folder (TIP: if you type cmd and hit enter in the folder path in the top it opens cmd there)
run: mkdir build && cd build
::if you want HWLOC then you need to rebuild with TBB bindings (for OpenMPI, I believe, but we don't currently use)
run: cmake .. -G "Visual Studio 15 2017 Win64" -DTBB_TEST=OFF -DCMAKE_CXX_STANDARD=17 -DCMAKE_BUILD_TYPE=Release
run: cmake --build . --config Release
run: cd msvc_19.16_cxx17_64_md_release
copy: tbb12.dll to destination
copy: tbb12.lib to destination (link against this)
:: don't think we need tbbmalloc.dll/tbbmalloc_proxy.dll and tbbmalloc.lib/tbbmalloc_proxy.lib
I tested TBB by compiling on the command line with a simple test program and build script like
@echo off
if not defined DevEnvDir (
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
)
set FILES=MinimalTBB.cpp
set LIBS=kernel32.lib user32.lib gdi32.lib
set DLLLIBS=tbb12.lib
:: tbbmalloc.lib tbbmalloc_proxy.lib
cl /nologo /W3 /Z7 /GS- /DEBUG:none /Gs999999 /MT /EHsc /O2 %FILES% -FeMinimalTBB.exe %LIBS% /I.\include /link %DLLLIBS% /incremental:no /opt:icf /opt:ref /subsystem:console
But then I need to do Boost.
And then I would love to do something like:
download: https://github.com/PixarAnimationStudios/USD
extract: USD-release folder
open: cmd inside USD-release folder
run: mkdir build && cd build
run: cmake .. -G "Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=ON -DPXR_BUILD_MONOLITHIC=OFF -DPXR_BUILD_IMAGING=OFF -DPXR_BUILD_USDVIEW=OFF -DPXR_ENABLE_PYTHON_SUPPORT=OFF -DPXR_BUILD_DOCUMENTATION=OFF -DPXR_BUILD_TESTS=OFF -DPXR_VALIDATE_GENERATED_CODE=OFF -DPXR_BUILD_PRMAN_PLUGIN=OFF -DPXR_BUILD_ALEMBIC_PLUGIN=OFF -DPXR_BUILD_DRACO_PLUGIN=OFF -DPXR_ENABLE_MATERIALX_SUPPORT=OFF -DCMAKE_BUILD_TYPE=Release
run: cmake --build . --config Release
to get .dll which i will distribute along with the .exe and then just link against the .lib in my project without the user installing anything
As an aside: I saw nVidia has a precompiled version too, I tried compiling with it, but it threw a bunch of python36.dll missing errors, when I am not even using python (only c++).
I found a ok solution from compiling from the command line, there is probably a much better way to do this, but to get it going here is what I did
The following wastes lots of memory on ur build machine, lots of files that don't need to be there, so go through and remove them: