@@ -135,11 +135,11 @@ def GetVisualStudioCompilerAndVersion():
135135
136136 msvcCompiler = which ('cl' )
137137 if msvcCompiler :
138- # VisualStudioVersion environment variable should be set by the
138+ # VCToolsVersion environment variable should be set by the
139139 # Visual Studio Command Prompt.
140140 match = re .search (
141141 r"(\d+)\.(\d+)" ,
142- os .environ .get ("VisualStudioVersion " , "" ))
142+ os .environ .get ("VCToolsVersion " , "" ))
143143 if match :
144144 return (msvcCompiler , tuple (int (v ) for v in match .groups ()))
145145 return None
@@ -154,16 +154,17 @@ def IsVisualStudioVersionOrGreater(desiredVersion):
154154 return version >= desiredVersion
155155 return False
156156
157+ # Helpers to determine the version of "Visual Studio" (also support the Build Tools) based
158+ # on the version of the MSVC compiler.
159+ # See MSVC++ versions table on https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
157160def IsVisualStudio2022OrGreater ():
158- VISUAL_STUDIO_2022_VERSION = (17 , 0 )
161+ VISUAL_STUDIO_2022_VERSION = (14 , 30 )
159162 return IsVisualStudioVersionOrGreater (VISUAL_STUDIO_2022_VERSION )
160-
161163def IsVisualStudio2019OrGreater ():
162- VISUAL_STUDIO_2019_VERSION = (16 , 0 )
164+ VISUAL_STUDIO_2019_VERSION = (14 , 20 )
163165 return IsVisualStudioVersionOrGreater (VISUAL_STUDIO_2019_VERSION )
164-
165166def IsVisualStudio2017OrGreater ():
166- VISUAL_STUDIO_2017_VERSION = (15 , 0 )
167+ VISUAL_STUDIO_2017_VERSION = (14 , 1 )
167168 return IsVisualStudioVersionOrGreater (VISUAL_STUDIO_2017_VERSION )
168169
169170def GetPythonInfo (context ):
@@ -283,8 +284,8 @@ def Run(cmd, logCommandOutput = True):
283284 if verbosity < 3 :
284285 with open ("log.txt" , "r" ) as logfile :
285286 Print (logfile .read ())
286- raise RuntimeError ("Failed to run '{cmd}'\n See {log} for more details."
287- .format (cmd = cmd , log = os .path .abspath ("log.txt" )))
287+ raise RuntimeError ("Failed to run '{cmd}' in {path}. \n See {log} for more details."
288+ .format (cmd = cmd , path = os . getcwd (), log = os .path .abspath ("log.txt" )))
288289
289290@contextlib .contextmanager
290291def CurrentWorkingDirectory (dir ):
@@ -723,6 +724,9 @@ def InstallBoost_Helper(context, force, buildArgs):
723724 # However, there are some cases where a newer version is required.
724725 # - Building with Python 3.11 requires boost 1.82.0 or newer
725726 # (https://github.com/boostorg/python/commit/a218ba)
727+ # - Building on MacOS requires v1.82.0 or later for C++17 support starting
728+ # with Xcode 15. We choose to use this version for all MacOS builds for
729+ # simplicity."
726730 # - Building with Python 3.10 requires boost 1.76.0 or newer
727731 # (https://github.com/boostorg/python/commit/cbd2d9)
728732 # XXX: Due to a typo we've been using 1.78.0 in this case for a while.
@@ -733,14 +737,12 @@ def InstallBoost_Helper(context, force, buildArgs):
733737 # compatibility issues on Big Sur and Monterey.
734738 pyInfo = GetPythonInfo (context )
735739 pyVer = (int (pyInfo [3 ].split ('.' )[0 ]), int (pyInfo [3 ].split ('.' )[1 ]))
736- if context .buildPython and pyVer >= (3 , 11 ):
740+ if MacOS () or ( context .buildPython and pyVer >= (3 ,11 ) ):
737741 BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip"
738742 elif context .buildPython and pyVer >= (3 , 10 ):
739743 BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
740744 elif IsVisualStudio2022OrGreater ():
741745 BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
742- elif MacOS ():
743- BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
744746 else :
745747 BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.zip"
746748
@@ -788,7 +790,7 @@ def InstallBoost_Helper(context, force, buildArgs):
788790 primaryArch , secondaryArch )
789791
790792 if macOSArch :
791- bootstrapCmd += " cxxflags=\" {0}\" " \
793+ bootstrapCmd += " cxxflags=\" {0} -std=c++17 -stdlib=libc++ \" " \
792794 " cflags=\" {0}\" " \
793795 " linkflags=\" {0}\" " .format (macOSArch )
794796 bootstrapCmd += " --with-toolset=clang"
@@ -904,7 +906,7 @@ def InstallBoost_Helper(context, force, buildArgs):
904906 # https://github.com/boostorg/container/commit/79a75f470e75f35f5f2a91e10fcc67d03b0a2160
905907 b2_settings .append (f"define=BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT=0" )
906908 if macOSArch :
907- b2_settings .append ("cxxflags=\" {0}\" " .format (macOSArch ))
909+ b2_settings .append ("cxxflags=\" {0} -std=c++17 -stdlib=libc++ \" " .format (macOSArch ))
908910 b2_settings .append ("cflags=\" {0}\" " .format (macOSArch ))
909911 b2_settings .append ("linkflags=\" {0}\" " .format (macOSArch ))
910912
@@ -952,7 +954,8 @@ def InstallBoost(context, force, buildArgs):
952954 TBB_URL = "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2020.3.zip"
953955 TBB_INTEL_URL = "https://github.com/oneapi-src/oneTBB/archive/refs/tags/2018_U1.zip"
954956else :
955- TBB_URL = "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2020.3.zip"
957+ # Use point release with fix https://github.com/oneapi-src/oneTBB/pull/833
958+ TBB_URL = "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2020.3.1.zip"
956959
957960def InstallTBB (context , force , buildArgs ):
958961 if Windows ():
@@ -1354,36 +1357,18 @@ def InstallOpenSubdiv(context, force, buildArgs):
13541357 '-DNO_TESTS=ON' ,
13551358 '-DNO_GLEW=ON' ,
13561359 '-DNO_GLFW=ON' ,
1360+ '-DNO_PTEX=ON' ,
1361+ '-DNO_TBB=ON' ,
13571362 ]
13581363
1359- # If Ptex support is disabled in USD, disable support in OpenSubdiv
1360- # as well. This ensures OSD doesn't accidentally pick up a Ptex
1361- # library outside of our build.
1362- if not context .enablePtex :
1363- extraArgs .append ('-DNO_PTEX=ON' )
1364-
1365- # NOTE: For now, we disable TBB in our OpenSubdiv build.
1366- # This avoids an issue where OpenSubdiv will link against
1367- # all TBB libraries it finds, including libtbbmalloc and
1368- # libtbbmalloc_proxy. On Linux and MacOS, this has the
1369- # unwanted effect of replacing the system allocator with
1370- # tbbmalloc.
1371- extraArgs .append ('-DNO_TBB=ON' )
1364+ # Use Metal for macOS and all Apple embedded systems.
1365+ if MacOS ():
1366+ extraArgs .append ('-DNO_OPENGL=ON' )
13721367
13731368 # Add on any user-specified extra arguments.
13741369 extraArgs += buildArgs
13751370
1376- # OpenSubdiv seems to error when building on windows w/ Ninja...
1377- # ...so just use the default generator (ie, Visual Studio on Windows)
1378- # until someone can sort it out
1379- oldGenerator = context .cmakeGenerator
1380- if oldGenerator == "Ninja" and Windows ():
1381- context .cmakeGenerator = None
1382-
1383- try :
1384- RunCMake (context , force , extraArgs )
1385- finally :
1386- context .cmakeGenerator = oldGenerator
1371+ RunCMake (context , force , extraArgs )
13871372
13881373OPENSUBDIV = Dependency ("OpenSubdiv" , InstallOpenSubdiv ,
13891374 "include/opensubdiv/version.h" )
@@ -1491,19 +1476,10 @@ def InstallDraco(context, force, buildArgs):
14911476############################################################
14921477# MaterialX
14931478
1494- MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.7 .zip"
1479+ MATERIALX_URL = "https://github.com/materialx/MaterialX/archive/v1.38.8 .zip"
14951480
14961481def InstallMaterialX (context , force , buildArgs ):
14971482 with CurrentWorkingDirectory (DownloadURL (MATERIALX_URL , context , force )):
1498- # MaterialX 1.38.7 fails to build on windows using VS2017 because of a
1499- # missing header include, following patch fixes the same. This patch
1500- # should be removed when underlying issue is resolved.
1501- # https://github.com/AcademySoftwareFoundation/MaterialX/issues/1401
1502- if IsVisualStudio2017OrGreater () and not IsVisualStudio2019OrGreater ():
1503- PatchFile ("source\\ MaterialXGenMsl\\ MslShaderGenerator.cpp" ,
1504- [("#include <MaterialXGenMsl/MslShaderGenerator.h>" ,
1505- "#include <cctype>\n " +
1506- "#include <MaterialXGenMsl/MslShaderGenerator.h>" )])
15071483 cmakeOptions = ['-DMATERIALX_BUILD_SHARED_LIBS=ON' ,
15081484 '-DMATERIALX_BUILD_TESTS=OFF'
15091485 ]
@@ -1543,9 +1519,9 @@ def InstallEmbree(context, force, buildArgs):
15431519############################################################
15441520# AnimX
15451521
1546- # This GitHub project has no releases, so we take the latest.
1547- # As of 2023, there have been no commits since 2018.
1548- ANIMX_URL = "https://github.com/Autodesk/animx/archive/refs/heads/master .zip"
1522+ # This GitHub project has no releases, so we fixed on the latest commit as of
1523+ # 2024-02-06 - 5db8ee4, which was committed on 2018-11-05
1524+ ANIMX_URL = "https://github.com/Autodesk/animx/archive/5db8ee416d5fa7050357f498d4dcfaa6ff3f7738 .zip"
15491525
15501526def InstallAnimX (context , force , buildArgs ):
15511527 with CurrentWorkingDirectory (DownloadURL (ANIMX_URL , context , force )):
0 commit comments