summaryrefslogtreecommitdiffstats
path: root/mkspecs/common/ios/versions.conf
blob: 488116a2a660175337bc2aaec445a807af026600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#
# Helper to set build tool & SDK versions for iOS configurations
#
# This file sets up the following configuration variables:
#
#   QMAKE_IOS_XCODE_VERSION          - version number of Xcode being used
#   QMAKE_IOS_SDK_VERSION            - version number of iOS SDK
#
# Used in:
#
#   mkspecs/common/ios/clang.conf
#   mkspecs/common/ios/qmake.conf
#   mkspecs/unsupported/macx-iosdevice-clang/qmake.conf
#

#
# IMPORTANT:
#
# Xcode versions >= 4.10 & < 5.0 and versions >= 10.0 are not supported due to
# the way the version checks are done here. As Apple (so far) has not used
# minor version numbers greater than 3 for Xcode, and the Xcode major version
# has only changed three times in the period 2003-2012, this is viewed as an
# acceptable limitation.
#

#
# Edit values below to match iOS build environment, or leave blank for
# autodetection (slower!)
#

# Xcode version used
QMAKE_IOS_XCODE_VERSION =

# iOS SDK version used
QMAKE_IOS_SDK_VERSION   =

#
# Do not edit values below here if using a pre-built SDK
#

# Minimum iOS version required on deployment target
QMAKE_IPHONEOS_DEPLOYMENT_TARGET = 4.3

###########################################################################

# Get path of Xcode's Developer directory
QMAKE_XCODE_DEVELOPER_PATH = $$system(xcode-select --print-path)

# Make sure Xcode path is valid
!exists($$QMAKE_XCODE_DEVELOPER_PATH): \
    error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}! Please use xcode-select to choose Xcode installation path")

# No Xcode version specified?
isEmpty(QMAKE_IOS_XCODE_VERSION) {
    # Get version string from installed Xcode
    QMAKE_IOS_XCODE_INFO = $$system($${QMAKE_XCODE_DEVELOPER_PATH}/usr/bin/xcodebuild -version)

    # Extract Xcode version number from output
    QMAKE_IOS_XCODE_VERSION = $$member(QMAKE_IOS_XCODE_INFO, 1)
    QMAKE_IOS_XCODE_INFO =
}

# Version check
lessThan(QMAKE_IOS_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")

QMAKE_XCODE_PLATFORM_PATH = $${QMAKE_XCODE_DEVELOPER_PATH}/Platforms

# iOS 4.3 is the preferred version as it is the earliest version that is armv7/gles2 only
QMAKE_IPHONEOS_PREFERRED_TARGET = 4.3

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

# Get lists of installed SDKs from Xcode
QMAKE_XCODE_SDKS = $$system($${QMAKE_XCODE_DEVELOPER_PATH}/usr/bin/xcodebuild -showsdks)

# No iOS SDK version specified?
isEmpty(QMAKE_IOS_SDK_VERSION) {
    # Get names of installed SDKs
    sdk_identifier = $$lower($$QMAKE_IOS_DEVICE_TYPE)
    sdks = $$find(QMAKE_XCODE_SDKS, ^$$sdk_identifier)
    for(v, sdks): {
        # Extract SDK version number from output
        v = $$replace(v,$$sdk_identifier,)

        # Use latest SDK version
        greaterThan(v, $$QMAKE_IOS_SDK_VERSION): QMAKE_IOS_SDK_VERSION = $$v
    }

    isEmpty(QMAKE_IOS_SDK_VERSION): error("Could not find a usable SDK, please install using Xcode")
}

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

# Make sure iOS SDK version is valid
!exists($$QMAKE_IOS_SDK_PATH): error("iOS $$QMAKE_IOS_SDK_VERSION SDK not found at $$QMAKE_IOS_SDK_PATH")

# No deployment target specified?
isEmpty(QMAKE_IPHONEOS_DEPLOYMENT_TARGET) {
    # Use SDK version for iOS versions < preferred
    lessThan(QMAKE_IOS_SDK_VERSION, $$QMAKE_IPHONEOS_PREFERRED_TARGET): \
        QMAKE_IPHONEOS_DEPLOYMENT_TARGET = $$QMAKE_IOS_SDK_VERSION
    else: \
        QMAKE_IPHONEOS_DEPLOYMENT_TARGET = $$QMAKE_IPHONEOS_PREFERRED_TARGET
}

# Make sure iOS SDK version is >= iOS target version
!lessThan(QMAKE_IPHONEOS_DEPLOYMENT_TARGET, $$QMAKE_IOS_SDK_VERSION) {
    error("Target iOS version is greater that iOS SDK version $$QMAKE_IOS_SDK_VERSION! Edit mkspecs/common/ios/versions.conf to specify target iOS version.")
}

unset(QMAKE_IPHONEOS_PREFERRED_TARGET)
unset(QMAKE_XCODE_PLATFORM_PATH)

# Set deployment target
QMAKE_IOS_VERSION_FLAGS = -miphoneos-version-min=$$QMAKE_IPHONEOS_DEPLOYMENT_TARGET

# Set build flags
QMAKE_CFLAGS           += $$QMAKE_IOS_VERSION_FLAGS
QMAKE_CXXFLAGS         += $$QMAKE_IOS_VERSION_FLAGS
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_IOS_VERSION_FLAGS
QMAKE_LFLAGS           += $$QMAKE_IOS_VERSION_FLAGS
QMAKE_IOS_VERSION_FLAGS =