diff options
author | Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> | 2015-10-02 13:54:33 +0200 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-10-09 15:15:17 +0000 |
commit | 9ff1310af51814e521572fa3de4e086907633a90 (patch) | |
tree | d3b1902b99174adee2f04e92bdc50613bba0c138 /mkspecs/common | |
parent | a3a7d485fa2d572225c7050badf28784316aec37 (diff) |
Distinguish between Objective-C and Objective-C++ sources
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'mkspecs/common')
-rw-r--r-- | mkspecs/common/clang-mac.conf | 1 | ||||
-rw-r--r-- | mkspecs/common/gcc-base-mac.conf | 8 | ||||
-rw-r--r-- | mkspecs/common/ios/clang.conf | 2 |
3 files changed, 1 insertions, 10 deletions
diff --git a/mkspecs/common/clang-mac.conf b/mkspecs/common/clang-mac.conf index d95e982b14..c616e20b6e 100644 --- a/mkspecs/common/clang-mac.conf +++ b/mkspecs/common/clang-mac.conf @@ -7,5 +7,4 @@ QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE QMAKE_XCODE_GCC_VERSION = com.apple.compilers.llvm.clang.1_0 QMAKE_CXXFLAGS += -stdlib=libc++ -QMAKE_OBJECTIVE_CFLAGS += -stdlib=libc++ QMAKE_LFLAGS += -stdlib=libc++ diff --git a/mkspecs/common/gcc-base-mac.conf b/mkspecs/common/gcc-base-mac.conf index 747f09ae81..e9bf780ec1 100644 --- a/mkspecs/common/gcc-base-mac.conf +++ b/mkspecs/common/gcc-base-mac.conf @@ -12,14 +12,6 @@ include(gcc-base.conf) QMAKE_COMPILER_DEFINES += __APPLE__ __GNUC__=4 __APPLE_CC__ -QMAKE_OBJECTIVE_CFLAGS = $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_OBJECTIVE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_OBJECTIVE_CFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO -QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS - QMAKE_LFLAGS += -headerpad_max_install_names QMAKE_LFLAGS_SHLIB += -single_module -dynamiclib diff --git a/mkspecs/common/ios/clang.conf b/mkspecs/common/ios/clang.conf index 36cb655229..f45b89665f 100644 --- a/mkspecs/common/ios/clang.conf +++ b/mkspecs/common/ios/clang.conf @@ -22,7 +22,7 @@ QMAKE_IOS_OBJ_CFLAGS += -Wno-deprecated-implementations -Wprotocol -Wno-select # Set build flags QMAKE_CFLAGS += $$QMAKE_IOS_CFLAGS QMAKE_CXXFLAGS += $$QMAKE_IOS_CFLAGS $$QMAKE_IOS_CXXFLAGS -QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_IOS_CFLAGS $$QMAKE_IOS_CXXFLAGS $$QMAKE_IOS_OBJ_CFLAGS +QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_IOS_OBJ_CFLAGS QMAKE_IOS_CFLAGS = QMAKE_IOS_CXXFLAGS = |