Refactor Xcode target generation to its own method.
@@ -42,6 +42,11 @@ XCODETYPEMAP = {'c': 'sourcecode.c.c',
's': 'sourcecode.asm',
'asm': 'sourcecode.asm',
}
+LANGNAMEMAP = {'c': 'C',
+ 'cpp': 'CPLUSPLUS',
+ 'objc': 'OBJC',
+ 'objcpp': 'OBJCPLUSPLUS',
+ }
class PbxItem:
def __init__(self, value, comment = ''):
@@ -727,7 +732,6 @@ class XCodeBackend(backends.Backend):
settings_dict.add_item('COMBINE_HIDPI_IMAGES', 'YES')
settings_dict.add_item('GCC_GENERATE_DEBUGGING_SYMBOLS', 'NO')
settings_dict.add_item('GCC_INLINES_ARE_PRIVATE_EXTERN', 'NO')
- settings_dict.add_item('GCC_OPTIMIZATION_LEVEL', 0)
settings_dict.add_item('GCC_PREPROCESSOR_DEFINITIONS', '""')
settings_dict.add_item('GCC_SYMBOLS_PRIVATE_EXTERN', 'NO')
settings_dict.add_item('INSTALL_PATH', '""')
@@ -756,7 +760,6 @@ class XCodeBackend(backends.Backend):
settings_dict.add_item('COMBINE_HIDPI_IMAGES', 'YES')
settings_dict.add_item('GCC_GENERATE_DEBUGGING_SYMBOLS', 'NO')
settings_dict.add_item('GCC_INLINES_ARE_PRIVATE_EXTERN', 'NO')
- settings_dict.add_item('GCC_OPTIMIZATION_LEVEL', 0)
settings_dict.add_item('GCC_PREPROCESSOR_DEFINITIONS', '""')
settings_dict.add_item('GCC_SYMBOLS_PRIVATE_EXTERN', 'NO')
settings_dict.add_item('INSTALL_PATH', '""')
@@ -775,8 +778,11 @@ class XCodeBackend(backends.Backend):
bt_dict.add_item('name', f'"{buildtype}"')
# Now finally targets.
- langnamemap = {'c': 'C', 'cpp': 'CPLUSPLUS', 'objc': 'OBJC', 'objcpp': 'OBJCPLUSPLUS'}
for target_name, target in self.build.get_build_targets().items():
+ self.generate_single_build_target(objects_dict, target_name, target)
+
+
+ def generate_single_build_target(self, objects_dict, target_name, target):
for buildtype in self.buildtypes:
dep_libs = []
links_dylib = False
@@ -818,7 +824,7 @@ class XCodeBackend(backends.Backend):
valid = self.buildconfmap[target_name][buildtype]
langargs = {}
for lang in self.environment.coredata.compilers[target.for_machine]:
- if lang not in langnamemap:
+ if lang not in LANGNAMEMAP:
continue
# Add compile args added using add_project_arguments()
pargs = self.build.projects_args[target.for_machine].get(target.subproject, {}).get(lang, [])
