iOS: Replace device and simulator makespecs with single makespec

And use configure's -sdk argument to choose between the iphoneos and the
iphonesimulator SDK. xcodebuild -showsdks can be used to list the
available SDKs. Passing an SDK without a version postfix implies
the latest version of the SDK.

Change-Id: I881df754d522fc91aaa16ba3e39cf0c37a21a1f1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Tor Arne Vestbø 2012-11-20 15:25:34 +01:00
parent 67f925701b
commit c3278e3353
13 changed files with 89 additions and 227 deletions

View File

@ -12,6 +12,9 @@ CONFIG -= app_bundle
# Not deploying to Mac OSX
QMAKE_MACOSX_DEPLOYMENT_TARGET =
# But to iOS
QMAKE_IOS_DEPLOYMENT_TARGET = 4.3
# Add iOS common folder to include path
INCLUDEPATH += $$PWD/ios

View File

@ -1,13 +0,0 @@
#
# Helper to set CPU architecture flags for iOS configurations
#
###########################################################################
QMAKE_IOS_ARCH_FLAGS = -arch $$QMAKE_IOS_TARGET_ARCH
QMAKE_CFLAGS += $$QMAKE_IOS_ARCH_FLAGS
QMAKE_CXXFLAGS += $$QMAKE_IOS_ARCH_FLAGS
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_IOS_ARCH_FLAGS
QMAKE_LFLAGS += $$QMAKE_IOS_ARCH_FLAGS
unset(QMAKE_IOS_ARCH_FLAGS)

View File

@ -3,7 +3,7 @@
#
# Depends on:
#
# QMAKE_IOS_XCODE_VERSION - set in mkspecs/common/ios/versions.conf
# QMAKE_IOS_XCODE_VERSION - set in macx-ios-clang/qmake.conf
#
# iOS build flags
@ -12,6 +12,13 @@ QMAKE_IOS_CFLAGS += -Wno-trigraphs -Wreturn-type -Wparentheses -Wswitch -W
QMAKE_IOS_CXXFLAGS += -fvisibility-inlines-hidden
QMAKE_IOS_OBJ_CFLAGS += -Wno-arc-abi -Wc++0x-extensions
# Based on the following information, http://clang.llvm.org/doxygen/ObjCRuntime_8h_source.html,
# we can conclude that it's safe to always pass the following flags
QMAKE_IOS_OBJ_CFLAGS += -fobjc-nonfragile-abi -fobjc-legacy-dispatch
# But these only apply to non-ARM targets
!contains(QT_ARCH, arm): QMAKE_IOS_CFLAGS += -fexceptions -fasm-blocks
# Clang 3.1 (and above) flags
QMAKE_IOS_CFLAGS += -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wformat -Wno-missing-braces -Wno-unused-function -Wno-unused-label -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-sign-compare -Wpointer-sign -Wno-newline-eof -Wdeprecated-declarations -Winvalid-offsetof -Wno-conversion
QMAKE_IOS_CXXFLAGS += -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wc++11-extensions

View File

@ -3,11 +3,7 @@
#
# Depends on:
#
# QMAKE_XCODE_DEVELOPER_PATH - set in mkspecs/common/ios/versions.conf
# 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
#
# QMAKE_XCODE_DEVELOPER_PATH - set in mkspecs/common/xcode.conf
QMAKE_XCODE_TOOLCHAIN_BIN_PATH = $$QMAKE_XCODE_DEVELOPER_PATH/Toolchains/XcodeDefault.xctoolchain/usr/bin

View File

@ -1,120 +0,0 @@
#
# 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
}
# We have at least one version of this SDK, so we choose the latest one by
# passing the SDK identifier as QMAKE_MAC_SDK, as reccomended by Apple.
QMAKE_MAC_SDK = $$sdk_identifier
}
# 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 =

13
mkspecs/common/xcode.conf Normal file
View File

@ -0,0 +1,13 @@
#
# qmake configuration for Xcode
#
# Get path of Xcode's Developer directory
QMAKE_XCODE_DEVELOPER_PATH = $$system(xcode-select --print-path)
isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
error("Xcode path is not set. Please use xcode-select to choose Xcode installation 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.")

25
mkspecs/features/ios.prf Normal file
View File

@ -0,0 +1,25 @@
isEmpty(QT_ARCH) {
# The iPhoneOS and iPhoneSimulator targets share the same toolchain,
# so when configure runs the arch tests it passes the correct sysroot,
# but we fail to pick up the architecture since we're not passing -arch
# yet. Xcode does not seem to have a way to run the shared toolchain
# in a way that will automatically do this (for example xcrun -sdk).
contains(QMAKE_MAC_SDK, iphoneos.*): QT_ARCH = armv7
else: QT_ARCH = i386 # Simulator
} else {
# Fix up the QT_ARCH to be more specific
equals(QT_ARCH, arm) {
# Samsung S5PC100, Apple A4, A5, A5X
QT_ARCH = armv7
# FIXME: How do we support armv7s when Qt can't do universal builds?
}
}
!equals(MAKEFILE_GENERATOR, XCODE) {
arch_flag = -arch $$QT_ARCH
QMAKE_CFLAGS += $$arch_flag
QMAKE_CXXFLAGS += $$arch_flag
QMAKE_OBJECTIVE_CFLAGS += $$arch_flag
QMAKE_LFLAGS += $$arch_flag
}

View File

@ -36,7 +36,15 @@
}
!equals(MAKEFILE_GENERATOR, XCODE) {
version_min_flag = -m$${QMAKE_MAC_PLATFORM_NAME}-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET
# FIXME: Get the version_min_flag out of the platform's 'Native Build System.xcspec'
version_identifier = $$replace(QMAKE_MAC_PLATFORM_NAME, iphonesimulator, ios-simulator)
ios:!host_build: \
deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
else: \
deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
QMAKE_CFLAGS += $$version_min_flag
QMAKE_CXXFLAGS += $$version_min_flag
QMAKE_OBJECTIVE_CFLAGS += $$version_min_flag

View File

@ -0,0 +1,30 @@
#
# qmake configuration for macx-ios-clang
#
!load(device_config): error("Could not successfully load device configuration.")
isEmpty(QMAKE_MAC_SDK): QMAKE_MAC_SDK = iphoneos
# iOS is considered a variant of MacOS by Apple. We follow this to
# keep things simple, e.g. by defining Q_OS_MAC _and_ Q_OS_IOS.
include(../../common/mac.conf)
include(../../common/gcc-base-ios.conf)
include(../../common/xcode.conf)
include(../../common/clang.conf)
include(../../common/clang-mac.conf)
# Extract Xcode version using xcodebuild
version_info = $$system("$${QMAKE_XCODE_DEVELOPER_PATH}/usr/bin/xcodebuild -version")
QMAKE_IOS_XCODE_VERSION = $$member(version_info, 1)
unset(version_info)
# Version check
lessThan(QMAKE_IOS_XCODE_VERSION, "4.3"): error("This mkspec requires Xcode 4.3 or later")
include(../../common/ios.conf)
include(../../common/ios/clang.conf)
include(../../common/ios/qmake.conf)
load(qt_config)

View File

@ -1,22 +0,0 @@
#
# qmake configuration for ios-device-clang
#
QMAKE_IOS_DEVICE_TYPE = iPhoneOS
# Samsung S5PC100, Apple A4, A5, A5X
QMAKE_IOS_TARGET_ARCH = armv7
# FIXME: Add armv7s (A6) support when we need it
include(../../common/mac.conf)
include(../../common/gcc-base-ios.conf)
include(../../common/clang.conf)
include(../../common/clang-mac.conf)
include(../../common/ios.conf)
include(../../common/ios/versions.conf)
include(../../common/ios/clang.conf)
include(../../common/ios/qmake.conf)
include(../../common/ios/arch.conf)
load(qt_config)

View File

@ -1,23 +0,0 @@
#
# qmake configuration for ios-simulator-clang
#
QMAKE_IOS_DEVICE_TYPE = iPhoneSimulator
# Simulator is i386 only
QMAKE_IOS_TARGET_ARCH = i386
QMAKE_IOS_CFLAGS += -fexceptions -fasm-blocks
QMAKE_IOS_OBJ_CFLAGS += -fobjc-abi-version=2 -fobjc-legacy-dispatch
include(../../common/mac.conf)
include(../../common/gcc-base-ios.conf)
include(../../common/clang.conf)
include(../../common/clang-mac.conf)
include(../../common/ios.conf)
include(../../common/ios/versions.conf)
include(../../common/ios/clang.conf)
include(../../common/ios/qmake.conf)
include(../../common/ios/arch.conf)
load(qt_config)

View File

@ -1,42 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../common/ios/qplatformdefs.h"