diff options
author | Timofey <t.danshin@corp.mail.ru> | 2016-11-25 18:59:57 +0300 |
---|---|---|
committer | Timofey <t.danshin@corp.mail.ru> | 2016-11-29 14:50:32 +0300 |
commit | 6a46e8f17f442470b907b55ce4b6e9835c8b07c5 (patch) | |
tree | 93cd76b145c96f1751cfef3d171924b736b2957f /tools/autobuild | |
parent | 23fa9903eb43495a60316f8329edf3a92f0b5f33 (diff) |
Added cmake to XCode.
Now we can compile and run the iOS app using cmake.
Diffstat (limited to 'tools/autobuild')
-rwxr-xr-x | tools/autobuild/ios_cmake.sh | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tools/autobuild/ios_cmake.sh b/tools/autobuild/ios_cmake.sh new file mode 100755 index 0000000000..c90f8eeae6 --- /dev/null +++ b/tools/autobuild/ios_cmake.sh @@ -0,0 +1,70 @@ +# Script takes configuration as a parameter +set -e -u -x + +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +if [[ $# < 1 ]]; then + echo "Usage: $0 <debug|release>" + exit 1 +fi +CONFIGURATION="$1" + +source "$MY_PATH/build.sh" +source "$MY_PATH/detect_xcode.sh" + +BuildCmake() { + ( + SHADOW_DIR="$1" + BUILD_TYPE="$2" + + mkdir -p "$SHADOW_DIR" + cd "$SHADOW_DIR" + pwd + echo "Launching cmake..." + CC=$CC CXX=$CXX cmake -r "$BUILD_TYPE" -DCMAKE_OSX_ARCHITECTURES=$ARCH -DNO_TESTS=TRUE -DPLATFORM=$PLATFORM "$(StripCygwinPrefix $MY_PATH)/../.." +# make clean > /dev/null || true + make -j $(GetCPUCores) VERBOSE=1 + ) +} + + +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 + +FINAL_PATH_COMPONENT="debug" +SHADOW_DIR="$MY_PATH/../../../omim-iphone-cmake" + +if [[ $CONFIGURATION == *release* || $CONFIGURATION == *production* ]]; then + BUILD_TYPE="Release" + FINAL_PATH_COMPONENT="release" +elif [[ $CONFIGURATION == *debug* || $CONFIGURATION == "simulator" ]]; then + BUILD_TYPE="Debug" + FINAL_PATH_COMPONENT="debug" +else + echo "Unrecognized configuration passed to the script: $CONFIGURATION" + exit 1 +fi + +SHADOW_DIR="${SHADOW_DIR}-${FINAL_PATH_COMPONENT}" + +# Build libs for each architecture in separate folders +for ARCH in $VALID_ARCHS; do + if [[ $# > 1 && "$2" == "clean" ]] ; then + echo "Cleaning $CONFIGURATION configuration..." + rm -rf "$SHADOW_DIR-$ARCH" + else + export BUILD_ARCHITECTURE="$ARCH" + + export CC=clang + export CXX=clang++ + export CMAKE_PREFIX_PATH=$QT_PATH + export PLATFORM=iphone-something + + BuildCmake "$SHADOW_DIR-$ARCH/out/$FINAL_PATH_COMPONENT" "$BUILD_TYPE" || ( echo "ERROR while building $CONFIGURATION config"; exit 1 ) + fi +done |