2 # This script set darwin specific flags (GNU GCC)
11 target_arch = env.get('TARGET_ARCH')
12 target_os = env.get('TARGET_OS')
14 tc_path=commands.getoutput('xcode-select -p')
17 # SYS_VERSION build option
18 help_vars = Variables()
19 help_vars.Add('SYS_VERSION', 'MAC OS X version / IOS version', os.environ.get('SYS_VERSION'))
21 Help(help_vars.GenerateHelpText(env))
23 sys_version = env.get('SYS_VERSION')
25 if sys_version is None:
27 *********************************** Error *************************************
28 * MAC OSX/IOS version isn't set, please set it in command line as : *
29 * # scons TARGET_ARCH=<arch> TARGET_OS=<os> SYS_VERSION=<version> ... *
30 * To get the version, please see: *
31 * /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ *
32 * /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ *
33 * <arch> is 'armv7','armv7s','arm64','i386', 'x86_64'
34 * <os> is 'darwin','ios'
35 *******************************************************************************
39 # Set release/debug flags
40 if env.get('RELEASE'):
41 env.AppendUnique(CCFLAGS = ['-Os'])
42 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
44 env.AppendUnique(CCFLAGS = ['-g'])
45 env.AppendUnique(LINKFLAGS = ['-g'])
47 if target_os == 'darwin':
48 sys_root = tc_path + '/Platforms/MacOSX.platform/Developer/SDKs/MacOSX' + sys_version + '.sdk/'
50 if target_arch in ['i386', 'x86_64']:
51 sys_root = tc_path + '/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator' + sys_version + '.sdk/'
53 sys_root = tc_path + '/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS' + sys_version + '.sdk/'
56 env.AppendUnique(CCFLAGS = ['-arch', target_arch, '-isysroot', sys_root])
57 env.AppendUnique(LINKFLAGS = ['-arch', target_arch, '-isysroot', sys_root])
59 if target_os == 'darwin':
60 flag = '-mmacosx-version-min=' + sys_version
61 env.AppendUnique(CCFLAGS = [flag])
62 env.AppendUnique(LINKFLAGS = [flag])