@@ -551,13 +551,17 @@ def make_macos_multi_arch_build(cmake_args):
551
551
"," .join (g_target_architectures ), final_zip_path )
552
552
553
553
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.
556
556
Assumed to be called from the build directory.
557
557
558
558
Args:
559
+ device: Building for device or simulator.
559
560
arch: The architecture to build for.
560
561
cmake_args: Additional cmake arguments to use.
562
+
563
+ Returns:
564
+ The directory that the project is configured in.
561
565
"""
562
566
build_args = cmake_args .copy ()
563
567
build_args .append ("-DCMAKE_OSX_ARCHITECTURES=" + arch )
@@ -574,6 +578,14 @@ def make_tvos_target(device, arch, cmake_args):
574
578
os .makedirs (arch )
575
579
build_dir = os .path .join (os .getcwd (), arch )
576
580
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
+ """
577
589
subprocess .call ('make' , cwd = build_dir )
578
590
subprocess .call (['cpack' , '.' ], cwd = build_dir )
579
591
@@ -594,10 +606,14 @@ def make_tvos_multi_arch_build(cmake_args):
594
606
for device in g_target_devices :
595
607
for arch in TVOS_CONFIG_DICT [device ]["architecture" ]:
596
608
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 ,))
598
613
t .start ()
599
614
threads .append (t )
600
615
616
+ # Wait for the builds to be finished
601
617
for t in threads :
602
618
t .join ()
603
619
0 commit comments