diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-05-15 18:44:17 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-05-15 18:44:17 +0000 |
commit | b5cd41e26f89aad2f2dc4f5dc37577f7abf8528a (patch) | |
tree | 8a0f75441b6e5641d8c8856c18e09d90c0d40b8c /utils | |
parent | 177a119621f14a6ced87982ada75372815b636cf (diff) |
llvm-build: Add support for non-installed libraries (e.g., gtest).
- These libraries are only reported by llvm-config when run from a development
tree.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/llvm-build/llvmbuild/componentinfo.py | 12 | ||||
-rw-r--r-- | utils/llvm-build/llvmbuild/main.py | 20 | ||||
-rw-r--r-- | utils/unittest/LLVMBuild.txt | 2 |
3 files changed, 24 insertions, 10 deletions
diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py index c32cc1aeb0..e684ac2b7d 100644 --- a/utils/llvm-build/llvmbuild/componentinfo.py +++ b/utils/llvm-build/llvmbuild/componentinfo.py @@ -116,6 +116,7 @@ class LibraryComponentInfo(ComponentInfo): kwargs['required_libraries'] = items.get_list('required_libraries') kwargs['add_to_library_groups'] = items.get_list( 'add_to_library_groups') + kwargs['installed'] = items.get_optional_bool('installed', True) return kwargs @staticmethod @@ -124,7 +125,7 @@ class LibraryComponentInfo(ComponentInfo): return LibraryComponentInfo(subpath, **kwargs) def __init__(self, subpath, name, dependencies, parent, library_name, - required_libraries, add_to_library_groups): + required_libraries, add_to_library_groups, installed): ComponentInfo.__init__(self, subpath, name, dependencies, parent) # If given, the name to use for the library instead of deriving it from @@ -139,6 +140,9 @@ class LibraryComponentInfo(ComponentInfo): # considered part of. self.add_to_library_groups = list(add_to_library_groups) + # Whether or not this library is installed. + self.installed = installed + def get_component_references(self): for r in ComponentInfo.get_component_references(self): yield r @@ -160,6 +164,8 @@ class LibraryComponentInfo(ComponentInfo): if self.add_to_library_groups: print >>result, 'add_to_library_groups = %s' % ' '.join( self.add_to_library_groups) + if not self.installed: + print >>result, 'installed = 0' return result.getvalue() def get_library_name(self): @@ -194,10 +200,10 @@ class OptionalLibraryComponentInfo(LibraryComponentInfo): return OptionalLibraryComponentInfo(subpath, **kwargs) def __init__(self, subpath, name, dependencies, parent, library_name, - required_libraries, add_to_library_groups): + required_libraries, add_to_library_groups, installed): LibraryComponentInfo.__init__(self, subpath, name, dependencies, parent, library_name, required_libraries, - add_to_library_groups) + add_to_library_groups, installed) class LibraryGroupComponentInfo(ComponentInfo): type_name = 'LibraryGroup' diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py index 48b59bdac3..baecc6d899 100644 --- a/utils/llvm-build/llvmbuild/main.py +++ b/utils/llvm-build/llvmbuild/main.py @@ -341,8 +341,10 @@ subdirectories = %s # Get the library name, or None for LibraryGroups. if c.type_name == 'Library' or c.type_name == 'OptionalLibrary': library_name = c.get_prefixed_library_name() + is_installed = c.installed else: library_name = None + is_installed = True # Get the component names of all the required libraries. required_llvmconfig_component_names = [ @@ -355,7 +357,8 @@ subdirectories = %s # Add the entry. entries[c.name] = (llvmconfig_component_name, library_name, - required_llvmconfig_component_names) + required_llvmconfig_component_names, + is_installed) # Convert to a list of entries and sort by name. entries = entries.values() @@ -363,16 +366,16 @@ subdirectories = %s # Create an 'all' pseudo component. We keep the dependency list small by # only listing entries that have no other dependents. root_entries = set(e[0] for e in entries) - for _,_,deps in entries: + for _,_,deps,_ in entries: root_entries -= set(deps) - entries.append(('all', None, root_entries)) + entries.append(('all', None, root_entries, True)) entries.sort() # Compute the maximum number of required libraries, plus one so there is # always a sentinel. max_required_libraries = max(len(deps) - for _,_,deps in entries) + 1 + for _,_,deps,_ in entries) + 1 # Write out the library table. make_install_dir(os.path.dirname(output_path)) @@ -393,18 +396,21 @@ subdirectories = %s print >>f, ' /// The name of the library for this component (or NULL).' print >>f, ' const char *Library;' print >>f, '' + print >>f, ' /// Whether the component is installed.' + print >>f, ' bool IsInstalled;' + print >>f, '' print >>f, '\ /// The list of libraries required when linking this component.' print >>f, ' const char *RequiredLibraries[%d];' % ( max_required_libraries) print >>f, '} AvailableComponents[%d] = {' % len(entries) - for name,library_name,required_names in entries: + for name,library_name,required_names,is_installed in entries: if library_name is None: library_name_as_cstr = '0' else: library_name_as_cstr = '"lib%s.a"' % library_name - print >>f, ' { "%s", %s, { %s } },' % ( - name, library_name_as_cstr, + print >>f, ' { "%s", %s, %d, { %s } },' % ( + name, library_name_as_cstr, is_installed, ', '.join('"%s"' % dep for dep in required_names)) print >>f, '};' diff --git a/utils/unittest/LLVMBuild.txt b/utils/unittest/LLVMBuild.txt index 2810567f4a..c276dd6e72 100644 --- a/utils/unittest/LLVMBuild.txt +++ b/utils/unittest/LLVMBuild.txt @@ -20,9 +20,11 @@ type = Library name = gtest parent = Libraries required_libraries = Support +installed = 0 [component_1] type = Library name = gtest_main parent = Libraries required_libraries = gtest +installed = 0 |