@@ -181,15 +181,16 @@ def build_universal_framework(frameworks_path):
181181 platform_architecture_dirs = os .listdir (framework_os_path )
182182 platform_arch_map = defaultdict (list )
183183 for platform_architecture in platform_architecture_dirs :
184+ logging .debug ('Inspecting ' + platform_architecture )
184185 platform , architecture = platform_architecture .split ('-' )
185186 platform_arch_map [platform ].append (architecture )
186187
187188 build_universal = True
188189 for platform in platform_arch_map :
189190 logging .debug ('Found architectures for platform '
190191 '{0}: {1}' .format (platform , ' ' .join (platform_arch_map [platform ])))
191- missing_architectures = set (CONFIG [apple_os ][platform ]) - \
192- set (platform_arch_map [platform ])
192+ missing_architectures = set (CONFIG [apple_os ][platform ][ 'architectures' ]) \
193+ - set (platform_arch_map [platform ])
193194 if missing_architectures :
194195 logging .error ('Following architectures are missing for platform'
195196 '{0}: {1}' .format (platform , ' ' .join (missing_architectures )))
@@ -218,6 +219,10 @@ def build_universal_framework(frameworks_path):
218219 # Eg: split firebase_auth.framework -> firebase_auth, .framework
219220 target , _ = os .path .splitext (target_framework )
220221 for platform_architecture_dir in platform_architecture_dirs :
222+ # Since we have arm64 for both device and simulator, lipo cannot combine
223+ # them in the same fat file. We ignore simulator-arm64.
224+ if platform_architecture_dir == 'simulator-arm64' :
225+ continue
221226 # <build_dir>/<apple_os>/frameworks/<platform-arch>/
222227 # <target>.framework/target
223228 library_path = os .path .join (framework_os_path ,
@@ -394,7 +399,7 @@ def build_xcframeworks(frameworks_path, xcframeworks_path, template_info_plist):
394399 # Create Info.plist for xcframework
395400 dest_path = os .path .join (target_xcframeworks_path , 'Info.plist' )
396401 logging .info ('Copying template {0}' .format (template_info_plist ))
397- shutil .copy (template_info_plist , target_xcframeworks_path )
402+ shutil .copy (template_info_plist , dest_path )
398403 contents = None
399404 # Replace token LIBRARY_PATH with current target framework.
400405 with open (dest_path , 'r' ) as info_plist_file :
@@ -483,36 +488,36 @@ def main():
483488 raise ValueError ('No supported targets found for {0}' .format (apple_os ))
484489
485490 frameworks_os_path = os .path .join (frameworks_path , apple_os )
486- for platform in args .platform :
487- os_platform_config = os_config .get (platform )
488- if not os_platform_config :
489- raise ValueError ('Could not find configuration for platform '
490- '{0} for os {1}' .format (platform , apple_os ))
491-
492- archs_from_config = set (os_platform_config ['architectures' ])
493- supported_archs = archs_from_config .intersection (args .architecture )
494- if not supported_archs :
495- raise ValueError ('Could not find valid architectures for platform '
496- '{0} for os {1}' .format (platform , apple_os ))
497-
498- for architecture in supported_archs :
499- platform_architecture_token = '{0}-{1}' .format (platform , architecture )
500- archive_output_path = os .path .join (frameworks_os_path ,
501- platform_architecture_token )
502- # Eg: <build_dir>/tvos_cmake_build/device-arm64
503- build_path = os .path .join (args .build_dir ,
504- '{0}_cmake_build' .format (apple_os ),
505- platform_architecture_token )
506- # For ios builds, we specify architecture to cmake configure.
507- architecture = architecture if apple_os == 'ios' else None
508- # For tvos builds, we pass a special cmake option PLATFORM to toolchain.
509- toolchain_platform = os_platform_config ['toolchain_platform' ] if \
510- apple_os == 'tvos' else None
511- cmake_configure_and_build (build_path , os_platform_config ['toolchain' ],
512- archive_output_path , supported_targets ,
513- architecture , toolchain_platform )
514- # Arrange frameworks
515- arrange_frameworks (archive_output_path )
491+ # for platform in args.platform:
492+ # os_platform_config = os_config.get(platform)
493+ # if not os_platform_config:
494+ # raise ValueError('Could not find configuration for platform '
495+ # '{0} for os {1}'.format(platform, apple_os))
496+
497+ # archs_from_config = set(os_platform_config['architectures'])
498+ # supported_archs = archs_from_config.intersection(args.architecture)
499+ # if not supported_archs:
500+ # raise ValueError('Could not find valid architectures for platform '
501+ # '{0} for os {1}'.format(platform, apple_os))
502+
503+ # for architecture in supported_archs:
504+ # platform_architecture_token = '{0}-{1}'.format(platform, architecture)
505+ # archive_output_path = os.path.join(frameworks_os_path,
506+ # platform_architecture_token)
507+ # # Eg: <build_dir>/tvos_cmake_build/device-arm64
508+ # build_path = os.path.join(args.build_dir,
509+ # '{0}_cmake_build'.format(apple_os),
510+ # platform_architecture_token)
511+ # # For ios builds, we specify architecture to cmake configure.
512+ # architecture = architecture if apple_os == 'ios' else None
513+ # # For tvos builds, we pass a special cmake option PLATFORM to toolchain.
514+ # toolchain_platform = os_platform_config['toolchain_platform'] if \
515+ # apple_os == 'tvos' else None
516+ # cmake_configure_and_build(build_path, os_platform_config['toolchain'],
517+ # archive_output_path, supported_targets,
518+ # architecture, toolchain_platform)
519+ # # Arrange frameworks
520+ # arrange_frameworks(archive_output_path)
516521
517522 # if we built for all architectures build universal framework as well.
518523 build_universal_framework (frameworks_path )
@@ -521,7 +526,8 @@ def main():
521526 xcframeworks_path = os .path .join (args .build_dir , 'xcframeworks' )
522527 template_info_plist_path = os .path .join (args .source_dir , 'build_scripts' ,
523528 'tvos' , 'Info_ios_and_tvos.plist' )
524- build_xcframeworks (frameworks_path , xcframeworks_path , template_info_plist_path )
529+ build_xcframeworks (frameworks_path , xcframeworks_path ,
530+ template_info_plist_path )
525531
526532
527533def parse_cmdline_args ():
0 commit comments