diff options
author | Brian Jensen <Jensen.J.Brian@gmail.com> | 2013-11-11 20:13:14 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-05 15:41:32 (GMT) |
commit | 1d24a83365c2360c064563c15cb09ec8e5f6670a (patch) | |
tree | cdfb508a81090c1cb258ef1cf04a66a21a1ae59d | |
parent | 085f851bd8431a30bc84ee20bdb5c5aa51949f4e (diff) | |
download | Qt-1d24a83365c2360c064563c15cb09ec8e5f6670a.zip Qt-1d24a83365c2360c064563c15cb09ec8e5f6670a.tar.gz Qt-1d24a83365c2360c064563c15cb09ec8e5f6670a.tar.bz2 |
Enable building with clang / libc++ on OS X 10.9 Mavericks
A minimalistic change to enable building with clang / libc++ on OS X
10.9 Mavericks. The configure script now avoids overriding build
settings when using clang/libc++. Added a new build configuration with
settings specific to clang/libc++ on OS X.
Task-number: QTBUG-34652
Change-Id: Iaedaff7c06e9818a5f2ee0d6db93fbe3b2e65e28
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
-rwxr-xr-x | configure | 89 | ||||
-rw-r--r-- | mkspecs/unsupported/macx-clang-libc++/Info.plist.app | 22 | ||||
-rw-r--r-- | mkspecs/unsupported/macx-clang-libc++/Info.plist.lib | 18 | ||||
-rw-r--r-- | mkspecs/unsupported/macx-clang-libc++/qmake.conf | 27 | ||||
-rw-r--r-- | mkspecs/unsupported/macx-clang-libc++/qplatformdefs.h | 97 |
5 files changed, 218 insertions, 35 deletions
@@ -4998,7 +4998,16 @@ if true; then ###[ '!' -f "$outpath/bin/qmake" ]; done fi if [ "$BUILD_ON_MAC" = "yes" ]; then - echo "export MACOSX_DEPLOYMENT_TARGET = 10.5" >> "$mkfile" + case "$PLATFORM" in + *macx-clang-libc++) + # Avoid overriding the default configuration settings when building with clang/libc++ + ;; + *) + # For all other configurations require a minimum of 10.5 + echo "export MACOSX_DEPLOYMENT_TARGET = 10.5" >> "$mkfile" + ;; + esac + echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile" echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile" EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)" @@ -7181,14 +7190,17 @@ fi # set the global Mac deployment target. This is overridden on an arch-by-arch basis # in some cases, see code further down case "$PLATFORM,$CFG_MAC_COCOA" in - macx*,yes) - # Cocoa - QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5 - ;; - macx*,no) - # gcc, Carbon - QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4 - ;; +*macx-clang-libc++,yes) + # Avoid overriding the default configuration setting when building with clang/libc++ + ;; +macx*,yes) + # Cocoa + QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5 + ;; +macx*,no) + # gcc, Carbon + QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4 + ;; esac # disable Qt 3 support on VxWorks, Symbian and INTEGRITY @@ -7931,32 +7943,39 @@ fi # On Mac, set the minimum deployment target for the different architechtures # using the Xarch compiler option when supported (10.5 and up). On 10.4 the # deployment version is set to 10.4 globally using the QMAKE_MACOSX_DEPLOYMENT_TARGET -# env. variable. -if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] ; then - if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then - QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" - QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" - QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" - QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4" - fi - if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then - QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4" - QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4" - QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4" - QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4" - fi - if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then - QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5" - QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5" - QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5" - QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5" - fi - if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then - QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5" - QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5" - QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5" - QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5" - fi +# env. variable. +if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ]; then + case "$PLATFORM" in + *macx-clang-libc++) + # Avoid overriding the default settings when building clang/libc++. + ;; + *) + if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then + QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" + QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" + QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4" + QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4" + fi + if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then + QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4" + QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4" + QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4" + QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4" + fi + if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then + QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5" + QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5" + QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5" + QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5" + fi + if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then + QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5" + QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5" + QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5" + QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5" + fi + ;; + esac fi #------------------------------------------------------------------------------- diff --git a/mkspecs/unsupported/macx-clang-libc++/Info.plist.app b/mkspecs/unsupported/macx-clang-libc++/Info.plist.app new file mode 100644 index 0000000..187a8e0 --- /dev/null +++ b/mkspecs/unsupported/macx-clang-libc++/Info.plist.app @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>CFBundleIconFile</key> + <string>@ICON@</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@EXECUTABLE@</string> + <key>CFBundleIdentifier</key> + <string>com.yourcompany.@EXECUTABLE@</string> + <key>NOTE</key> + <string>This file was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/unsupported/macx-clang-libc++/Info.plist.lib b/mkspecs/unsupported/macx-clang-libc++/Info.plist.lib new file mode 100644 index 0000000..63f1a94 --- /dev/null +++ b/mkspecs/unsupported/macx-clang-libc++/Info.plist.lib @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>NOTE</key> + <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/unsupported/macx-clang-libc++/qmake.conf b/mkspecs/unsupported/macx-clang-libc++/qmake.conf new file mode 100644 index 0000000..d012bad3 --- /dev/null +++ b/mkspecs/unsupported/macx-clang-libc++/qmake.conf @@ -0,0 +1,27 @@ +# +# qmake configuration for Clang on OS X +# + +MAKEFILE_GENERATOR = UNIX +TARGET_PLATFORM = macx +TEMPLATE = app +CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +include(../../common/mac.conf) +include(../../common/gcc-base-macx.conf) +include(../../common/clang.conf) + +QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7 # Libc++ is available from 10.7 onwards + +QMAKE_CFLAGS += -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET +QMAKE_CXXFLAGS += -stdlib=libc++ -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET +QMAKE_LFLAGS += -stdlib=libc++ -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET + +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 + +load(qt_config) diff --git a/mkspecs/unsupported/macx-clang-libc++/qplatformdefs.h b/mkspecs/unsupported/macx-clang-libc++/qplatformdefs.h new file mode 100644 index 0000000..cadc2ae --- /dev/null +++ b/mkspecs/unsupported/macx-clang-libc++/qplatformdefs.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include <unistd.h> + + +// We are hot - unistd.h should have turned on the specific APIs we requested + + +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#define QT_NO_LIBRARY_UNLOAD + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/ipc.h> +#include <sys/time.h> +#include <sys/shm.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#include "../../common/posix/qplatformdefs.h" + +#undef QT_OPEN_LARGEFILE +#undef QT_SOCKLEN_T +#undef QT_SIGNAL_IGNORE + +#define QT_OPEN_LARGEFILE 0 + +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#define QT_SIGNAL_IGNORE (void (*)(int))1 + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + +#endif // QPLATFORMDEFS_H |