From 0995930d90b7a6f8c53d4a45c1941d22179e23f6 Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Tue, 28 Apr 2015 16:45:25 -0400 Subject: [PATCH 1/2] fixes #1361: split iOS device & sim builds (sim-only for tests) --- Makefile | 5 ++++- README.md | 2 +- scripts/ios/package.sh | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index d1552d1a8..5bebd04ac 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,10 @@ isim: Xcode/ios ipackage: clean Xcode/ios ./scripts/ios/package.sh -itest: ipackage KIF +ipackage-sim: clean Xcode/ios + ./scripts/ios/package.sh sim + +itest: ipackage-sim KIF ./scripts/ios/test.sh # Legacy name diff --git a/README.md b/README.md index d2ded1be0..3f5b8f49d 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Target OS X: 10.9+ If you merely want to install the library for iOS and try it out as an Objective-C consumer: 0. Use [Homebrew](http://brew.sh/) to install Boost headers: `brew install boost`. -1. Run `./scripts/ios/package.sh`. The packaging script will produce the statically-linked `libMapboxGL.a`, `MapboxGL.bundle` for resources, and a `Headers` folder. +1. Run `make ipackage`. The packaging script will produce the statically-linked `libMapboxGL.a`, `MapboxGL.bundle` for resources, and a `Headers` folder. 2. Copy the contents of `build/ios/pkg/static` into your project. It should happen automatically, but ensure that: - `Headers` is in your *Header Search Paths* (`HEADER_SEARCH_PATHS`) build setting. - `MapboxGL.bundle` is in your target's *Copy Bundle Resources* build phase. diff --git a/scripts/ios/package.sh b/scripts/ios/package.sh index e71925f80..9dcdf0a50 100755 --- a/scripts/ios/package.sh +++ b/scripts/ios/package.sh @@ -35,15 +35,16 @@ export BUILDTYPE=${BUILDTYPE:-Release} export HOST=ios make Xcode/ios -step "Building iOS device targets..." -xcodebuild -sdk iphoneos${IOS_SDK_VERSION} \ - ARCHS="arm64 armv7 armv7s" \ - ONLY_ACTIVE_ARCH=NO \ - -project ./build/ios/mbgl.xcodeproj \ - -configuration ${BUILDTYPE} \ - -target everything \ - -jobs ${JOBS} | xcpretty -c - +if [[ ${#} -eq 0 ]]; then # no args + step "Building iOS device targets..." + xcodebuild -sdk iphoneos${IOS_SDK_VERSION} \ + ARCHS="arm64 armv7 armv7s" \ + ONLY_ACTIVE_ARCH=NO \ + -project ./build/ios/mbgl.xcodeproj \ + -configuration ${BUILDTYPE} \ + -target everything \ + -jobs ${JOBS} | xcpretty -c +fi step "Building iOS Simulator targets..." xcodebuild -sdk iphonesimulator${IOS_SDK_VERSION} \ From 72b7e96ea221faeb4246b057afd6ff47c779b13a Mon Sep 17 00:00:00 2001 From: "Justin R. Miller" Date: Wed, 29 Apr 2015 10:49:05 -0400 Subject: [PATCH 2/2] fix linking for device/sim decision --- scripts/ios/package.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/scripts/ios/package.sh b/scripts/ios/package.sh index 9dcdf0a50..4cd22d48e 100755 --- a/scripts/ios/package.sh +++ b/scripts/ios/package.sh @@ -11,6 +11,12 @@ OUTPUT=build/ios/pkg IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version` LIBUV_VERSION=0.10.28 +if [[ ${#} -eq 0 ]]; then + BUILD_FOR_DEVICE=true +else + BUILD_FOR_DEVICE=false +fi + function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; } function finish { >&2 echo -en "\033[0m"; } trap finish EXIT @@ -35,7 +41,7 @@ export BUILDTYPE=${BUILDTYPE:-Release} export HOST=ios make Xcode/ios -if [[ ${#} -eq 0 ]]; then # no args +if [[ "${BUILD_FOR_DEVICE}" == true ]]; then step "Building iOS device targets..." xcodebuild -sdk iphoneos${IOS_SDK_VERSION} \ ARCHS="arm64 armv7 armv7s" \ @@ -58,11 +64,18 @@ xcodebuild -sdk iphonesimulator${IOS_SDK_VERSION} \ step "Building static library..." LIBS=(core.a platform-ios.a asset-fs.a cache-sqlite.a http-nsurl.a) -libtool -static -no_warning_for_no_symbols \ - -o ${OUTPUT}/static/lib${NAME}.a \ - ${LIBS[@]/#/build/${BUILDTYPE}-iphoneos/libmbgl-} \ - ${LIBS[@]/#/build/${BUILDTYPE}-iphonesimulator/libmbgl-} \ - `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libuv.a` +if [[ "${BUILD_FOR_DEVICE}" == true ]]; then + libtool -static -no_warning_for_no_symbols \ + -o ${OUTPUT}/static/lib${NAME}.a \ + ${LIBS[@]/#/build/${BUILDTYPE}-iphoneos/libmbgl-} \ + ${LIBS[@]/#/build/${BUILDTYPE}-iphonesimulator/libmbgl-} \ + `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libuv.a` +else + libtool -static -no_warning_for_no_symbols \ + -o ${OUTPUT}/static/lib${NAME}.a \ + ${LIBS[@]/#/build/${BUILDTYPE}-iphonesimulator/libmbgl-} \ + `find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libuv.a` +fi echo "Created ${OUTPUT}/static/lib${NAME}.a"