@@ -302,7 +302,7 @@ def CopyFiles(context, src, dest):
302302 instDestDir = os .path .join (context .instDir , dest )
303303 if not os .path .isdir (instDestDir ):
304304 try :
305- os .mkdir (instDestDir )
305+ os .makedirs (instDestDir , exist_ok = True )
306306 except Exception as e :
307307 raise RuntimeError (
308308 "Unable to create {destDir}" .format (destDir = instDestDir )) from e
@@ -1024,6 +1024,41 @@ def InstallTBB_Windows(context, force, buildArgs):
10241024 CopyFiles (context , "lib\\ intel64\\ vc14\\ *.*" , "lib" )
10251025 CopyDirectory (context , "include\\ serial" , "include\\ serial" )
10261026 CopyDirectory (context , "include\\ tbb" , "include\\ tbb" )
1027+ CopyFiles (context , "cmake\\ TBBConfig.cmake" , "lib\\ cmake\\ TBB" )
1028+ CopyFiles (context , "cmake\\ TBBConfigVersion.cmake" , "lib\\ cmake\\ TBB" )
1029+
1030+ PatchFile (os .path .join (context .instDir , "lib\\ cmake\\ TBB\\ TBBConfig.cmake" ),
1031+ [
1032+ (
1033+ "# TBBConfigVersion.cmake defines TBB_VERSION" ,
1034+ "# TBBConfigVersion.cmake defines TBB_VERSION\n " +
1035+ "#\n " +
1036+ "# THIS FILE HAS BEEN MODIFIED FROM ITS ORIGINAL VERSION"
1037+ ),
1038+ (
1039+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)" ,
1040+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)\n " +
1041+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)\n " +
1042+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)"
1043+ ),
1044+ (
1045+ "get_filename_component(_tbb_lib_path \" ${_tbb_root}/bin/${_tbb_arch_subdir}/${_tbb_compiler_subdir}\" ABSOLUTE)" ,
1046+ "get_filename_component(_tbb_lib_path \" ${_tbb_root}/bin\" ABSOLUTE)"
1047+ ),
1048+ (
1049+ "${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}/${_tbb_component}.lib" ,
1050+ "${_tbb_root}/lib/${_tbb_component}.lib"
1051+ ),
1052+ (
1053+ "${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}/${_tbb_component}_debug.lib" ,
1054+ "${_tbb_root}/lib/${_tbb_component}_debug.lib"
1055+ ),
1056+ (
1057+ "if (EXISTS \" ${_tbb_debug_lib}\" )" ,
1058+ "if (EXISTS \" ${_tbb_debug_lib}\" )\n " +
1059+ " set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS \" TBB_USE_DEBUG=1\" )"
1060+ )
1061+ ])
10271062
10281063def InstallTBB_MacOS (context , force , buildArgs ):
10291064 with CurrentWorkingDirectory (DownloadURL (TBB_URL , context , force )):
@@ -1158,6 +1193,47 @@ def InstallTBB_Linux(context, force, buildArgs):
11581193 CopyDirectory (context , "include/serial" , "include/serial" )
11591194 CopyDirectory (context , "include/tbb" , "include/tbb" )
11601195
1196+ # generate TBBConfig.cmake so we have it available for
1197+ # the OpenUSD build - this also patches the generated
1198+ # configuration to adhere to the desired directory structure
1199+ # as well as adds TBB_DEBUG to the INTERFACE_INCLUDE_DEFINITIONS
1200+ cmakeInstallTBBCmd = 'cmake -DTBB_ROOT={root} -DTBB_OS=Linux -P cmake/tbb_config_generator.cmake' .format (
1201+ root = context .instDir )
1202+ Run (cmakeInstallTBBCmd )
1203+ CopyFiles (context , os .path .join (context .instDir , "cmake" , "TBBConfig.cmake" ),
1204+ os .path .join (context .instDir , "lib" , "cmake" , "TBB" ))
1205+ CopyFiles (context , os .path .join (context .instDir , "cmake" , "TBBConfigVersion.cmake" ),
1206+ os .path .join (context .instDir , "lib" , "cmake" , "TBB" ))
1207+
1208+ PatchFile (os .path .join (context .instDir , "lib/cmake/TBB/TBBConfig.cmake" ),
1209+ [
1210+ (
1211+ "# TBBConfigVersion.cmake defines TBB_VERSION" ,
1212+ "# TBBConfigVersion.cmake defines TBB_VERSION\n " +
1213+ "#\n " +
1214+ "# THIS FILE HAS BEEN MODIFIED FROM ITS ORIGINAL VERSION"
1215+ ),
1216+ (
1217+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)" ,
1218+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)\n " +
1219+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)\n " +
1220+ "get_filename_component(_tbb_root \" ${_tbb_root}\" PATH)"
1221+ ),
1222+ (
1223+ "get_filename_component(_tbb_lib_path \" ${_tbb_root}/lib/${_tbb_arch_subdir}/${_tbb_compiler_subdir}\" ABSOLUTE)" ,
1224+ "get_filename_component(_tbb_lib_path \" ${_tbb_root}/lib\" ABSOLUTE)"
1225+ ),
1226+ (
1227+ "if (EXISTS \" ${_tbb_debug_lib}\" )" ,
1228+ "if (EXISTS \" ${_tbb_debug_lib}\" )\n " +
1229+ " set_property(TARGET TBB::${_tbb_component} APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS \" TBB_USE_DEBUG=1\" )"
1230+ )
1231+ ])
1232+
1233+ # remove the one originally generated by TBB, as we've moved it
1234+ os .remove (os .path .join (context .instDir , "cmake" , "TBBConfig.cmake" ))
1235+ os .remove (os .path .join (context .instDir , "cmake" , "TBBConfigVersion.cmake" ))
1236+
11611237TBB = Dependency ("TBB" , InstallTBB , "include/tbb/tbb.h" )
11621238
11631239############################################################
0 commit comments