Skip to content

Commit f3c2f01

Browse files
committed
options: Build maya IECoreUSD against the maya-usd plugin libraries if installed
Note: - Autodesk does ship the USD libraries but not the header files. We try to find a local USD install of the version maya-usd is using and set the include directory respectively. If there is no compatible USD version present, we fall back to the cortex defined USD version and build `IECoreUSD` for Maya against this one. - In the transition from python 2 to 3, maya-usd is shipped with the libraries for both versions, so we have to add the python major version suffix for Maya 2022. The library folders for Maya 2020.4 don't have this suffix and because Maya 2023 is supposed to be python3 exclusively (Autodesk release notes),we assume the suffix to be removed in that version again
1 parent 210c457 commit f3c2f01

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

config/ie/options

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,29 @@ if targetApp=="maya" :
326326
INSTALL_COREMAYA_POST_COMMAND="scons -i -f config/ie/postCoreMayaInstall MAYA_VERSION='" + mayaVersion + "' INSTALLPREFIX="+appPrefix+" install"
327327
WITH_MAYA_PLUGIN_LOADER = 1
328328

329+
mayaUsdVersion = mayaReg.get( "mayaUsdVersion" )
330+
mayaUsdReg = IEEnv.registry["apps"]["mayaUsd"].get( mayaUsdVersion, {} ).get( platform )
331+
# If the Maya usd plugin is not in the registry we build against our standalone USD version
332+
if mayaUsdReg :
333+
pluginUsdVersion = mayaUsdReg["usdVersion"]
334+
# Maya ships the USD libraries with the installation, but not the header files... we use the one that are installed by standalone usd
335+
usdReg = IEEnv.registry["apps"]["usd"].get( pluginUsdVersion, {} ).get( platform )
336+
if usdReg :
337+
USD_INCLUDE_PATH = os.path.join( usdReg["location"], targetApp, compatibilityVersion, "include" )
338+
339+
mayaLooseVersion = distutils.version.LooseVersion(mayaVersion)
340+
if mayaLooseVersion >= "2022" and mayaLooseVersion < "2023":
341+
# Maya 2022 installs the USD libs and the maya plugin itself for python 2 and 3. This is not the case for the 2020 version
342+
# We make the assumption, that the python version suffix is for Maya 2022 only, because Maya 2023 will be python 3 exclusively.
343+
mayaPythonMajorVersion = mayaReg["pythonVersion"].split(".")[0]
344+
USD_LIB_PATH = os.path.join( mayaUsdReg["location"], "mayausd/USD{}/lib".format( mayaPythonMajorVersion ) )
345+
else:
346+
USD_LIB_PATH = os.path.join( mayaUsdReg["location"], "mayausd/USD/lib" )
347+
348+
# Pixar introduced a library prefix `usd_` in USD v21.11, which Autodesk does not use yet, so we have to reset the prefix.
349+
# See https://github.com/Autodesk/maya-usd/issues/2108 for reference
350+
USD_LIB_PREFIX = "" if mayaUsdReg.get( "usdLibPrefix" ) == "" else mayaUsdReg.get( "usdLibPrefix" ) or USD_LIB_PREFIX
351+
329352
# find nuke if we're building for nuke
330353
if targetApp=="nuke" :
331354

0 commit comments

Comments
 (0)