+ def get_llvmbuild_fragment(self):
+ result = StringIO.StringIO()
+ print >>result, 'type = %s' % self.type_name
+ print >>result, 'name = %s' % self.name
+ print >>result, 'parent = %s' % self.parent
+ if self.required_libraries and not self._is_special_group:
+ print >>result, 'required_libraries = %s' % ' '.join(
+ self.required_libraries)
+ if self.add_to_library_groups:
+ print >>result, 'add_to_library_groups = %s' % ' '.join(
+ self.add_to_library_groups)
+ return result.getvalue()
+
+ def get_llvmconfig_component_name(self):
+ return self.name.lower()
+
+class TargetGroupComponentInfo(ComponentInfo):
+ type_name = 'TargetGroup'
+
+ @staticmethod
+ def parse(subpath, items):
+ kwargs = ComponentInfo.parse_items(items, has_dependencies = False)
+ kwargs['required_libraries'] = items.get_list('required_libraries')
+ kwargs['add_to_library_groups'] = items.get_list(
+ 'add_to_library_groups')
+ kwargs['has_jit'] = items.get_optional_bool('has_jit', False)
+ kwargs['has_asmprinter'] = items.get_optional_bool('has_asmprinter',
+ False)
+ kwargs['has_asmparser'] = items.get_optional_bool('has_asmparser',
+ False)
+ kwargs['has_disassembler'] = items.get_optional_bool('has_disassembler',
+ False)
+ return TargetGroupComponentInfo(subpath, **kwargs)
+
+ def __init__(self, subpath, name, parent, required_libraries = [],
+ add_to_library_groups = [], has_jit = False,
+ has_asmprinter = False, has_asmparser = False,
+ has_disassembler = False):
+ ComponentInfo.__init__(self, subpath, name, [], parent)
+
+ # The names of the library components which are required when linking
+ # with this component.
+ self.required_libraries = list(required_libraries)
+
+ # The names of the library group components this component should be
+ # considered part of.
+ self.add_to_library_groups = list(add_to_library_groups)
+
+ # Whether or not this target supports the JIT.
+ self.has_jit = bool(has_jit)
+
+ # Whether or not this target defines an assembly printer.
+ self.has_asmprinter = bool(has_asmprinter)
+
+ # Whether or not this target defines an assembly parser.
+ self.has_asmparser = bool(has_asmparser)
+
+ # Whether or not this target defines an disassembler.
+ self.has_disassembler = bool(has_disassembler)
+
+ # Whether or not this target is enabled. This is set in response to
+ # configuration parameters.
+ self.enabled = False
+
+ def get_component_references(self):
+ for r in ComponentInfo.get_component_references(self):
+ yield r
+ for r in self.required_libraries:
+ yield ('required library', r)
+ for r in self.add_to_library_groups:
+ yield ('library group', r)
+