Chapter 14: Advanced Workspace and Build Management

So far, the build process has been treated as a “black box” that does its job after it’s initialized with a standard list of build settings. This is adequate for simpler apps, but for more complex projects, it can be useful to break apart the build process and customize it further. This is particularly true after you start trying to include external code from free and/or open-source libraries and frameworks in your projects.

Understanding the Build Process

In outline, the build process has four stages:

  1. Preprocessor
  2. Compiler
  3. Linker
  4. File copier and processor

The preprocessor makes working copies of the original source files, expanding #include directives to include the original headers, expanding macros (low-level reusable code snippets and definitions), and implementing conditional compilation. Conditional compilation uses directives such as #if and #ifdef to test compiler and system settings and select code according to their values.

Internally, the preprocessor is more complex than this simple description suggests, but a full introduction is outside the scope of this book. The key practical point is that you can use preprocessor directives to include and exclude code automatically according to various system, platform, and build settings.

The compiler converts the files generated by the preprocessor into machine code—a ...

Get Xcode 5 Developer Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.