28 settembre 2007
Compilare applicazioni Universal Binaries con XCode
Alla fine ho scoperto che basta veramente poco per compilare un’applicazione Universal Binary (in grado cioè di girare sia su architetture PPC che Intel) attraverso XCdode. Bastano giusto un paio di clic, come illustra la procedura scovata nei meandri della documentazione ufficiale:
Xcode can create universal binaries, which are executable files that can contain code and data for more than one architecture. You can create a single binary file that runs on both PowerPC-based and Intel-based Macintosh computers. The Architectures (ARCHS) build setting lets you specify which architectures Xcode builds for. You can edit this build setting in the target inspector. In the Build pane, select the Architectures build setting and click Edit. Xcode displays a dialog that lets you choose which architectures to build for: PowerPC or Intel. Select the checkbox next to the architectures for which you want to build.
Xcode compiles for each architecture individually and creates a single file from these input files. For more information on building universal binaries, see Universal Binary Programming Guidelines, Second Edition.
A number of the build settings defined by Xcode have different per-architecture variants to support building for multiple architectures. The name of these build settings follows the form NAME_architecture, where architecture is ppc, ppc64, or i386. To access the values of these build settings during a build, use the appropriate build setting name or an expression in the form NAME_$(arch). For example, to use the Mac OS X 10.3 SDK for PowerPC code and the Mac OS X 10.4u SDK for Intel code, set separate values for the SDKROOT_ppc and SDKROOT_i386 build setting variants. To access the value of the SDKROOT build setting for the architecture being built, use the expression SDKROOT_$(arch). (Note that the expressions SDKROOT and SDKROOT_ppc evaluate to different values during a build.)
Note: You can also use the Architectures build setting to create PPC/PPC64 binaries, which contain object files for both 32-bit PowerPC and 64-bit PowerPC architectures. To create a binary file that targets both 32-bit PowerPC and 64-bit PowerPC architectures, add ppc and ppc64 to the Architectures build setting. To do so, double-click in the Value setting.
E questo, per la cronaca, uno screenshot preso dal mio Mac che dovrebbe rendere ulteriormente più chiaro il tutto (clic sull’immagine per ingrandire):
Sorvoliamo sul fatto che la mia simulazione, al momento, sembri non girare su computer diversi dal mio…
PS: a grande richiesta, ho aggiunto nella barra di sinistra del blog un aggregatore RSS per seguire in maniera più comoda le discussioni (o presunte tali), che avvengono qua dentro. Approfitto anche per ricordare che qualche mese fa, pur senza pubblicizzarlo, ho aggiunto nella stessa barra laterale il link per seguire questo blog dalla propria home page personalizzata di Google.



