Skip to content

Commit ecea8d8

Browse files
tallytalwarpixar-oss
authored andcommitted
build_usd.py: Ensure use of TBB libraries from build script
This fixes an issue where the OpenUSD build could incorrectly pick up a oneTBB library from somewhere else on the system instead of the library built by the build script. This change adds a new PXR_FIND_TBB_IN_CONFIG option to explicitly control whether to find TBB in config mode or via the FindTBB.cmake module. build_usd.py enables this option if using oneTBB and disables it when using legacy TBB. This ensures the build only uses the appropriate mechanism for whichever library is built by the script. By default this option is unset, so clients building OpenUSD via cmake directly will see no changes in behavior. Fixes #3610 (Internal change: 2380256)
1 parent 005d700 commit ecea8d8

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

build_scripts/build_usd.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,11 @@ def InstallUSD(context, force, buildArgs):
16721672
extraArgs.append('-DPXR_PREFER_SAFETY_OVER_SPEED={}'
16731673
.format('ON' if context.safetyFirst else 'OFF'))
16741674

1675+
if context.buildOneTBB:
1676+
extraArgs.append('-DPXR_FIND_TBB_IN_CONFIG=ON')
1677+
else:
1678+
extraArgs.append('-DPXR_FIND_TBB_IN_CONFIG=OFF')
1679+
16751680
if context.buildPython:
16761681
extraArgs.append('-DPXR_ENABLE_PYTHON_SUPPORT=ON')
16771682

cmake/defaults/Packages.cmake

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,23 @@ if(WIN32)
106106
endif()
107107

108108
# --TBB
109-
find_package(TBB CONFIG COMPONENTS tbb)
110-
if(TBB_FOUND)
111-
set(PXR_FIND_TBB_IN_CONFIG ON)
109+
if (DEFINED PXR_FIND_TBB_IN_CONFIG)
110+
if (PXR_FIND_TBB_IN_CONFIG)
111+
find_package(TBB CONFIG REQUIRED COMPONENTS tbb)
112+
else()
113+
find_package(TBB REQUIRED COMPONENTS tbb)
114+
endif()
112115
else()
113-
find_package(TBB REQUIRED COMPONENTS tbb)
114-
set(PXR_FIND_TBB_IN_CONFIG OFF)
116+
# Set PXR_FIND_TBB_IN_CONFIG appropriately so that downstream
117+
# pxrConfig knows how TBB was found and appropriately encodes the
118+
# dependency.
119+
find_package(TBB CONFIG COMPONENTS tbb)
120+
if (TBB_FOUND)
121+
set(PXR_FIND_TBB_IN_CONFIG ON)
122+
else()
123+
find_package(TBB REQUIRED COMPONENTS tbb)
124+
set(PXR_FIND_TBB_IN_CONFIG OFF)
125+
endif()
115126
endif()
116127

117128
# --math

0 commit comments

Comments
 (0)