iOS: Ensure that the rename-main logic works for multi-arch builds

We need to tell Xcode which architectures it should set up pre-link
dependencies for, as well as run the rename script in the root object
file directory. We pass it the current architectures so that we only
rename main() for simulator or device, not both.

Change-Id: I095d7c8a22ff0cb2ce872c9a86c93a070c1fcc65
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Tor Arne Vestbø 2014-11-06 16:14:32 +01:00 committed by Jani Heikkinen
parent 3e161dcb3d
commit eca0668a8c
3 changed files with 12 additions and 6 deletions

View File

@ -201,7 +201,7 @@ macx-xcode {
arch_iphonesimulator.value = $$QMAKE_IOS_SIMULATOR_ARCHS
QMAKE_MAC_XCODE_SETTINGS += arch_iphoneos arch_iphonesimulator
unset(QMAKE_XCODE_ARCHS)
QMAKE_XCODE_ARCHS = $$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS
} else {
# Be more specific about which architecture we're targeting
contains(QT_ARCH, arm.*): \

View File

@ -32,17 +32,19 @@ equals(TEMPLATE, app):contains(QT, gui(-private)?) {
# called 'qt_main' now.
macx-xcode {
objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}/${CURRENT_ARCH}"
objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}"
archs = "${ARCHS}"
} else {
objects_dir = $$OBJECTS_DIR
isEmpty(objects_dir): \
objects_dir = .
archs = "$$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS"
}
!isEmpty(QMAKE_PRE_LINK): \
QMAKE_PRE_LINK += ";"
QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir}
QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir} \"$${archs}\"
}
}

View File

@ -41,10 +41,14 @@
##
#############################################################################
if [ $# -eq 0 ]; then
echo "usage: $0 <path to object files>"
if [ $# -ne 2 ]; then
echo "$0: wrong number of arguments for internal tool used by iOS mkspec"
else
for f in $(find $1 -name '*.o'); do
arch_paths=""
for a in $2; do
arch_paths="$arch_paths $1/$a"
done
for f in $(find $arch_paths -name '*.o'); do
# Skip object files without the _main symbol
nm $f 2>/dev/null | grep -q 'T _main$' || continue