2 # This script set darwin specific flags (GNU GCC)
10 # SYS_VERSION build option
11 help_vars = Variables()
12 help_vars.Add('SYS_VERSION', 'MAC OS X version / IOS version', os.environ.get('SYS_VERSION'))
14 Help(help_vars.GenerateHelpText(env))
16 sys_version = env.get('SYS_VERSION')
18 if sys_version is None:
20 *********************************** Error *************************************
21 * MAC OSX/IOS version isn't set, please set it in command line as : *
22 * # scons TARGET_ARCH=<arch> TARGET_OS=<os> SYS_VERSION=<version> ... *
23 * To get the version, please see: *
24 * /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ *
25 * /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ *
26 * <arch> is 'armv7','armv7s','arm64','i386', 'x86_64'
27 * <os> is 'darwin','ios'
28 *******************************************************************************
32 target_arch = env.get('TARGET_ARCH')
33 target_os = env.get('TARGET_OS')
34 # Set release/debug flags
35 if env.get('RELEASE'):
36 env.AppendUnique(CCFLAGS = ['-Os'])
37 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
39 env.AppendUnique(CCFLAGS = ['-g'])
40 env.AppendUnique(LINKFLAGS = ['-g'])
42 if target_os == 'darwin':
43 sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX' + sys_version + '.sdk/'
45 if target_arch in ['i386', 'x86_64']:
46 sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator' + sys_version + '.sdk/'
48 sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS' + sys_version + '.sdk/'
51 env.AppendUnique(CCFLAGS = ['-arch', target_arch, '-isysroot', sys_root])
52 env.AppendUnique(LINKFLAGS = ['-arch', target_arch, '-isysroot', sys_root])
54 if target_os == 'darwin':
55 flag = '-mmacosx-version-min=' + sys_version
56 env.AppendUnique(CCFLAGS = [flag])
57 env.AppendUnique(LINKFLAGS = [flag])