Skip to content

Commit d1c5fa9

Browse files
committed
Added copying and patching for MacOS
1 parent 6c99c15 commit d1c5fa9

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

build_scripts/build_usd.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,47 @@ def _RunBuild(arch):
11581158
CopyDirectory(context, "include/serial", "include/serial")
11591159
CopyDirectory(context, "include/tbb", "include/tbb")
11601160

1161+
# generate TBBConfig.cmake so we have it available for
1162+
# the OpenUSD build - this also patches the generated
1163+
# configuration to adhere to the desired directory structure
1164+
# as well as adds TBB_DEBUG to the INTERFACE_INCLUDE_DEFINITIONS
1165+
cmakeInstallTBBCmd = 'cmake -DTBB_ROOT={root} -DTBB_OS=Darwin -P cmake/tbb_config_generator.cmake'.format(
1166+
root=context.instDir)
1167+
Run(cmakeInstallTBBCmd)
1168+
CopyFiles(context, os.path.join(context.instDir, "cmake", "TBBConfig.cmake"),
1169+
os.path.join(context.instDir, "lib", "cmake", "TBB"))
1170+
CopyFiles(context, os.path.join(context.instDir, "cmake", "TBBConfigVersion.cmake"),
1171+
os.path.join(context.instDir, "lib", "cmake", "TBB"))
1172+
1173+
PatchFile(os.path.join(context.instDir, "lib/cmake/TBB/TBBConfig.cmake"),
1174+
[
1175+
(
1176+
"# TBBConfigVersion.cmake defines TBB_VERSION",
1177+
"# TBBConfigVersion.cmake defines TBB_VERSION\n" +
1178+
"#\n" +
1179+
"# THIS FILE HAS BEEN MODIFIED FROM ITS ORIGINAL VERSION"
1180+
),
1181+
(
1182+
"get_filename_component(_tbb_root \"${_tbb_root}\" PATH)",
1183+
"get_filename_component(_tbb_root \"${_tbb_root}\" PATH)\n" +
1184+
"get_filename_component(_tbb_root \"${_tbb_root}\" PATH)\n" +
1185+
"get_filename_component(_tbb_root \"${_tbb_root}\" PATH)"
1186+
),
1187+
(
1188+
"get_filename_component(_tbb_lib_path \"${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}\" ABSOLUTE)",
1189+
"get_filename_component(_tbb_lib_path \"${_tbb_root}/lib\" ABSOLUTE)"
1190+
),
1191+
(
1192+
"if (EXISTS \"${_tbb_debug_lib}\")",
1193+
"if (EXISTS \"${_tbb_debug_lib}\")\n" +
1194+
" set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS \"TBB_USE_DEBUG=1\")"
1195+
)
1196+
])
1197+
1198+
# remove the one originally generated by TBB, as we've moved it
1199+
os.remove(os.path.join(context.instDir, "cmake", "TBBConfig.cmake"))
1200+
os.remove(os.path.join(context.instDir, "cmake", "TBBConfigVersion.cmake"))
1201+
11611202
def InstallTBB_Linux(context, force, buildArgs):
11621203
with CurrentWorkingDirectory(DownloadURL(TBB_URL, context, force)):
11631204
# Append extra argument controlling libstdc++ ABI if specified.

0 commit comments

Comments
 (0)