We have this podspec referring a static library with spec.vendored_libraries
. The static library was build for 2 cases:
arm64, ios
arm64, ios-simulator
Pod::Spec.new do |spec|
spec.platform = :ios
spec.name = 'pod_lib'
spec.version = '1.0.0'
spec.homepage = 'pod_lib'
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
spec.authors = 'Authors'
spec.license = ''
spec.summary = 'pod_lib'
spec.ios.deployment_target = '13.5'
spec.source_files = 'headers/**/*.h'
spec.public_header_files = 'headers/**/*.h'
spec.vendored_libraries = 'iosArm64/lib/a.a'
spec.header_mappings_dir = 'headers'
spec.static_framework = true
spec.libraries = 'c++'
spec.pod_target_xcconfig = {
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
'CLANG_CXX_LIBRARY' => 'libc++',
'ARCHS' => 'arm64',
}
end
Is it possible to specify both libraries in the cocoapod podspec?
I would like to have something like
spec.vendored_libraries = 'iosArm64/lib/a.a',
'iosSimulatorArm64/lib/a.a'
This does not work because of the same names of the libs and it seems as such functionality is not yet supported: https://github.com/CocoaPods/CocoaPods/issues/8688
As a workaround some people propose to use lipo
to build a universal binary:
lipo -create -output libuniversal.a ./iosArm64/lib/a.a ./iosSimulatorArm64/lib/a.a
This does not work because both binaries are already built for the same architecture (arm64).
Is it possible to have one cocoapod that includes both platforms? Or is there another approach to solve this issue?
In the link below the usage of ar
or libtool
is described to make a universal static library, which then can be wrapped into a XCFramework for both iOS and iOS-Simulator platform
See ... Create XCFramework out of two static libraries (libssl.a, libcrypto.a)