[ios] Moved SDK from gyp into Xcode project

Added a new Cocoa Touch dynamic framework target and Cocoa Touch static library target to the main iOS Xcode project. The targets are based on the templates provided by Xcode. They contain headers and source files in the darwin/ and ios/ subdirectories. Headers are explicitly marked public or project-internal instead of implicitly by subdirectory.

The SDK targets have a few dependencies that are managed by mason. Transform the config.gypi generated by configure into an .xcconfig file that Xcode uses to fill in compiler and linker flags.

Removed the iossdk target from platform.gypi and pared down the platform-lib target. make iproj opens the overall Xcode workspace instead of just the core project.

Resolved some warnings that are only now appearing because we’re using the standard warning and error flags instead of the pedantic and somewhat inappropriate flags that were forced by the gyp configuration files. Removed a console message informing developers of a long-ago deleted delegate method; the message was triggering a “selector not found” warning. Conditionalized some deprecated symbol usage that’s still needed for the static framework but not the dynamic framework, due to differing minimum deployment targets.

Added a build phase to the static library target that copies headers for use with the static library itself. This would allow us to potentially include a header in the dynamic framework but not the static library and vice-versa.

Updated the changelog to note that unused SVG files have been removed from the distribution.
This commit is contained in:
Minh Nguyễn
2016-04-10 22:23:14 -07:00
committed by Minh Nguyễn
parent 1549b2b249
commit b8c39667ff
15 changed files with 1091 additions and 188 deletions

View File

@@ -52,7 +52,7 @@ ios: $(IOS_PROJ_PATH)
-project $(IOS_PROJ_PATH) -target All build | xcpretty
iproj: $(IOS_PROJ_PATH)
open $(IOS_PROJ_PATH)
open platform/ios/ios.xcworkspace
test-ios: ios
ios-sim start

View File

@@ -5,7 +5,6 @@
#import "MGLTilePyramidOfflineRegion.h"
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/util/string.hpp>
/**
Assert that the current offline pack is valid.

View File

@@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. If you’d like
## master
- User location heading updates now resume properly when an app becomes active again. ([#4674](https://github.com/mapbox/mapbox-gl-native/pull/4674))
- Removed unused SVG files from the SDK’s resource bundle. ([#4641](https://github.com/mapbox/mapbox-gl-native/pull/4641))
## 3.2.0

View File

@@ -5,20 +5,22 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0</string>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@@ -1,8 +1,8 @@
#import <Mapbox/Mapbox.h>
#import "../src/NSBundle+MGLAdditions.h"
#import "../src/NSProcessInfo+MGLAdditions.h"
#import "../../darwin/src/NSString+MGLAdditions.h"
#import "NSBundle+MGLAdditions.h"
#import "NSProcessInfo+MGLAdditions.h"
#import "NSString+MGLAdditions.h"
__attribute__((constructor))
static void InitializeMapbox() {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA8847D11CBAF91600AB86E3"
BuildableName = "Mapbox.framework"
BlueprintName = "dynamic"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA8847D11CBAF91600AB86E3"
BuildableName = "Mapbox.framework"
BlueprintName = "dynamic"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DA8847D11CBAF91600AB86E3"
BuildableName = "Mapbox.framework"
BlueprintName = "dynamic"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DAA4E4121CBB71D400178DFB"
BuildableName = "libMapbox.a"
BlueprintName = "static"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DAA4E4121CBB71D400178DFB"
BuildableName = "libMapbox.a"
BlueprintName = "static"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "DAA4E4121CBB71D400178DFB"
BuildableName = "libMapbox.a"
BlueprintName = "static"
ReferencedContainer = "container:ios.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -66,7 +66,17 @@
'copies': [{
'destination': '<(PRODUCT_DIR)/$(WRAPPER_NAME)/test',
'files': [ '../../test/fixtures' ],
}]
}],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/CoreGraphics.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',
],
},
},
{
'target_name': 'platform-lib',
@@ -104,53 +114,6 @@
'../darwin/src/image.mm',
'../darwin/src/nsthread.mm',
'../darwin/src/reachability.m',
'../darwin/src/NSException+MGLAdditions.h',
'../darwin/src/NSString+MGLAdditions.h',
'../darwin/src/NSString+MGLAdditions.m',
'../darwin/src/MGLTypes.m',
'../darwin/src/MGLStyle.mm',
'../darwin/src/MGLGeometry_Private.h',
'../darwin/src/MGLGeometry.mm',
'../darwin/src/MGLShape.m',
'../darwin/src/MGLMultiPoint_Private.h',
'../darwin/src/MGLMultiPoint.mm',
'../darwin/src/MGLPointAnnotation.m',
'../darwin/src/MGLPolyline.mm',
'../darwin/src/MGLPolygon.mm',
'../darwin/src/MGLMapCamera.mm',
'../darwin/src/MGLOfflinePack.mm',
'../darwin/src/MGLOfflinePack_Private.h',
'../darwin/src/MGLOfflineStorage.mm',
'../darwin/src/MGLOfflineStorage_Private.h',
'../darwin/src/MGLOfflineRegion_Private.h',
'../darwin/src/MGLTilePyramidOfflineRegion.mm',
'../darwin/src/MGLAccountManager_Private.h',
'../darwin/src/MGLAccountManager.m',
'../darwin/src/NSBundle+MGLAdditions.h',
'../darwin/src/NSBundle+MGLAdditions.m',
'../darwin/src/NSProcessInfo+MGLAdditions.h',
'../darwin/src/NSProcessInfo+MGLAdditions.m',
'src/MGLMapboxEvents.h',
'src/MGLMapboxEvents.m',
'src/MGLAPIClient.h',
'src/MGLAPIClient.m',
'src/MGLLocationManager.h',
'src/MGLLocationManager.m',
'src/MGLMapView.mm',
'src/MGLUserLocation_Private.h',
'src/MGLUserLocation.m',
'src/MGLUserLocationAnnotationView.h',
'src/MGLUserLocationAnnotationView.m',
'src/MGLAnnotationImage_Private.h',
'src/MGLAnnotationImage.m',
'src/MGLCompactCalloutView.h',
'src/MGLCompactCalloutView.m',
'vendor/SMCalloutView/SMCalloutView.h',
'vendor/SMCalloutView/SMCalloutView.m',
'vendor/Fabric/FABAttributes.h',
'vendor/Fabric/FABKitProtocol.h',
'vendor/Fabric/Fabric.h',
'vendor/Fabric/Fabric+FABKits.h',
],
'variables': {
@@ -168,16 +131,6 @@
'libraries': [
'<@(sqlite_static_libs)',
'<@(zlib_static_libs)',
'$(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',
],
},
@@ -193,79 +146,6 @@
'OTHER_LDFLAGS': [ '<@(ldflags)' ],
},
},
'direct_dependent_settings': {
'include_dirs': [
'include',
'../darwin/include',
'../include',
],
'mac_bundle_resources': [
'<!@(find resources -type f \! -name "README" \! -name \'.*\')',
'<!@(find ../default/resources -type f \! -name "README" \! -name \'.der\')',
],
},
},
{
'target_name': 'iossdk',
'product_name': 'Mapbox',
'type': 'shared_library',
'mac_bundle': 1,
'dependencies': [
'platform-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': 'framework/Info.plist',
'IPHONEOS_DEPLOYMENT_TARGET': '8.0',
'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': [
'framework/Mapbox.h',
'<!@(find ../{darwin,ios}/include -type f \! -name \'.*\' \! -name Mapbox.h)',
],
'sources': [
'framework/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',
},
},
},
}
],
}

View File

@@ -85,9 +85,9 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
DEPLOYMENT_POSTPROCESSING=YES \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY= \
-project ./build/ios-all/platform/ios/platform.xcodeproj \
-workspace ./platform/ios/ios.xcworkspace \
-configuration ${BUILDTYPE} \
-target platform-lib \
-scheme static \
-jobs ${JOBS} | xcpretty
fi
@@ -102,9 +102,9 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGN_IDENTITY= \
-project ./build/ios-all/platform/ios/platform.xcodeproj \
-workspace ./platform/ios/ios.xcworkspace \
-configuration ${BUILDTYPE} \
-target iossdk \
-scheme dynamic \
-jobs ${JOBS} | xcpretty
fi
fi
@@ -115,9 +115,9 @@ if [[ ${BUILD_STATIC} == true ]]; then
ARCHS="x86_64 i386" \
ONLY_ACTIVE_ARCH=NO \
GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \
-project ./build/ios-all/platform/ios/platform.xcodeproj \
-workspace ./platform/ios/ios.xcworkspace \
-configuration ${BUILDTYPE} \
-target platform-lib \
-scheme static \
-jobs ${JOBS} | xcpretty
fi
@@ -129,9 +129,9 @@ if [[ ${BUILD_DYNAMIC} == true ]]; then
GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \
ENABLE_BITCODE=${ENABLE_BITCODE} \
CURRENT_PROJECT_VERSION=${PROJ_VERSION} \
-project ./build/ios-all/platform/ios/platform.xcodeproj \
-workspace ./platform/ios/ios.xcworkspace \
-configuration ${BUILDTYPE} \
-target iossdk \
-scheme dynamic \
-jobs ${JOBS} | xcpretty
fi
@@ -202,10 +202,9 @@ fi
if [[ ${BUILD_STATIC} == true ]]; then
step "Copying static library headers…"
mkdir -p "${OUTPUT}/static/${NAME}.framework/Headers"
cp -pv platform/{darwin,ios}/include/*.h "${OUTPUT}/static/${NAME}.framework/Headers"
cp -rv "build/ios-all/${BUILDTYPE}-iphoneos/Headers" "${OUTPUT}/static/${NAME}.framework/Headers"
cat platform/ios/framework/Mapbox-static.h > "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h"
cat platform/ios/framework/Mapbox.h >> "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h"
cat "build/ios-all/${BUILDTYPE}-iphoneos/Headers/Mapbox.h" >> "${OUTPUT}/static/${NAME}.framework/Headers/Mapbox.h"
fi
step "Copying library resources…"

View File

@@ -61,12 +61,16 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage
}
- (void)startLocationServices {
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized ||
[CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse) {
CLAuthorizationStatus authorizationStatus = [CLLocationManager authorizationStatus];
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
BOOL authorizedAlways = authorizationStatus == kCLAuthorizationStatusAuthorizedAlways;
#else
BOOL authorizedAlways = authorizationStatus == kCLAuthorizationStatusAuthorized;
#endif
if (authorizedAlways || authorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse) {
// If the host app can run in the background with `always` location permissions then allow background
// updates and start the significant location change service and background timeout timer
if (self.hostAppHasBackgroundCapability && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) {
if (self.hostAppHasBackgroundCapability && authorizedAlways) {
[self.standardLocationManager startMonitoringSignificantLocationChanges];
[self startBackgroundTimeoutTimer];
// On iOS 9 and above also allow background location updates
@@ -121,7 +125,11 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status {
switch (status) {
case kCLAuthorizationStatusAuthorized: // Also handles kCLAuthorizationStatusAuthorizedAlways
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
case kCLAuthorizationStatusAuthorizedAlways:
#else
case kCLAuthorizationStatusAuthorized:
#endif
case kCLAuthorizationStatusAuthorizedWhenInUse:
[self startUpdatingLocation];
break;

View File

@@ -533,14 +533,6 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
if (_delegate == delegate) return;
_delegate = delegate;
if ([delegate respondsToSelector:@selector(mapView:symbolNameForAnnotation:)])
{
[NSException raise:@"Method unavailable" format:
@"-mapView:symbolNameForAnnotation: has been removed from the MGLMapViewDelegate protocol, but %@ still implements it. "
@"Implement -[%@ mapView:imageForAnnotation:] instead.",
NSStringFromClass([delegate class]), NSStringFromClass([delegate class])];
}
_delegateHasAlphasForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:alphaForShapeAnnotation:)];
_delegateHasStrokeColorsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:strokeColorForShapeAnnotation:)];

View File

@@ -471,7 +471,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
CGContextDrawRadialGradient(context, gradient,
centerPoint, 0.0,
centerPoint, haloRadius,
nil);
kNilOptions);
image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

20
scripts/export-xcconfig.py Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python
import sys, ast, re
ILLEGAL_CHAR_RE = re.compile(r"\W")
def main():
with open(sys.argv[1], "r") as in_file, open(sys.argv[2], "w") as out_file:
config = ast.literal_eval(in_file.read())
variables = ["// Do not edit -- generated by export-xcconfig.py\n"]
assert(type(config) is dict)
assert(type(config["variables"]) is dict)
for variable, flags in config["variables"].iteritems():
variable = ILLEGAL_CHAR_RE.sub("_", variable.rstrip("%"))
flags = " ".join('"%s"' % flag for flag in flags)
variables.append("%s = %s\n" % (variable, flags))
out_file.writelines(variables)
if __name__ == '__main__':
main()

View File

@@ -79,6 +79,8 @@ Makefile/__project__: $(PLATFORM_CONFIG_OUTPUT)
.PHONY: Xcode/__project__
Xcode/__project__: $(PLATFORM_CONFIG_OUTPUT)
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Exporting gyp variables to xcconfig...$(FORMAT_END)\n"
$(ENV) ./scripts/export-xcconfig.py $(PLATFORM_CONFIG_OUTPUT) $(PLATFORM_OUTPUT)/mbgl.xcconfig
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
$(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f xcode$(GYP_FLAVOR_SUFFIX)