diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-10-14 15:09:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-16 19:33:15 +0200 |
commit | 5c92a8b70a0349cc13a0758ef674cf817fc41381 (patch) | |
tree | e993d416165568fdf11a6b570d519759315e6d62 /mkspecs/features | |
parent | 15ddb91bc767b55297cbb35f293f5900379fee18 (diff) |
Xcode: Dynamically choose release/debug libs based on current configuration
Non-framework builds would automatically link to whatever Qt library
matched the config at the time of running qmake, eg hard-coded to
libQtCore_debug, while Xcode itself allowed the user to switch between
release and debug configurations.
We now append an Xcode settings variable to the library path, which gets
resolved at build time depending on the current config in Xcode.
Change-Id: I12873e38a28d9595ef3fd0ae0ad849e6744833a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r-- | mkspecs/features/mac/default_pre.prf | 6 | ||||
-rw-r--r-- | mkspecs/features/resolve_config.prf | 37 |
2 files changed, 36 insertions, 7 deletions
diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf index e535c4d9e9..c0596d5ef0 100644 --- a/mkspecs/features/mac/default_pre.prf +++ b/mkspecs/features/mac/default_pre.prf @@ -23,3 +23,9 @@ isEmpty(QMAKE_XCODE_VERSION) { isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.") unset(xcode_version) } + +# These two variables are used by the xcode_dynamic_library_suffix +# feature, which allows Xcode to choose the Qt libraries to link to +# at build time, depending on the current Xcode SDK and configuration. +QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix() +QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX diff --git a/mkspecs/features/resolve_config.prf b/mkspecs/features/resolve_config.prf index 41e82b2382..3884598a94 100644 --- a/mkspecs/features/resolve_config.prf +++ b/mkspecs/features/resolve_config.prf @@ -36,11 +36,34 @@ CONFIG(debug, debug|release): \ else: \ CONFIG -= debug -debug_and_release { - !macx-xcode: addExclusiveBuilds(debug, Debug, release, Release) -} else: fix_output_dirs { - debug: \ - fixExclusiveOutputDirs(debug, release) - else: \ - fixExclusiveOutputDirs(release, debug) +!macx-xcode { + debug_and_release { + addExclusiveBuilds(debug, Debug, release, Release) + } else: fix_output_dirs { + debug: \ + fixExclusiveOutputDirs(debug, release) + else: \ + fixExclusiveOutputDirs(release, debug) + } +} else { + # The Xcode generator always generates project files with + # debug and release configurations, regardless of whether + # or not debug_and_release is active. + for(build, $$list(debug release)) { + suffix = + contains(QT_CONFIG, debug_and_release) { + equals(build, debug): \ + suffix = _debug + } else { + contains(QT_CONFIG, debug): \ + suffix = _debug + } + + library_suffix_$${build}.name = $$QMAKE_XCODE_LIBRARY_SUFFIX_SETTING + library_suffix_$${build}.value = $$suffix + library_suffix_$${build}.build = $$build + QMAKE_MAC_XCODE_SETTINGS += library_suffix_$${build} + + CONFIG *= xcode_dynamic_library_suffix + } } |