Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[ios] Converted iOS SDK into dynamic framework
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
1ec5 committed Dec 14, 2015
1 parent d2d722a commit 929a485
Show file tree
Hide file tree
Showing 31 changed files with 337 additions and 321 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Known issues:

## iOS master

- The SDK is now distributed as a dynamic framework instead of a static library, resulting in a simpler installation workflow and significantly reduced download size. The framework contains both simulator and device content; due to [an Xcode bug](http://www.openradar.me/radar?id=6409498411401216), you’ll need to strip out the simulator content before submitting your application to the App Store. ([#3183](https://github.com/mapbox/mapbox-gl-native/pull/3183))
- Fixed CoreTelephony.framework crash. ([#3170](https://github.com/mapbox/mapbox-gl-native/pull/3170))
- `MGLMapView` methods that alter the viewport now accept optional completion handlers. ([#3090](https://github.com/mapbox/mapbox-gl-native/pull/3090))
- Tapping now selects annotations more reliably. Tapping near the top of a large annotation image now selects that annotation. An annotation image’s alignment insets influence how far away the user can tap and still select the annotation. For example, if your annotation image has a large shadow, you can keep that shadow from being tappable by excluding it from the image’s alignment rect. ([#3261](https://github.com/mapbox/mapbox-gl-native/pull/3261))
- The user dot’s callout view is now centered above the user dot. It was previously offset slightly to the left. ([#3261](https://github.com/mapbox/mapbox-gl-native/pull/3261))
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ isim: ; $(RUN) HOST=ios Xcode/iosapp
ibench: export XCODEBUILD_ARGS += -sdk iphoneos ARCHS="arm64"
ibench: ; $(RUN) HOST=ios Xcode/ios-bench

.PHONY: ipackage ipackage-strip ipackage-sim ipackage-no-bitcode itest
.PHONY: ipackage ipackage-strip ipackage-sim itest
ipackage: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh
ipackage-strip: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh strip
ipackage-sim: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh sim
ipackage-no-bitcode: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh no-bitcode
iframework: ipackage-strip ; ./scripts/ios/framework.sh
itest: ipackage-sim ; ./scripts/ios/test.sh

.PHONY: xpackage xpackage-strip
Expand Down
1 change: 1 addition & 0 deletions gyp/ios.gyp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
'includes': [
'../ios/app/mapboxgl-app.gypi',
'../ios/framework/framework-ios.gypi',
'../ios/benchmark/benchmark-ios.gypi',
],
}
44 changes: 11 additions & 33 deletions gyp/platform-ios.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,27 @@
'../platform/darwin/NSException+MGLAdditions.h',
'../platform/darwin/NSString+MGLAdditions.h',
'../platform/darwin/NSString+MGLAdditions.m',
'../include/mbgl/darwin/MGLTypes.h',
'../platform/darwin/MGLTypes.m',
'../include/mbgl/darwin/MGLStyle.h',
'../platform/darwin/MGLStyle.mm',
'../include/mbgl/darwin/MGLGeometry.h',
'../platform/darwin/MGLGeometry_Private.h',
'../platform/darwin/MGLGeometry.mm',
'../include/mbgl/darwin/MGLAnnotation.h',
'../include/mbgl/darwin/MGLShape.h',
'../platform/darwin/MGLShape.m',
'../include/mbgl/darwin/MGLMultiPoint.h',
'../platform/darwin/MGLMultiPoint_Private.h',
'../platform/darwin/MGLMultiPoint.mm',
'../include/mbgl/darwin/MGLOverlay.h',
'../include/mbgl/darwin/MGLPointAnnotation.h',
'../platform/darwin/MGLPointAnnotation.m',
'../include/mbgl/darwin/MGLPolyline.h',
'../platform/darwin/MGLPolyline.mm',
'../include/mbgl/darwin/MGLPolygon.h',
'../platform/darwin/MGLPolygon.mm',
'../include/mbgl/darwin/MGLMapCamera.h',
'../platform/darwin/MGLMapCamera.mm',
'../include/mbgl/ios/Mapbox.h',
'../platform/ios/MGLMapboxEvents.h',
'../platform/ios/MGLMapboxEvents.m',
'../include/mbgl/ios/MGLMapView.h',
'../include/mbgl/ios/MGLMapView+IBAdditions.h',
'../platform/ios/MGLMapView.mm',
'../include/mbgl/ios/MGLAccountManager.h',
'../platform/ios/MGLAccountManager_Private.h',
'../platform/ios/MGLAccountManager.m',
'../include/mbgl/ios/MGLUserLocation.h',
'../platform/ios/MGLUserLocation_Private.h',
'../platform/ios/MGLUserLocation.m',
'../platform/ios/MGLUserLocationAnnotationView.h',
'../platform/ios/MGLUserLocationAnnotationView.m',
'../include/mbgl/ios/MGLAnnotationImage.h',
'../platform/ios/MGLAnnotationImage.m',
'../platform/ios/MGLCategoryLoader.h',
'../platform/ios/MGLCategoryLoader.m',
'../platform/ios/NSBundle+MGLAdditions.h',
'../platform/ios/NSBundle+MGLAdditions.m',
'../platform/ios/NSProcessInfo+MGLAdditions.h',
Expand All @@ -73,7 +54,6 @@
'../platform/ios/vendor/Fabric/FABKitProtocol.h',
'../platform/ios/vendor/Fabric/Fabric.h',
'../platform/ios/vendor/Fabric/Fabric+FABKits.h',
'../platform/ios/resources/',
],

'variables': {
Expand All @@ -84,15 +64,16 @@
],
'libraries': [
'<@(libuv_static_libs)',
],
'ldflags': [
'-framework CoreLocation',
'-framework GLKit',
'-framework ImageIO',
'-framework MobileCoreServices',
'-framework QuartzCore',
'-framework SystemConfiguration',
'-ObjC',
'$(SDKROOT)/System/Library/Frameworks/CoreGraphics.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreLocation.framework',
'$(SDKROOT)/System/Library/Frameworks/GLKit.framework',
'$(SDKROOT)/System/Library/Frameworks/ImageIO.framework',
'$(SDKROOT)/System/Library/Frameworks/MobileCoreServices.framework',
'$(SDKROOT)/System/Library/Frameworks/OpenGLES.framework',
'$(SDKROOT)/System/Library/Frameworks/QuartzCore.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
'$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
'$(SDKROOT)/System/Library/Frameworks/UIKit.framework',
],
},

Expand All @@ -111,9 +92,6 @@

'link_settings': {
'libraries': [ '<@(libraries)' ],
'xcode_settings': {
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
},
},

'direct_dependent_settings': {
Expand All @@ -123,7 +101,7 @@
'../include',
],
'mac_bundle_resources': [
'<!@(find ../platform/ios/resources -type f \! -name "README")',
'<!@(find ../platform/ios/resources -type f \! -name "README" \! -name \'.*\')',
],
},
},
Expand Down
11 changes: 1 addition & 10 deletions ios/Mapbox-iOS-SDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion ios/app/MBXAppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "MBXAppDelegate.h"
#import "MBXViewController.h"
#import <mbgl/ios/Mapbox.h>
#import <Mapbox/Mapbox.h>

@implementation MBXAppDelegate

Expand Down
4 changes: 2 additions & 2 deletions ios/app/MBXViewController.mm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import "MBXViewController.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>

Expand Down
37 changes: 25 additions & 12 deletions ios/app/mapboxgl-app.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,58 @@
],

'dependencies': [
'mbgl.gyp:core',
'mbgl.gyp:platform-<(platform_lib)',
'mbgl.gyp:http-<(http_lib)',
'mbgl.gyp:asset-<(asset_lib)',
'mbgl.gyp:cache-<(cache_lib)',
'iossdk',
],

'sources': [
'./main.m',
'./MBXAppDelegate.h',
'./MBXAppDelegate.m',
'./MBXViewController.h',
'./MBXViewController.mm',
'main.m',
'MBXAppDelegate.h',
'MBXAppDelegate.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,
}
],
}
]
}
38 changes: 18 additions & 20 deletions ios/framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
24 changes: 24 additions & 0 deletions ios/framework/Mapbox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#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/MGLMapCamera.h>
#import <Mapbox/MGLGeometry.h>
#import <Mapbox/MGLMapView.h>
#import <Mapbox/MGLMapView+IBAdditions.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>
29 changes: 29 additions & 0 deletions ios/framework/Mapbox.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#import <Mapbox/Mapbox.h>

#import "../../platform/ios/NSBundle+MGLAdditions.h"
#import "../../platform/ios/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];
}
Loading

0 comments on commit 929a485

Please sign in to comment.