Search code examples
xcodemacosuniversal

In Xcode, is it possible to reuse intermedian objects from i386 configuration where building with universal configuration?


My application should be built as both of x86 and universal(x86 & x86_64) versions. As a result, every source file, says file A, must be compiled three times:

  1. As i386, when building with the x86 configuration
  2. As i386, when building with universal configuration
  3. As x86, when building with universal configuration

Since A has already be compiled as i386 when building with x86 configuration, could the universal configuration reuses objects from x86 configuration?

I found the intermedian objects resided under simliar path: Objects-normal/{i386,x86_64}. So could I set the intermedian object path of both configurations into a same path? So that, the universal building could reuse objects from x86 build?

I have not tried it, and just want to known whether anyone has tried this before?


Solution

  • Just build the universal version and then if you really need an i386-only version as well you can add a post build step which uses lipo to generate the "thin" version of the executable.