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

Commit

Permalink
move iOS code from gl-cocoa to this project
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Feb 10, 2015
1 parent 0ee6044 commit d4d4cd4
Show file tree
Hide file tree
Showing 96 changed files with 4,717 additions and 80 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/build
/macosx/build
/linux/build
/ios/build
/test/build
/test/node_modules
/include/mbgl/shader/shaders.hpp
Expand Down
10 changes: 3 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "ios/mapbox-gl-cocoa"]
path = ios/mapbox-gl-cocoa
url = https://github.com/mapbox/mapbox-gl-cocoa.git

[submodule "test/suite"]
path = test/suite
url = https://github.com/mapbox/mapbox-gl-test-suite.git
Expand All @@ -14,6 +10,6 @@
path = styles
url = https://github.com/mapbox/mapbox-gl-styles.git

[submodule "app/ios"]
path = app/ios
url = https://github.com/mapbox/mapbox-gl-cocoa.git
[submodule "test/ios/KIF"]
path = test/ios/KIF
url = https://github.com/mapbox/KIF.git
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ env:
- secure: "CHBiUM60TolDbQnn+4IRA/tvOKwKs3g9EDvv8YHSJMg3FuHmjKQkprBasvxf3hnTXg4WLZEubmeDcyJ6RRzPP5mMSr/hksYl0pSjj/6TUecE5fHPVVeN7txVqkpOBf9i45Y+iBUQMjBb1NnDK3pHXxpnAs1Q/pe7vReErj4GF1U="
- LD_LIBRARY_PATH: '/usr/local/lib'
- TERM: dumb
# begin iOS code signing
- secure: "I6Iu75X1E+js5tzijtKi1EGtIuBcA4/25nDYe0svV4HAtujY71ZJZ4eB6355CKhFXpLXrF3i7eKVX3v+zWS0QROPEWacgsqsvNg+Ba9cnznW/faUSOYekCfhzWd/6reYDM7KzKAQwSUHLk9JIWK/kkmi4r+vVJK7h+tjPllK5YA="
- IOS_APP_NAME="Mapbox GL"
- 'IOS_DEVELOPER_NAME="iPhone Distribution: Mapbox, Inc."'
- IOS_PROFILE_NAME="ios-in-house"
- secure: "nQqSM8rd7OHtV4MqmNqVnkrVHqxKqQsaWRYk4/nPdhbeVWtTtkk0df711LrF1TUtbEPEewHxYUvTZ/UXmwJNeoKdzTHavI8hnatRkgjyxGERPn1il1Otelht9I+LQQHf+plrpRjVWBrNIW0Zox1B3cqn6d3NglpbXrEQ2EjYGNA="
# end iOS code signing

before_install:
- if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then sudo service mysql stop; fi
Expand All @@ -65,10 +72,19 @@ install:
before_script:
# Set the core file limit to unlimited so a core file is generated upon crash
- ulimit -c unlimited -S
# begin iOS code signing
- openssl aes-256-cbc -k "$IOS_ENCRYPTION_SECRET" -in scripts/ios_travis/ios-in-house.mobileprovision.enc -d -a -out scripts/ios_travis/ios-in-house.mobileprovision
- openssl aes-256-cbc -k "$IOS_ENCRYPTION_SECRET" -in scripts/ios_travis/ios-dist.cer.enc -d -a -out scripts/ios_travis/ios-dist.cer
- openssl aes-256-cbc -k "$IOS_ENCRYPTION_SECRET" -in scripts/ios_travis/ios-dist.p12.enc -d -a -out scripts/ios_travis/ios-dist.p12
- ./scripts/ios_travis/add-key.sh
# end iOS code signing

script:
- ./scripts/travis_script.sh

after_script:
- ./scripts/ios_travis/remove-key.sh

notifications:
hipchat:
rooms:
Expand Down
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ config/%.gypi: configure

#### Library builds ############################################################

.PRECOIUS: Makefile/mbgl
.PRECIOUS: Makefile/mbgl
Makefile/mbgl: config/$(HOST).gypi
deps/run_gyp mbgl.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make

Expand All @@ -36,6 +36,9 @@ standalone: Makefile/mbgl
install: Makefile/mbgl
LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) install

.PRECIOUS: Xcode/mbgl
Xcode/mbgl: config/$(HOST).gypi
deps/run_gyp mbgl.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f xcode

##### Test builds ##############################################################

Expand Down Expand Up @@ -101,15 +104,18 @@ xproj: xosx-proj
#### iOS application builds ####################################################

.PRECIOUS: Xcode/ios
Xcode/ios: ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp config/ios.gypi
deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp $(CONFIG_ios) $(LIBS_ios) --generator-output=./build/ios -f xcode
Xcode/ios: ios/app/mapboxgl-app.gyp config/ios.gypi
deps/run_gyp ios/app/mapboxgl-app.gyp $(CONFIG_ios) $(LIBS_ios) --generator-output=./build/ios -f xcode

.PHONY: ios-proj ios run-ios
ios-proj: Xcode/ios
open ./build/ios/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj
open ./build/ios/ios/app/mapboxgl-app.xcodeproj

ios: Xcode/ios
xcodebuild -sdk iphonesimulator ARCHS=x86_64 -project ./build/ios/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj -configuration $(BUILDTYPE) -target iosapp -jobs `sysctl -n hw.ncpu`
xcodebuild -sdk iphoneos ARCHS="arm64 armv7 armv7s" PROVISIONING_PROFILE="2b532944-bf3d-4bf4-aa6c-a81676984ae8" -project ./build/ios/ios/app/mapboxgl-app.xcodeproj -configuration Release -target iosapp -jobs `sysctl -n hw.ncpu`

isim: Xcode/ios
xcodebuild -sdk iphonesimulator ARCHS="x86_64 i386" -project ./build/ios/ios/app/mapboxgl-app.xcodeproj -configuration Debug -target iosapp -jobs `sysctl -n hw.ncpu`

# Legacy name
iproj: ios-proj
Expand Down Expand Up @@ -197,8 +203,7 @@ clean: clear_sqlite_cache clear_xcode_cache
-rm -rf ./build/
-rm -rf ./macosx/build
-rm -rf ./linux/build
-rm -rf ./ios/mapbox-gl-cocoa/build
-rm -rf ./ios/mapbox-gl-cocoa/app/build
-rm -rf ./ios/build
-rm -rf ./test/build
-rm -rf ./config/*.gypi
-rm -rf ./android/java/build ./android/java/app/build ./android/java/lib/build
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ Target OS: 10.9+

## iOS

iOS makes use of a Cocoa-specific API called [`mapbox-gl-cocoa`](https://github.com/mapbox/mapbox-gl-cocoa). If you are just interested in running Mapbox GL on iOS and not developing with it, head to that project and you can use this library as a pre-built static library instead. A `UIView` interface to the map view and bundle resources are provided there.
If you just want to install the library for iOS and try it out as an Objective-C consumer, run `./scripts/package_ios.sh`. It will require the Boost headers to be installed, so use [Homebrew](http://brew.sh/) to install it via `brew install boost`. The script will produce the statically-linked `libMapboxGL.a`, `MapboxGL.bundle` for resources, and a `Headers` folder.

If you intend to develop here, `mapbox-gl-cocoa` is included as a submodule of the overall build setup.
If you want to build from source and/or contribute to development of the project, you can run `make iproj`, which will create and open an Xcode project which can build the entire library from source as well as an Objective-C test app.

You can run `make iproj` to create and open an Xcode project with an iOS-specific view controller housing. This will automatically install required dependencies as well.
Target devices: iPhone 4S and above (5, 5c, 5s, 6, 6 Plus) and iPad 2 and above (3, 4, Mini, Air, Mini 2, Air 2).

Note that if you are doing OS X development as well, to toggle from OS X back to iOS, you will need to `make iproj` again.
iOS SDK: 8.1
Supported iOS: 7.0+

Target devices: iPhone 4S and above (5, 5c, 5s, 6, 6 Plus) and iPad 2 and above (3, 4, Mini , Air, Mini 2, Air 2).

Target OS: 7.0+

## Linux

Expand Down
82 changes: 39 additions & 43 deletions gyp/install.gypi
Original file line number Diff line number Diff line change
@@ -1,50 +1,46 @@
{
'conditions': [
['install_prefix != ""', {
'targets': [
{ 'target_name': 'install',
'type': 'none',
'hard_dependency': 1,
'dependencies': [
'core',
'platform-<(platform_lib)',
'http-<(http_lib)',
'asset-<(asset_lib)',
'cache-<(cache_lib)',
'headless-<(headless_lib)',
'standalone',
],
'targets': [
{ 'target_name': 'install2',
'type': 'none',
'hard_dependency': 1,
'dependencies': [
'core',
'platform-<(platform_lib)',
'http-<(http_lib)',
'asset-<(asset_lib)',
'cache-<(cache_lib)',
'headless-<(headless_lib)',
'standalone',
],

'copies': [
{ 'files': [ '<(PRODUCT_DIR)/libmbgl.a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp' ], 'destination': '<(install_prefix)/include/mbgl/util' },
],
'copies': [
{ 'files': [ '<(PRODUCT_DIR)/libmbgl.a' ], 'destination': '<(install_prefix)/lib' },
{ 'files': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp' ], 'destination': '<(install_prefix)/include/mbgl/util' },
],

'actions': [
{
'action_name': 'Copy header files',
'inputs': [ '../include/mbgl/mbgl.hpp' ],
'outputs': [ '../include/mbgl/mbgl.hpp' ],
'action': [ 'cp', '-r', 'include', '<(install_prefix)/' ]
},
'actions': [
{
'action_name': 'Copy header files',
'inputs': [ '../include/mbgl/mbgl.hpp' ],
'outputs': [ '<(install_prefix)/include/mbgl/mbgl.hpp' ],
'action': [ 'cp', '-r', 'include', '<(install_prefix)/' ]
},

{ 'action_name': 'mbgl-config',
'inputs': [
'../utils/mbgl-config/mbgl-config.template.sh',
'../utils/mbgl-config/build.sh',
],
'outputs': [
'<(install_prefix)/bin/mbgl-config',
],
'action': [
'./utils/mbgl-config/build.sh',
'<(install_prefix)',
'<(PRODUCT_DIR)/libmbgl.a.ldflags',
]
}
{ 'action_name': 'mbgl-config',
'inputs': [
'../utils/mbgl-config/mbgl-config.template.sh',
'../utils/mbgl-config/build.sh',
],
'outputs': [
'<(install_prefix)/bin/mbgl-config',
],
'action': [
'./utils/mbgl-config/build.sh',
'<(install_prefix)',
'<(PRODUCT_DIR)/libmbgl.a.ldflags',
]
},
],
}],
}
]
},
],
}
23 changes: 23 additions & 0 deletions gyp/platform-ios.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
'../platform/darwin/application_root.mm',
'../platform/darwin/asset_root.mm',
'../platform/darwin/image.mm',
'../platform/darwin/reachability.m',
'../include/mbgl/ios/MGLMapView.h',
'../platform/ios/MGLMapView.mm',
'../include/mbgl/ios/MGLStyleFunctionValue.h',
'../platform/ios/MGLStyleFunctionValue.m',
'../include/mbgl/ios/MGLTypes.h',
'../platform/ios/MGLTypes.m',
'../include/mbgl/ios/NSArray+MGLAdditions.h',
'../platform/ios/NSArray+MGLAdditions.m',
'../include/mbgl/ios/NSDictionary+MGLAdditions.h',
'../platform/ios/NSDictionary+MGLAdditions.m',
'../include/mbgl/ios/UIColor+MGLAdditions.h',
'../platform/ios/UIColor+MGLAdditions.m',
],

'variables': {
Expand All @@ -26,8 +39,14 @@
'<@(uv_static_libs)',
],
'ldflags': [
'-framework CoreGraphics',
'-framework CoreLocation',
'-framework ImageIO',
'-framework GLKit',
'-framework MobileCoreServices',
'-framework OpenGLES',
'-framework SystemConfiguration',
'-framework UIKit',
],
},

Expand All @@ -37,6 +56,7 @@

'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'CLANG_ENABLE_OBJC_ARC': 'YES',
},

'link_settings': {
Expand All @@ -50,6 +70,9 @@
'include_dirs': [
'../include',
],
'mac_bundle_resources': [
'<!@(find ./platform/ios/resources -type f)',
],
},
},
],
Expand Down
1 change: 1 addition & 0 deletions gyp/platform-osx.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [ '<@(cflags_cc)' ],
'CLANG_ENABLE_OBJC_ARC': 'YES',
},

'link_settings': {
Expand Down
Loading

0 comments on commit d4d4cd4

Please sign in to comment.