From 30851905b595eb88c20c617e60100e307caa55c3 Mon Sep 17 00:00:00 2001 From: Avery Pierce Date: Sat, 14 Jan 2017 14:57:46 -0600 Subject: [PATCH 1/2] Add macOS support to the Podspec --- OLMKit.podspec | 31 ++++++++++++++++--------------- xcode/OLMKit/OLMKit.h | 5 +++++ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/OLMKit.podspec b/OLMKit.podspec index e21d10f..133e23d 100644 --- a/OLMKit.podspec +++ b/OLMKit.podspec @@ -17,45 +17,46 @@ Pod::Spec.new do |s| s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } - s.authors = { "Chris Ballinger" => "chrisballinger@gmail.com", + s.authors = { "Chris Ballinger" => "chrisballinger@gmail.com", "matrix.org" => "support@matrix.org" } - s.platform = :ios, "5.0" + s.ios.deployment_target = "5.0" + s.osx.deployment_target = "10.9" # Expose the Objective-C wrapper API of libolm s.public_header_files = "xcode/OLMKit/*.h" - s.source = { - :git => "https://matrix.org/git/olm.git", - :tag => s.version.to_s + s.source = { + :git => "https://matrix.org/git/olm.git", + :tag => s.version.to_s } - + s.source_files = "xcode/OLMKit/*.{h,m}", "include/**/*.{h,hh}", "src/*.{c,cpp}", "lib/crypto-algorithms/sha256.c", "lib/crypto-algorithms/aes.c", "lib/curve25519-donna/curve25519-donna.c" - + # Those files (including .c) are included by ed25519.c. We do not want to compile them twice s.preserve_paths = "lib/ed25519/**/*.{h,c}" - + s.library = "c++" - - + + # Use the same compiler options for C and C++ as olm/Makefile - + s.compiler_flags = "-g -O3 -DOLMLIB_VERSION_MAJOR=#{MAJOR} -DOLMLIB_VERSION_MINOR=#{MINOR} -DOLMLIB_VERSION_PATCH=#{PATCH}" # For headers search paths, manage first the normal installation. Then, use paths used # when the pod is local - s.xcconfig = { + s.xcconfig = { 'USER_HEADER_SEARCH_PATHS' =>"${PODS_ROOT}/OLMKit/include ${PODS_ROOT}/OLMKit/lib #{File.join(File.dirname(__FILE__), 'include')} #{File.join(File.dirname(__FILE__), 'lib')}" } - + s.subspec 'olmc' do |olmc| olmc.source_files = "src/*.{c}", "lib/curve25519-donna.h", "lib/crypto-algorithms/sha256.{h,c}", "lib/crypto-algorithms/aes.{h,c}", "lib/curve25519-donna/curve25519-donna.c" olmc.compiler_flags = ' -std=c99 -fPIC' end - + s.subspec 'olmcpp' do |olmcpp| olmcpp.source_files = "src/*.{cpp}" olmcpp.compiler_flags = ' -std=c++11 -fPIC' end - + end diff --git a/xcode/OLMKit/OLMKit.h b/xcode/OLMKit/OLMKit.h index 34db111..6fcaa56 100644 --- a/xcode/OLMKit/OLMKit.h +++ b/xcode/OLMKit/OLMKit.h @@ -16,7 +16,12 @@ limitations under the License. */ +#if TARGET_OS_IPHONE #import +#elif TARGET_OS_MAC +#import +#endif + //! Project version string for OLMKit, the same as libolm. NSString *OLMKitVersionString(); From b2b93d7a1f03a620c5ee87491076bf18764adeb4 Mon Sep 17 00:00:00 2001 From: Avery Pierce Date: Sat, 14 Jan 2017 20:13:16 -0600 Subject: [PATCH 2/2] Strip down to Foundation (no need to include UIKit or Cocoa) --- xcode/OLMKit/OLMKit.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xcode/OLMKit/OLMKit.h b/xcode/OLMKit/OLMKit.h index 6fcaa56..e23a9f1 100644 --- a/xcode/OLMKit/OLMKit.h +++ b/xcode/OLMKit/OLMKit.h @@ -16,11 +16,7 @@ limitations under the License. */ -#if TARGET_OS_IPHONE -#import -#elif TARGET_OS_MAC -#import -#endif +#import //! Project version string for OLMKit, the same as libolm.