summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-02-23 11:50:44 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-02-24 16:49:05 +0100
commit662edea0202b296874894d6df6817f0993ec24a7 (patch)
tree224d2dfcb0deb9eaa246808fc2a440be01e0bdd6
parent9557cd8d93749b70c16521e15e156d02baa4bda7 (diff)
downloadqtlocation-mapboxgl-662edea0202b296874894d6df6817f0993ec24a7.tar.gz
[ios] fix benchmark app
-rw-r--r--platform/ios/benchmark/MBXBenchAppDelegate.m21
-rw-r--r--platform/ios/benchmark/MBXBenchViewController.mm10
-rw-r--r--platform/ios/benchmark/benchmark-ios.gypi29
3 files changed, 47 insertions, 13 deletions
diff --git a/platform/ios/benchmark/MBXBenchAppDelegate.m b/platform/ios/benchmark/MBXBenchAppDelegate.m
index e8fbd88d28..5da6ccfcec 100644
--- a/platform/ios/benchmark/MBXBenchAppDelegate.m
+++ b/platform/ios/benchmark/MBXBenchAppDelegate.m
@@ -1,10 +1,27 @@
#import "MBXBenchAppDelegate.h"
#import "MBXBenchViewController.h"
+#import <Mapbox/Mapbox.h>
@implementation MBXBenchAppDelegate
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
-{
+- (BOOL)application:(UIApplication*)application
+ didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
+ NSString* accessToken = [[NSProcessInfo processInfo] environment][@"MAPBOX_ACCESS_TOKEN"];
+ if (accessToken) {
+ // Store to preferences so that we can launch the app later on without having to specify
+ // token.
+ [[NSUserDefaults standardUserDefaults] setObject:accessToken forKey:@"access_token"];
+ } else {
+ // Try to retrieve from preferences, maybe we've stored them there previously and can reuse
+ // the token.
+ accessToken = [[NSUserDefaults standardUserDefaults] objectForKey:@"access_token"];
+ }
+ if (!accessToken) {
+ NSLog(@"No access token set. Mapbox vector tiles won't work.");
+ } else {
+ [MGLAccountManager setAccessToken:accessToken];
+ }
+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = [MBXBenchViewController new];
[self.window makeKeyAndVisible];
diff --git a/platform/ios/benchmark/MBXBenchViewController.mm b/platform/ios/benchmark/MBXBenchViewController.mm
index 44ca48f436..a381813ffc 100644
--- a/platform/ios/benchmark/MBXBenchViewController.mm
+++ b/platform/ios/benchmark/MBXBenchViewController.mm
@@ -1,6 +1,6 @@
#import "MBXBenchViewController.h"
-#import <mbgl/ios/MGLMapView.h>
+#import <Mapbox/Mapbox.h>
#include "locations.hpp"
@@ -44,7 +44,7 @@
{
[super viewDidLoad];
- NSURL* url = [[NSURL alloc] initWithString:@"mapbox://styles/mapbox/streets-v8.json"];
+ NSURL* url = [[NSURL alloc] initWithString:@"mapbox://styles/mapbox/streets-v8"];
self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds styleURL:url];
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mapView.delegate = self;
@@ -62,7 +62,7 @@
size_t idx = 0;
enum class State { None, WaitingForAssets, WarmingUp, Benchmarking } state = State::None;
int frames = 0;
-TimePoint started;
+std::chrono::steady_clock::time_point started;
std::vector<std::pair<std::string, double>> result;
static const int warmupDuration = 20; // frames
@@ -102,7 +102,7 @@ static const int benchmarkDuration = 200; // frames
state = State::None;
// Report FPS
- const auto duration = Microseconds(Clock::now() - started);
+ const auto duration = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now() - started).count() ;
const auto fps = double(frames * 1e6) / duration;
result.emplace_back(mbgl::bench::locations[idx].name, fps);
NSLog(@"- FPS: %.1f", fps);
@@ -123,7 +123,7 @@ static const int benchmarkDuration = 200; // frames
{
frames = 0;
state = State::Benchmarking;
- started = Clock::now();
+ started = std::chrono::steady_clock::now();
NSLog(@"- Benchmarking for %d frames...", benchmarkDuration);
}
[mapView setNeedsGLDisplay];
diff --git a/platform/ios/benchmark/benchmark-ios.gypi b/platform/ios/benchmark/benchmark-ios.gypi
index 3b1efa6d73..5962a6b338 100644
--- a/platform/ios/benchmark/benchmark-ios.gypi
+++ b/platform/ios/benchmark/benchmark-ios.gypi
@@ -16,10 +16,7 @@
],
'dependencies': [
- 'mbgl.gyp:core',
- 'mbgl.gyp:platform-<(platform_lib)',
- 'mbgl.gyp:http-<(http_lib)',
- 'mbgl.gyp:asset-<(asset_lib)',
+ 'iossdk',
],
'sources': [
@@ -35,27 +32,47 @@
'xcode_settings': {
'SDKROOT': 'iphoneos',
'SUPPORTED_PLATFORMS': 'iphoneos',
- 'IPHONEOS_DEPLOYMENT_TARGET': '7.0',
+ 'IPHONEOS_DEPLOYMENT_TARGET': '8.0',
'INFOPLIST_FILE': '../platform/ios/benchmark/app-info.plist',
'TARGETED_DEVICE_FAMILY': '1,2',
'COMBINE_HIDPI_IMAGES': 'NO', # don't merge @2x.png 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',
+ ],
+ 'OTHER_LDFLAGS': [
+ '-framework CoreLocation',
+ ],
},
'configurations': {
'Debug': {
'xcode_settings': {
'CODE_SIGN_IDENTITY': 'iPhone Developer',
+ 'COPY_PHASE_STRIP': 'NO',
},
},
'Release': {
'xcode_settings': {
'CODE_SIGN_IDENTITY': 'iPhone Distribution',
- 'ARCHS': [ "arm64" ],
+ '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,
+ },
+ ],
}
]
}