Skip to content

Commit 4033978

Browse files
sunyabpixar-oss
authored andcommitted
build_usd.py: Remove boost dependency when building Python modules
OpenUSD now uses its internal pxr_boost::python library for building Python modules, so boost is no longer needed. This was the last use of boost, which means build_usd.py no longer needs to download and build boost at all when building the OpenUSD core. As a temporary backwards compatibility and testing mechanism, clients can use the "--boost-python" option to revert to the previous behavior of using boost::python for Python modules. This option is deprecated and will be removed in a future release. (Internal change: 2343201)
1 parent 047a441 commit 4033978

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

build_scripts/build_usd.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -744,9 +744,9 @@ def InstallBoost_Helper(context, force, buildArgs):
744744
# compatibility issues on Big Sur and Monterey.
745745
pyInfo = GetPythonInfo(context)
746746
pyVer = (int(pyInfo[3].split('.')[0]), int(pyInfo[3].split('.')[1]))
747-
if MacOS() or (context.buildPython and pyVer >= (3,11)):
747+
if MacOS() or (context.buildBoostPython and pyVer >= (3,11)):
748748
BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.zip"
749-
elif context.buildPython and pyVer >= (3, 10):
749+
elif context.buildBoostPython and pyVer >= (3, 10):
750750
BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
751751
elif IsVisualStudio2022OrGreater():
752752
BOOST_URL = "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
@@ -829,7 +829,7 @@ def InstallBoost_Helper(context, force, buildArgs):
829829
'--with-regex'
830830
]
831831

832-
if context.buildPython:
832+
if context.buildBoostPython:
833833
b2_settings.append("--with-python")
834834
pythonInfo = GetPythonInfo(context)
835835
# This is the only platform-independent way to configure these
@@ -1622,6 +1622,11 @@ def InstallUSD(context, force, buildArgs):
16221622
else:
16231623
extraArgs.append('-DPXR_USE_DEBUG_PYTHON=OFF')
16241624

1625+
if context.buildBoostPython:
1626+
extraArgs.append('-DPXR_USE_BOOST_PYTHON=ON')
1627+
else:
1628+
extraArgs.append('-DPXR_USE_BOOST_PYTHON=OFF')
1629+
16251630
# CMake has trouble finding the executable, library, and include
16261631
# directories when there are multiple versions of Python installed.
16271632
# This can lead to crashes due to USD being linked against one
@@ -2005,6 +2010,10 @@ def InstallUSD(context, force, buildArgs):
20052010
"Disable performance-impacting safety checks against "
20062011
"malformed input files")
20072012

2013+
group.add_argument("--boost-python", dest="build_boost_python",
2014+
action="store_true", default=False,
2015+
help="Build Python bindings with boost::python (deprecated)")
2016+
20082017
subgroup = group.add_mutually_exclusive_group()
20092018
subgroup.add_argument("--debug-python", dest="debug_python",
20102019
action="store_true", help=
@@ -2244,6 +2253,7 @@ def __init__(self, args):
22442253
# Optional components
22452254
self.buildTests = args.build_tests and not embedded
22462255
self.buildPython = args.build_python and not embedded
2256+
self.buildBoostPython = self.buildPython and args.build_boost_python
22472257
self.buildExamples = args.build_examples and not embedded
22482258
self.buildTutorials = args.build_tutorials and not embedded
22492259
self.buildTools = args.build_tools and not embedded
@@ -2337,7 +2347,7 @@ def ForceBuildDependency(self, dep):
23372347

23382348
requiredDependencies = [ZLIB, TBB]
23392349

2340-
if context.buildPython:
2350+
if context.buildBoostPython:
23412351
requiredDependencies += [BOOST]
23422352

23432353
if context.buildAlembic:

0 commit comments

Comments
 (0)