2024年3月13日发(作者:)
20 echo "CONFIGURATION_TEMP_DIR = $CONFIGURATION_TEMP_DIR"
21 echo "TARGET_BUILD_DIR = $TARGET_BUILD_DIR"
22 echo "SDK_NAME = $SDK_NAME"
23 echo "PLATFORM_NAME = $PLATFORM_NAME"
24 echo "CONFIGURATION = $CONFIGURATION"
25 echo "TARGET_NAME = $TARGET_NAME"
26 echo "ARCH_TO_BUILD = $ARCH_TO_BUILD"
27 echo "ARCH_TO_BUILD = $ARCH_TO_BUILD"
28 echo "ACTION = $ACTION"
29 echo "SYMROOT = $SYMROOT"
30 echo "EXECUTABLE_NAME = $EXECUTABLE_NAME"
31 echo "CURRENTCONFIG_SIMULATOR_DIR = $CURRENTCONFIG_SIMULATOR_DIR"
32 echo "CURRENTCONFIG_DEVICE_DIR = $CURRENTCONFIG_DEVICE_DIR"
33
34 echo "#############Other###########"
35 echo "BUILD_DIR/CONFIGURATION/EFFECTIVE_PLATFORM_NAME = $BUILD_DIR/$CONFIGURATION$EFFECTIVE_PLATFORM_NAME"
36
37 echo "PROJECT_TEMP_DIR/CONFIGURATION/EFFECTIVE_PLATFORM_NAME = $PROJECT_TEMP_DIR/$CONFIGURATION$EFFECTIVE_PLATFORM_NAME"
38
39 fi
40
41#####################[ part 1 ]##################
42# First, work out the BASESDK version number
43# (incidental: searching for substrings in sh is a nightmare! Sob)
44
45 SDK_VERSION=$(echo ${SDK_NAME} | grep -o '.{3}$')
46
47# Next, work out if we're in SIM or DEVICE
48
49if [ ${PLATFORM_NAME} = "iphonesimulator" ]
50 then
51 OTHER_SDK_TO_BUILD=iphoneos${SDK_VERSION}
52 ARCH_TO_BUILD="armv6 armv7"
53else
54 OTHER_SDK_TO_BUILD=iphonesimulator${SDK_VERSION}
55 ARCH_TO_BUILD="i386"
56 fi
57
58 echo "XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION} (although back-targetting: ${IPHONEOS_DEPLOYMENT_TARGET})"
59 echo "...therefore, OTHER_SDK_TO_BUILD = ${OTHER_SDK_TO_BUILD}"
60#
61#####################[ end of part 1 ]##################
62
63#####################[ part 2 ]##################
64#
65# IF this is the original invocation, invoke whatever other builds are required
66#
67# Xcode is already building build ONLY the missing platforms/configurations.
68
69if [ "true" == ${ALREADYINVOKED:-false} ]
70 then
71 echo "RECURSION: Not the root invocation, don't recurse"
72else
73# Prevent recursion
74 export ALREADYINVOKED="true"
75
76 echo "RECURSION: I am recursing all missing "
77 echo "RECURSION: ...about to invoke: xcodebuild -configuration "${CONFIGURATION}" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" -arch
"${ARCH_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO"
78 xcodebuild -project "${TARGET_NAME}.xcodeproj" -configuration "${CONFIGURATION}" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" -arch "${ARCH_TO_BUILD}"${ACTION}
RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" > "${BUILD_ROOT}.build_output"
79 ACTION="build"
80
81# Merge all platform binaries as a fat binary for each configurations.
82
83# Calculate where the (multiple) built files are coming from:
84 CURRENTCONFIG_DEVICE_DIR=${SRCROOT}/../build/${CONFIGURATION}-iphoneos
85 CURRENTCONFIG_SIMULATOR_DIR=${SRCROOT}/../build/${CONFIGURATION}-iphonesimulator
86
87 echo "Taking device build from: ${CURRENTCONFIG_DEVICE_DIR}"
88 echo "Taking simulator build from: ${CURRENTCONFIG_SIMULATOR_DIR}"
89
90 CREATING_UNIVERSAL_DIR=${SRCROOT}/../build/${CONFIGURATION}-universal
91 echo "...outputing a universal arm6/arm7/i386 build to: ${CREATING_UNIVERSAL_DIR}"
92
93# ... remove the products of previous runs of this script
94# NB: this directory is only created by this script - it should be safe to delete
95
96 rm -rf "${CREATING_UNIVERSAL_DIR}"
97 mkdir "${CREATING_UNIVERSAL_DIR}"
98
99#
100 echo "lipo: for current configuration (${CONFIGURATION}) creating output file: ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}"
101 lipo -create -output
"${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}""${CURRENTCONFIG_DEVICE_DIR}/${EXECUTABLE_NAME}""${CURRENTCONFIG_SIMULATOR_DIR}/${EXECUTABLE_NAME}"
102
103#######custom########
104#copy universal lib to ../libs
105 libsDir=../libs
106 includeDir=../include
107
108 rm -rf "${libsDir}"
109 mkdir -p "${libsDir}"
110
111 echo "cp -R ${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME} ${libsDir}"
112
113 cp -R "${CREATING_UNIVERSAL_DIR}/${EXECUTABLE_NAME}""${libsDir}"
114
115 echo "cp -R ${CURRENTCONFIG_DEVICE_DIR}/include ${includeDir}"


发布评论