#
# Common build settings for all iOS configurations
#
# Depends on:
#
#   QMAKE_IOS_XCODE_VERSION - set in mkspecs/common/ios/versions.conf
#   QMAKE_IOS_SDK_VERSION   - set in mkspecs/common/ios/versions.conf
#   QMAKE_IOSSIMULATOR_SDK_VERSION - set in mkspecs/common/ios/versions.conf
#

# iOS SDK device type
!*simulator*: QMAKE_IOS_DEVICE_TYPE = iPhoneOS
else {
    QMAKE_IOS_DEVICE_TYPE = iPhoneSimulator

    # Use simulator SDK version
    QMAKE_IOS_SDK_VERSION = $$QMAKE_IOS_SIMULATOR_SDK_VERSION
    QMAKE_IOS_SIMULATOR_SDK_VERSION =
}

!lessThan(QMAKE_IOS_XCODE_VERSION, "4.3") {
    # Xcode 4.3+ is stored in /Applications
    QMAKE_IOS_XCODE_PATH = /Applications/Xcode.app/Contents
} else: QMAKE_IOS_XCODE_PATH =

# iOS platform /Developer path
QMAKE_IOS_DEV_PATH      = $$QMAKE_IOS_XCODE_PATH/Developer/Platforms/$${QMAKE_IOS_DEVICE_TYPE}.platform/Developer
QMAKE_IOS_XCODE_PATH    =

# iOS platform SDK path
QMAKE_IOS_SDK           = $$QMAKE_IOS_DEV_PATH/SDKs/$${QMAKE_IOS_DEVICE_TYPE}$${QMAKE_IOS_SDK_VERSION}.sdk
QMAKE_IOS_DEV_PATH      =
QMAKE_IOS_DEVICE_TYPE   =

QMAKE_CFLAGS           += -isysroot $$QMAKE_IOS_SDK
QMAKE_CXXFLAGS         += -isysroot $$QMAKE_IOS_SDK
QMAKE_OBJECTIVE_CFLAGS += -isysroot $$QMAKE_IOS_SDK
QMAKE_LFLAGS           += -Wl,-syslibroot,$$QMAKE_IOS_SDK
QMAKE_IOS_SDK           =

# Basic iOS frameworks needed for any GUI app
QMAKE_LFLAGS           += -framework Foundation -framework UIKit -framework QuartzCore -lz

# OpenGL ES1
QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_IOS_SDK/System/Library/Frameworks/OpenGLES.framework/Headers
QMAKE_LIBDIR_OPENGL_ES1 =
QMAKE_LIBS_OPENGL_ES1   = -framework OpenGLES

# OpenGL ES2
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_IOS_SDK/System/Library/Frameworks/OpenGLES.framework/Headers
QMAKE_LIBDIR_OPENGL_ES2 =
QMAKE_LIBS_OPENGL_ES2   = -framework OpenGLES

# No desktop OpenGL
QMAKE_INCDIR_OPENGL     =
QMAKE_LIBS_OPENGL       =
QMAKE_LIBS_OPENGL_QT    =

# Compiler-specific flags
!*-g++* {
    # Objective-C/C++ precompile flags
    QMAKE_OBJCFLAGS_PRECOMPILE = -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
    QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
    QMAKE_OBJCXXFLAGS_PRECOMPILE = -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
    QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
}
