diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-12-03 16:03:00 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-01-22 14:45:56 -0800 |
commit | 9350d3f78cee508f98bbae8d31a3a47007cb0322 (patch) | |
tree | 43d9d71c670b4a900727dcd56b59b85860b66401 /ios | |
parent | ded8b62c916b2ad1782486ed9d1fe5049a82c512 (diff) | |
download | qtlocation-mapboxgl-9350d3f78cee508f98bbae8d31a3a47007cb0322.tar.gz |
[ios] Converted iOS SDK into dynamic framework
make iproj now produces a target that pulls together static libraries like core and platform-ios into a real dynamic framework. iosapp is pretty much just a regular iOS application that links Mapbox.framework (except for the inclusion of default_styles.hpp). iosapp runs fine in the Simulator and on a device, and the same is true for any application linking against Mapbox.framework.
The ipackage target produces both a Bitcode-disabled static framework and a Bitcode-enabled dynamic framework, eliminating the need for a separate framework.sh. It disables code signing, since that happens on copy when the framework is embedded inside the application bundle. It also merges the device and simulator builds into a single fat framework.
Also bumped itest minimum deployment target to iOS 8.0, the first version that supports linking frameworks.
Fixes #828.
Diffstat (limited to 'ios')
-rw-r--r-- | ios/Mapbox-iOS-SDK.podspec | 11 | ||||
-rw-r--r-- | ios/app/MBXAppDelegate.m | 2 | ||||
-rw-r--r-- | ios/app/MBXCustomCalloutView.h | 2 | ||||
-rw-r--r-- | ios/app/MBXCustomCalloutView.m | 2 | ||||
-rw-r--r-- | ios/app/MBXViewController.mm | 4 | ||||
-rw-r--r-- | ios/app/mapboxgl-app.gypi | 45 | ||||
-rw-r--r-- | ios/framework/Info.plist | 38 | ||||
-rw-r--r-- | ios/framework/Mapbox.h | 26 | ||||
-rw-r--r-- | ios/framework/Mapbox.m | 29 | ||||
-rw-r--r-- | ios/framework/framework-ios.gypi | 70 | ||||
-rw-r--r-- | ios/framework/umbrella | 9 |
11 files changed, 178 insertions, 60 deletions
diff --git a/ios/Mapbox-iOS-SDK.podspec b/ios/Mapbox-iOS-SDK.podspec index 052ba1447b..ec15132450 100644 --- a/ios/Mapbox-iOS-SDK.podspec +++ b/ios/Mapbox-iOS-SDK.podspec @@ -22,16 +22,7 @@ Pod::Spec.new do |m| m.requires_arc = true - m.preserve_paths = '**' - m.resource_bundle = { 'Mapbox' => 'Mapbox.framework/Mapbox.bundle/*' } - m.vendored_frameworks = 'Mapbox.framework' + m.vendored_frameworks = 'dynamic/Mapbox.framework' m.module_name = 'Mapbox' - m.frameworks = 'CoreLocation', 'GLKit', 'ImageIO', 'MobileCoreServices', 'QuartzCore', 'SystemConfiguration' - m.libraries = 'c++', 'sqlite3', 'z' - m.pod_target_xcconfig = { - 'OTHER_CPLUSPLUSFLAGS' => '-std=gnu++11 -stdlib=libc++', - 'OTHER_LDFLAGS' => '-ObjC', - } - end diff --git a/ios/app/MBXAppDelegate.m b/ios/app/MBXAppDelegate.m index bca039739a..a06424feb7 100644 --- a/ios/app/MBXAppDelegate.m +++ b/ios/app/MBXAppDelegate.m @@ -1,6 +1,6 @@ #import "MBXAppDelegate.h" #import "MBXViewController.h" -#import <mbgl/ios/Mapbox.h> +#import <Mapbox/Mapbox.h> @implementation MBXAppDelegate diff --git a/ios/app/MBXCustomCalloutView.h b/ios/app/MBXCustomCalloutView.h index 7f0a61bae3..a61619b79f 100644 --- a/ios/app/MBXCustomCalloutView.h +++ b/ios/app/MBXCustomCalloutView.h @@ -1,5 +1,5 @@ #import <UIKit/UIKit.h> -#import <mbgl/ios/MGLCalloutView.h> +#import <Mapbox/Mapbox.h> /** * Basic custom callout view to demonstrate how to diff --git a/ios/app/MBXCustomCalloutView.m b/ios/app/MBXCustomCalloutView.m index 0bbb9d99ed..8f9bd8ed40 100644 --- a/ios/app/MBXCustomCalloutView.m +++ b/ios/app/MBXCustomCalloutView.m @@ -1,7 +1,5 @@ #import "MBXCustomCalloutView.h" -#import <mbgl/darwin/MGLAnnotation.h> - static CGFloat const tipHeight = 10.0; static CGFloat const tipWidth = 10.0; diff --git a/ios/app/MBXViewController.mm b/ios/app/MBXViewController.mm index 6a2b0cc3fa..fddab78559 100644 --- a/ios/app/MBXViewController.mm +++ b/ios/app/MBXViewController.mm @@ -1,8 +1,8 @@ #import "MBXViewController.h" #import "MBXCustomCalloutView.h" -#import <mbgl/ios/Mapbox.h> -#import <mbgl/util/default_styles.hpp> +#import <Mapbox/Mapbox.h> +#import "../../include/mbgl/util/default_styles.hpp" #import <CoreLocation/CoreLocation.h> #import <OpenGLES/ES2/gl.h> diff --git a/ios/app/mapboxgl-app.gypi b/ios/app/mapboxgl-app.gypi index 4fa0ba6649..f154a10e9b 100644 --- a/ios/app/mapboxgl-app.gypi +++ b/ios/app/mapboxgl-app.gypi @@ -3,7 +3,8 @@ '../../gyp/common.gypi', ], 'targets': [ - { 'target_name': 'iosapp', + { + 'target_name': 'iosapp', 'product_name': 'Mapbox GL', 'type': 'executable', 'product_extension': 'app', @@ -14,50 +15,64 @@ './polyline.geojson', './threestates.geojson', './Settings.bundle/', - './app-info.plist' + './app-info.plist', ], 'dependencies': [ - 'mbgl.gyp:core', - 'mbgl.gyp:platform-<(platform_lib)', - 'mbgl.gyp:http-<(http_lib)', - 'mbgl.gyp:asset-<(asset_lib)', + 'iossdk', ], 'sources': [ - './main.m', - './MBXAppDelegate.h', - './MBXAppDelegate.m', - './MBXCustomCalloutView.h', - './MBXCustomCalloutView.m', - './MBXViewController.h', - './MBXViewController.mm', + 'main.m', + 'MBXAppDelegate.h', + 'MBXAppDelegate.m', + 'MBXCustomCalloutView.h', + 'MBXCustomCalloutView.m', + 'MBXViewController.h', + 'MBXViewController.mm', ], 'xcode_settings': { 'SDKROOT': 'iphoneos', 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', - 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', + 'IPHONEOS_DEPLOYMENT_TARGET': '8.0', 'INFOPLIST_FILE': '../ios/app/app-info.plist', 'TARGETED_DEVICE_FAMILY': '1,2', - 'COMBINE_HIDPI_IMAGES': 'NO', # don't merge @2x.png images into .tiff files + 'COMBINE_HIDPI_IMAGES': 'NO', # disable combining @2x, @3x images into .tiff files + 'COPY_PHASE_STRIP': 'NO', 'CLANG_ENABLE_OBJC_ARC': 'YES', 'CLANG_ENABLE_MODULES': 'YES', + 'LD_RUNPATH_SEARCH_PATHS': [ + '$(inherited)', + '@executable_path/Frameworks', + ], }, 'configurations': { 'Debug': { 'xcode_settings': { 'CODE_SIGN_IDENTITY': 'iPhone Developer', + 'COPY_PHASE_STRIP': 'NO', }, }, 'Release': { 'xcode_settings': { 'CODE_SIGN_IDENTITY': 'iPhone Distribution', 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + 'COPY_PHASE_STRIP': 'YES', }, }, }, + + 'copies': [ + { + 'destination': '<(PRODUCT_DIR)/$(FRAMEWORKS_FOLDER_PATH)', + 'files': [ + '<(PRODUCT_DIR)/Mapbox.framework', + ], + 'xcode_code_sign': 1, + }, + ], } ] } diff --git a/ios/framework/Info.plist b/ios/framework/Info.plist index 1dd4a72aef..7cb6e1dfd3 100644 --- a/ios/framework/Info.plist +++ b/ios/framework/Info.plist @@ -2,25 +2,23 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>CFBundleDevelopmentRegion</key> - <string>en</string> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIdentifier</key> - <string>com.mapbox.sdk.ios</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundlePackageType</key> - <string>FMWK</string> - <key>CFBundleShortVersionString</key> - <string>#####</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>%%%%%</string> - <key>NSPrincipalClass</key> - <string></string> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIdentifier</key> + <string>${PRODUCT_BUNDLE_IDENTIFIER}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>0</string> </dict> </plist> diff --git a/ios/framework/Mapbox.h b/ios/framework/Mapbox.h new file mode 100644 index 0000000000..0df6d1f611 --- /dev/null +++ b/ios/framework/Mapbox.h @@ -0,0 +1,26 @@ +#import <Foundation/Foundation.h> + +/// Project version number for Mapbox. +FOUNDATION_EXPORT double MapboxVersionNumber; + +/// Project version string for Mapbox. +FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; + +#import <Mapbox/MGLAccountManager.h> +#import <Mapbox/MGLAnnotation.h> +#import <Mapbox/MGLAnnotationImage.h> +#import <Mapbox/MGLCalloutView.h> +#import <Mapbox/MGLMapCamera.h> +#import <Mapbox/MGLGeometry.h> +#import <Mapbox/MGLMapView.h> +#import <Mapbox/MGLMapView+IBAdditions.h> +#import <Mapbox/MGLMapView+MGLCustomStyleLayerAdditions.h> +#import <Mapbox/MGLMultiPoint.h> +#import <Mapbox/MGLOverlay.h> +#import <Mapbox/MGLPointAnnotation.h> +#import <Mapbox/MGLPolygon.h> +#import <Mapbox/MGLPolyline.h> +#import <Mapbox/MGLShape.h> +#import <Mapbox/MGLStyle.h> +#import <Mapbox/MGLTypes.h> +#import <Mapbox/MGLUserLocation.h> diff --git a/ios/framework/Mapbox.m b/ios/framework/Mapbox.m new file mode 100644 index 0000000000..a81ca09135 --- /dev/null +++ b/ios/framework/Mapbox.m @@ -0,0 +1,29 @@ +#import <Mapbox/Mapbox.h> + +#import "../../platform/ios/src/NSBundle+MGLAdditions.h" +#import "../../platform/ios/src/NSProcessInfo+MGLAdditions.h" +#import "../../platform/darwin/NSString+MGLAdditions.h" + +__attribute__((constructor)) +static void InitializeMapbox() { + static int initialized = 0; + if (initialized) { + return; + } + + mgl_linkBundleCategory(); + mgl_linkStringCategory(); + mgl_linkProcessInfoCategory(); + + [MGLAccountManager class]; + [MGLAnnotationImage class]; + [MGLMapCamera class]; + [MGLMapView class]; + [MGLMultiPoint class]; + [MGLPointAnnotation class]; + [MGLPolygon class]; + [MGLPolyline class]; + [MGLShape class]; + [MGLStyle class]; + [MGLUserLocation class]; +} diff --git a/ios/framework/framework-ios.gypi b/ios/framework/framework-ios.gypi new file mode 100644 index 0000000000..8c83523e58 --- /dev/null +++ b/ios/framework/framework-ios.gypi @@ -0,0 +1,70 @@ +{ + 'includes': [ + '../../gyp/common.gypi', + ], + 'targets': [ + { + 'target_name': 'iossdk', + 'product_name': 'Mapbox', + 'type': 'shared_library', + 'mac_bundle': 1, + + 'dependencies': [ + 'mbgl.gyp:core', + 'mbgl.gyp:platform-<(platform_lib)', + 'mbgl.gyp:http-<(http_lib)', + 'mbgl.gyp:asset-<(asset_lib)', + ], + + 'xcode_settings': { + 'CLANG_ENABLE_OBJC_ARC': 'YES', + 'COMBINE_HIDPI_IMAGES': 'NO', # disable combining @2x, @3x images into .tiff files + 'CURRENT_PROJECT_VERSION': '0', + 'DEFINES_MODULE': 'YES', + 'DYLIB_INSTALL_NAME_BASE': '@rpath', + 'INFOPLIST_FILE': '../ios/framework/Info.plist', + 'LD_RUNPATH_SEARCH_PATHS': [ + '$(inherited)', + '@executable_path/Frameworks', + '@loader_path/Frameworks', + ], + 'PRODUCT_BUNDLE_IDENTIFIER': 'com.mapbox.sdk.ios', + 'OTHER_LDFLAGS': [ '-stdlib=libc++', '-lstdc++' ], + 'SDKROOT': 'iphoneos', + 'SKIP_INSTALL': 'YES', + 'SUPPORTED_PLATFORMS': [ + 'iphonesimulator', + 'iphoneos', + ], + 'VERSIONING_SYSTEM': 'apple-generic', + }, + + 'mac_framework_headers': [ + 'Mapbox.h', + '<!@(find ../include/mbgl/{darwin,ios} -type f \! -name \'.*\' \! -name Mapbox.h)', + ], + + 'sources': [ + 'Mapbox.m', + ], + + 'configurations': { + 'Debug': { + 'xcode_settings': { + 'CODE_SIGN_IDENTITY': 'iPhone Developer', + 'DEAD_CODE_STRIPPING': 'YES', + 'GCC_OPTIMIZATION_LEVEL': '0', + }, + }, + 'Release': { + 'xcode_settings': { + 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + 'CODE_SIGN_IDENTITY': 'iPhone Distribution', + 'DEAD_CODE_STRIPPING': 'YES', + 'GCC_OPTIMIZATION_LEVEL': 's', + }, + }, + }, + }, + ] +} diff --git a/ios/framework/umbrella b/ios/framework/umbrella deleted file mode 100644 index 9c04d5c752..0000000000 --- a/ios/framework/umbrella +++ /dev/null @@ -1,9 +0,0 @@ - -#import <GLKit/GLKit.h> -#import <ImageIO/ImageIO.h> -#import <MobileCoreServices/MobileCoreServices.h> -#import <QuartzCore/QuartzCore.h> -#import <SystemConfiguration/SystemConfiguration.h> - -FOUNDATION_EXPORT double MapboxVersionNumber; -FOUNDATION_EXPORT const unsigned char MapboxVersionString[]; |