Xcode configuration files
Ali Rantakari
HelsinkiOS / CocoaHeads • January 22, 2013
Slide 2
Slide 2 text
Build Settings GUI
Slide 3
Slide 3 text
[.xcconfig alloc]
Slide 4
Slide 4 text
GUI vs Text
GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)
Slide 5
Slide 5 text
Unique pros
Human readable names
Comments
Custom organization
Better at avoiding repetition
Discoverability
Slide 6
Slide 6 text
Comments
// I am disabling -Wunused-variable because goddamnit, I might
// need those variables later! Who knows, right!
//
WARNING_CFLAGS = -Wall -Wno-unused-variable
Slide 7
Slide 7 text
DRY to the max
*_Common
*_Debug *_Release
#include
#include
Slide 8
Slide 8 text
DRY to the max
LIBFOO_ROOT = $(SRCROOT)/MyApp/libfoo
HEADER_SEARCH_PATHS = "$(LIBFOO_ROOT)/include"
LIBRARY_SEARCH_PATHS = "$(LIBFOO_ROOT)/lib"
(Yes, you can do this with the GUI as well, but this is nicer, no?)
Slide 9
Slide 9 text
Inheritance
WARNING_CFLAGS = -Wall
Common.xcconfig
#include "Common.xcconfig"
WARNING_CFLAGS = $(inherited) -Wno-unused-variables
Other.xcconfig
(!!) does not do what you may think it does
Slide 10
Slide 10 text
Inheritance
WARNING_CFLAGS = $(inherited)
App_Target_Debug.xcconfig
inheritance
project
config
target
config
Value of WARNING_CFLAGS in the project
config
Slide 11
Slide 11 text
If you must composite values…
MY_COMMON_WARNING_CFLAGS = -Wall
Common.xcconfig
#include "Common.xcconfig"
WARNING_CFLAGS = $(MY_COMMON_WARNING_CFLAGS) -Wno-unused-variables
Other.xcconfig
Set final composite value in “leaf” config
file
Use custom keys for intermediate values