Method: AppleFrameworks::XCFramework#build_using_xcode
- Defined in:
- lib/apple_frameworks/xcframework.rb
#build_using_xcode ⇒ Object
Uses the ‘xcodebuild -create-xcframework` command to create the XCFramework.
This will require Xcode and its command line tools to be installed.
Xcode has a couple of notable annoyances:
-
Fat binaries with multiple platforms (e.g. a single binary containing iOS simulator x64 and iOS arm64) are not supported.
-
To include multiple architectures of the same platform (e.g. iOS simulator x64 and arm64), they first need to be combined as a Fat binary.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/apple_frameworks/xcframework.rb', line 62 def build_using_xcode validations framework_args = @framework_paths .map { |path| "-framework #{path}" } .join(" ") FileUtils.mkdir_p(@parent_directory) output_path = File.join(@parent_directory, "#{@framework_name}.xcframework") output_args = "-output #{output_path}" logfile = Tempfile.new(['xcframework', '.log']) cmd = "xcodebuild -create-xcframework #{framework_args} #{output_args}" system("#{cmd} >#{logfile.path} 2>&1") || raise(BuildUsingXcodeFailure.new(File.read(logfile).strip)) ensure if logfile logfile.close logfile.delete end end |