I'm creating a Pod for iOS which provides crypto APIs using OpenSSL under the hood.
So far I've managed to call OpenSSL from Swift, but it seems like Swift API and OpenSSL API is mixed up, living in a same OpenSSL
module.
Is it possible to create OpenSSL
module for C OpenSSL API, and OpenSSLTest2
module for Swift API?
Also, I'd like OpenSSL
module to be private if possible.
Here's my podspec.
Pod::Spec.new do |s|
s.name = 'OpenSSLTest2'
s.version = '0.1.0'
s.summary = 'A short description of OpenSSLTest2.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/yshrsmz/OpenSSLTest2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'yshrsmz' => 'mymailaddress' }
s.source = { :git => 'https://github.com/yshrsmz/OpenSSLTest2.git', :tag => s.version.to_s }
s.swift_version = '4.2'
s.platform = :ios
s.ios.deployment_target = '8.0'
# if I change here to 'OpenSSLTest' or something, it won't compile
s.module_name = 'OpenSSL'
s.source_files = 'OpenSSLTest2/Classes/**/*.swift', 'OpenSSLTest2/OpenSSL/include/**/*.h'
s.header_dir = 'openssl'
s.public_header_files = 'OpenSSLTest2/OpenSSL/include/openssl/*.h'
s.preserve_paths = 'OpenSSLTest2/Classes/OpenSSL/module.modulemap'
s.libraries = 'crypto', 'ssl'
s.vendored_libraries = 'OpenSSLTest2/OpenSSL/lib/libcrypto.a', 'OpenSSLTest2/OpenSSL/lib/libssl.a'
s.pod_target_xcconfig = {
'SWIFT_INCLUDE_PATHS' => '$(PODS_ROOT)/OpenSSLTest2/OpenSSL/module $(PODS_TARGET_SRCROOT)/OpenSSL/module',
'LIBRARY_SEARCH_PATHS' => '$(PODS_ROOT)/OpenSSLTest2/OpenSSL/lib'
}
end
this is the modulemap for OpenSSL.
module OpenSSL [system] {
header "openssl/conf.h"
header "openssl/evp.h"
header "openssl/err.h"
header "openssl/bio.h"
header "openssl/ssl.h"
header "openssl/md4.h"
header "openssl/md5.h"
header "openssl/sha.h"
header "openssl/hmac.h"
header "openssl/rand.h"
header "openssl/ripemd.h"
header "openssl/pkcs12.h"
header "openssl/x509v3.h"
export *
}
also this is the complete repository.
https://github.com/yshrsmz/OpenSSLTest2/tree/0.1.0-pre
thanks.
I've ended up with creating a framework which only contains OpenSSL(with modulemap), and then use that framework as vendored_frameworks