## # This script set darwin specific flags (GNU GCC) # ## import os import platform Import('env') # SYS_VERSION build option help_vars = Variables() help_vars.Add('SYS_VERSION', 'MAC OS X version / IOS version', os.environ.get('SYS_VERSION')) help_vars.Update(env) Help(help_vars.GenerateHelpText(env)) sys_version = env.get('SYS_VERSION') if sys_version is None: print ''' *********************************** Error ************************************* * MAC OSX/IOS version isn't set, please set it in command line as : * * # scons SYS_VERSION= ... * * To get the version, please see: * * /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ * * /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/ * ******************************************************************************* ''' Exit(1) target_arch = env.get('TARGET_ARCH') target_os = env.get('TARGET_OS') # Set release/debug flags if env.get('RELEASE'): env.AppendUnique(CCFLAGS = ['-Os']) env.AppendUnique(CPPDEFINES = ['NDEBUG']) else: env.AppendUnique(CCFLAGS = ['-g']) if target_os == 'darwin': sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX' + sys_version + '.sdk/' else: if target_arch in ['i386', 'x86_64']: sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator' + sys_version + '.sdk/' else: sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS' + sys_version + '.sdk/' # Set arch flags env.AppendUnique(CCFLAGS = ['-arch', target_arch, '-isysroot', sys_root]) env.AppendUnique(LINKFLAGS = ['-arch', target_arch, '-isysroot', sys_root]) if target_os == 'darwin': flag = '-mmacosx-version-min=' + sys_version env.AppendUnique(CCFLAGS = [flag]) env.AppendUnique(LINKFLAGS = [flag])