Making a fat static library for iOS device and simulator
That's a pain since you either change them manually or set the linking flags on different Xcode targets to use the appropriate library (whereas normally with libraries and frameworks you just drag it into your project and you're done).
Instead, you can build your own fat (multi-architecture) library from the provided archives and Xcode will link against the appropriate architecture segment (flagrantly ignoring Erik's dire predictions about testability and your personality ;)
We achieve this using the lipo tool, eg:
The latest Omniture libraries, available via the Omiture SiteCatalyst admin console, now contains armv6 and armv7 architectures. Oddly, that means that they provide two archives—one regular i386 archive (with no fat header) for the simulator and one fat archive for the device with armv6 and armv7 segments. Since the device archive headers now specify the archives already, we don't need to tell lipo anything other than the archive file name.
11:43 PM, 18 Nov 2010 by Mark Aufflick Permalink
Script gor generate for library
Fat library is a good solution, i use it since many month with a script inside my library project. In your project you just need add a simple "shell script target" (you can name it Universal Lib Build). And then in run script script of this target i use the following script (by replacing #variable# by the good) and then the fat library generation i automate:
# shell script goes here XCODEBUILD_PATH=/Developer/usr/bin XCODEBUILD=$XCODEBUILD_PATH/xcodebuild SDKROOTDIR=/Users/Shared/_BUILDS_/#LIBRARY_NAME#_SDK echo "Start Universal #TARGET_NAME# SDK Generation" echo "Step 1 : #TARGET_NAME# SDK Build Library for simulator and device architecture" $XCODEBUILD -target "#TARGET_NAME#" -sdk "iphonesimulator" -configuration "Release" clean build $XCODEBUILD -target "#TARGET_NAME#" -sdk "iphoneos" -configuration "Release" clean build echo "Step 2 : Remove older SDK Directory" rm -rf $SDKROOTDIR echo "Step 3 : Create new SDK Directory Version" mkdir $SDKROOTDIR mkdir $SDKROOTDIR/build_SDK mkdir $SDKROOTDIR/build_SDK/headers echo "Step 4 : Create new SDK binary Version" cp /Users/Shared/_BUILDS_/Release-iphoneos/#libraryName#.a $SDKROOTDIR/build_SDK mv $SDKROOTDIR/build_SDK/#libraryName#.a $SDKROOTDIR/build_SDK/#libraryName#_device.a cp /Users/Shared/_BUILDS_/Release-iphonesimulator/#libraryName#.a $SDKROOTDIR/build_SDK mv $SDKROOTDIR/build_SDK/#libraryName#.a $SDKROOTDIR/build_SDK/#libraryName#_simulator.a echo "Step 5 : Create combine lib files for various platforms into one" # combine lib files for various platforms into one lipo -create $SDKROOTDIR/build_SDK/#libraryName#_device.a $SDKROOTDIR/build_SDK/#libraryName#_simulator.a -output $SDKROOTDIR/build_SDK/#libraryName#_SDK.a echo "Step 6 : Copy headers Needed" PROJECT_HOME=`pwd` echo $PROJECT_HOME cp $PROJECT_HOME/Classes/*.h $SDKROOTDIR/build_SDK/headers cp $PROJECT_HOME/Classes/#otherDriectoryNeeded#/*.h $SDKROOTDIR/build_SDK/headers echo "Step 7 : Copy other file needed like bundle" cp -r $PROJECT_HOME/Classes/*.bundle $SDKROOTDIR/build_SDK/ echo "Step 8 : Create final SDK package" rm -rf $SDKROOTDIR/#LibraryName#_SDK mkdir $SDKROOTDIR/#LibraryName#_SDK cp -r $SDKROOTDIR/build_SDK/headers $SDKROOTDIR/#LibraryName#_SDK cp -r $SDKROOTDIR/build_SDK/*.bundle $SDKROOTDIR/#LibraryName#_SDK cp $SDKROOTDIR/build_SDK/#libraryName#_SDK.a $SDKROOTDIR/#LibraryName#_SDK echo "Finish Universal #TARGET_NAME# SDK Generation" exit 0YD
by Unregistered Visitor on 10/06/11
I used to develop applications for the iOS platform. The implementation of the development kit is the most tedious task you can ever come across in the case of iOS. I am an android developer now. The life is easy and you can find many helping hands. www.g4lifeentertainment.com
by Unregistered Visitor on 08/26/14