@@ -551,13 +551,17 @@ def make_macos_multi_arch_build(cmake_args):
551551 "," .join (g_target_architectures ), final_zip_path )
552552
553553
554- def make_tvos_target (device , arch , cmake_args ):
555- """Make the tvos build for the given device and architecture.
554+ def configure_tvos_target (device , arch , cmake_args ):
555+ """Configure the tvos build for the given device and architecture.
556556 Assumed to be called from the build directory.
557557
558558 Args:
559+ device: Building for device or simulator.
559560 arch: The architecture to build for.
560561 cmake_args: Additional cmake arguments to use.
562+
563+ Returns:
564+ The directory that the project is configured in.
561565 """
562566 build_args = cmake_args .copy ()
563567 build_args .append ("-DCMAKE_OSX_ARCHITECTURES=" + arch )
@@ -574,6 +578,14 @@ def make_tvos_target(device, arch, cmake_args):
574578 os .makedirs (arch )
575579 build_dir = os .path .join (os .getcwd (), arch )
576580 subprocess .call (build_args , cwd = build_dir )
581+ return build_dir
582+
583+ def make_tvos_target (build_dir ):
584+ """Builds the previously configured cmake project in the given directory.
585+
586+ Args:
587+ The full path to the directory to perform the build in.
588+ """
577589 subprocess .call ('make' , cwd = build_dir )
578590 subprocess .call (['cpack' , '.' ], cwd = build_dir )
579591
@@ -594,10 +606,14 @@ def make_tvos_multi_arch_build(cmake_args):
594606 for device in g_target_devices :
595607 for arch in TVOS_CONFIG_DICT [device ]["architecture" ]:
596608 target_architectures .append (arch )
597- t = threading .Thread (target = make_tvos_target , args = (device , arch , cmake_args ))
609+ # Run the configure step sequentially, since they can clobber the shared Cocoapod cache
610+ build_dir = configure_tvos_target (device , arch , cmake_args )
611+ # Run the builds in parallel, since they can be
612+ t = threading .Thread (target = make_tvos_target , args = (build_dir ,))
598613 t .start ()
599614 threads .append (t )
600615
616+ # Wait for the builds to be finished
601617 for t in threads :
602618 t .join ()
603619
0 commit comments