diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/autobuild/build.sh | 3 | ||||
-rw-r--r-- | tools/autobuild/detect_xcode.sh | 35 | ||||
-rw-r--r-- | tools/autobuild/ios.sh | 46 |
3 files changed, 83 insertions, 1 deletions
diff --git a/tools/autobuild/build.sh b/tools/autobuild/build.sh index 442c1670b9..691d384474 100644 --- a/tools/autobuild/build.sh +++ b/tools/autobuild/build.sh @@ -1,6 +1,7 @@ set -e -x -LOCAL_DIRNAME="${PWD}/$(dirname "$0")" +LOCAL_DIRNAME="$(dirname "$0")" +#LOCAL_DIRNAME="${PWD}/$(dirname "$0")" source "$LOCAL_DIRNAME/detect_qmake.sh" diff --git a/tools/autobuild/detect_xcode.sh b/tools/autobuild/detect_xcode.sh new file mode 100644 index 0000000000..a57c9ac78b --- /dev/null +++ b/tools/autobuild/detect_xcode.sh @@ -0,0 +1,35 @@ +# Add your paths into these arrays +KNOWN_IOS_SDK_PATHS=( \ + /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \ + /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/ +) + +KNOWN_IOS_SDK_SIMULATOR_PATHS=( \ + /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk \ + /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk +) + + +# Prints path to directory with iOS SDK +# Pameter is configuration name: <debug|release|production|simulator> +# Returns 1 in case of not found and 0 in case of success +PrintIOSSDKPath() { + PATHS_ARRAY="${KNOWN_IOS_SDK_PATHS[@]}" + if [[ $1 == "simulator" ]]; then + for path in "${KNOWN_IOS_SDK_SIMULATOR_PATHS[@]}"; do + if [ -d "${path}" ]; then + echo "${path}" + return 0 + fi + done + else + for path in "${KNOWN_IOS_SDK_PATHS[@]}"; do + if [ -d "${path}" ]; then + echo "${path}" + return 0 + fi + done + fi + # Not found + return 1 +} diff --git a/tools/autobuild/ios.sh b/tools/autobuild/ios.sh new file mode 100644 index 0000000000..68eba54280 --- /dev/null +++ b/tools/autobuild/ios.sh @@ -0,0 +1,46 @@ +# Script takes configuration as a parameter and optional clean keyword. +# Possible configurations: debug release production + +set -e -u -x + +LOCAL_DIRNAME="$(dirname "$0")" +#LOCAL_DIRNAME="${PWD}/$(dirname "$0")" + +if [[ $# < 1 ]]; then + echo "Usage: $0 <debug|release|production|simulator> [clean]" + exit 1 +fi +CONFIGURATION="$1" + +source "$LOCAL_DIRNAME/build.sh" +source "$LOCAL_DIRNAME/detect_xcode.sh" + +SDK_ROOT="$(PrintIOSSDKPath "$CONFIGURATION")" +if [[ $? -ne 0 ]]; then + echo "Is XCode installed? Check tools/autobuild/detect_xcode.sh script" + exit 1 +fi +export SDK_ROOT + +MKSPEC="$LOCAL_DIRNAME/../mkspecs/iphonedevice-llvm" +QMAKE_PARAMS="CONFIG+=${CONFIGURATION}" +if [[ $CONFIGURATION == "production" ]] ; then + QMAKE_PARAMS="$QMAKE_PARAMS CONFIG+=release" +fi + +SHADOW_DIR_BASE="$LOCAL_DIRNAME/../../../omim-iphone" + +if [[ $CONFIGURATION == "simulator" ]]; then + SHADOW_DIR="${SHADOW_DIR_BASE}sim-debug" + MKSPEC="$LOCAL_DIRNAME/../mkspecs/iphonesimulator-clang" +else + SHADOW_DIR="${SHADOW_DIR_BASE}-${CONFIGURATION}" + MKSPEC="$LOCAL_DIRNAME/../mkspecs/iphonedevice-llvm" +fi + +if [[ $# > 1 && "$2" == "clean" ]] ; then + echo "Cleaning $CONFIGURATION configuration..." + rm -rf "$SHADOW_DIR" +else + BuildQt "$SHADOW_DIR" "$MKSPEC" "$QMAKE_PARAMS" || ( echo "ERROR while building $CONFIGURATION config"; exit 1 ) +fi |