mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
llvmbuild/CMake: Update CMake output fragment to include explicit library
dependency information. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145328 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7ca7b53804
commit
5086de6f87
@ -138,6 +138,23 @@ class LibraryComponentInfo(ComponentInfo):
|
||||
def get_library_name(self):
|
||||
return self.library_name or self.name
|
||||
|
||||
def get_prefixed_library_name(self):
|
||||
"""
|
||||
get_prefixed_library_name() -> str
|
||||
|
||||
Return the library name prefixed by the project name. This is generally
|
||||
what the library name will be on disk.
|
||||
"""
|
||||
|
||||
basename = self.get_library_name()
|
||||
|
||||
# FIXME: We need to get the prefix information from an explicit project
|
||||
# object, or something.
|
||||
if basename in ('gtest', 'gtest_main'):
|
||||
return basename
|
||||
|
||||
return 'LLVM%s' % basename
|
||||
|
||||
def get_llvmconfig_component_name(self):
|
||||
return self.get_library_name().lower()
|
||||
|
||||
|
@ -354,6 +354,37 @@ class LLVMProjectInfo(object):
|
||||
print >>f, '};'
|
||||
f.close()
|
||||
|
||||
def get_required_libraries_for_component(self, ci, traverse_groups = False):
|
||||
"""
|
||||
get_required_libraries_for_component(component_info) -> iter
|
||||
|
||||
Given a Library component info descriptor, return an iterator over all
|
||||
of the directly required libraries for linking with this component. If
|
||||
traverse_groups is True, then library and target groups will be
|
||||
traversed to include their required libraries.
|
||||
"""
|
||||
|
||||
assert ci.type_name in ('Library', 'LibraryGroup', 'TargetGroup')
|
||||
|
||||
for name in ci.required_libraries:
|
||||
# Get the dependency info.
|
||||
dep = self.component_info_map[name]
|
||||
|
||||
# If it is a library, yield it.
|
||||
if dep.type_name == 'Library':
|
||||
yield dep
|
||||
continue
|
||||
|
||||
# Otherwise if it is a group, yield or traverse depending on what
|
||||
# was requested.
|
||||
if dep.type_name in ('LibraryGroup', 'TargetGroup'):
|
||||
if not traverse_groups:
|
||||
yield dep
|
||||
continue
|
||||
|
||||
for res in self.get_required_libraries_for_component(dep, True):
|
||||
yield res
|
||||
|
||||
def get_fragment_dependencies(self):
|
||||
"""
|
||||
get_fragment_dependencies() -> iter
|
||||
@ -447,6 +478,24 @@ configure_file(\"%s\"
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DummyConfigureOutput)""" % (
|
||||
cmake_quote_path(dep),)
|
||||
|
||||
# Write the properties we use to encode the required library dependency
|
||||
# information in a form CMake can easily use directly.
|
||||
print >>f, """
|
||||
# Explicit library dependency information.
|
||||
#
|
||||
# The following property assignments effectively create a map from component
|
||||
# names to required libraries, in a way that is easily accessed from CMake."""
|
||||
for ci in self.ordered_component_infos:
|
||||
# We only write the information for libraries currently.
|
||||
if ci.type_name != 'Library':
|
||||
continue
|
||||
|
||||
print >>f, """\
|
||||
set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)""" % (
|
||||
ci.get_prefixed_library_name(), " ".join(sorted(
|
||||
dep.get_prefixed_library_name()
|
||||
for dep in self.get_required_libraries_for_component(ci))))
|
||||
|
||||
f.close()
|
||||
|
||||
def write_make_fragment(self, output_path):
|
||||
|
Loading…
Reference in New Issue
Block a user