X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Fllvm-build%2Fllvmbuild%2Fmain.py;h=5ffed0c385e0aca0aa4b6262cf15e9befc99e5f0;hb=875710a2fd6b3c4f814961582594bd5c1cdb493a;hp=eacefdf60bfc359756b57bc35def586b6e52e91e;hpb=b49fb7bcd5001567d2da06f6a6e1c7ba79649e1b;p=oota-llvm.git diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py index eacefdf60bf..5ffed0c385e 100644 --- a/utils/llvm-build/llvmbuild/main.py +++ b/utils/llvm-build/llvmbuild/main.py @@ -5,7 +5,7 @@ import sys import llvmbuild.componentinfo as componentinfo import llvmbuild.configutil as configutil -from llvmbuild.util import * +from llvmbuild.util import fatal, note ### @@ -573,6 +573,45 @@ set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % ( f.close() + def write_cmake_exports_fragment(self, output_path): + """ + write_cmake_exports_fragment(output_path) -> None + + Generate a CMake fragment which includes LLVMBuild library + dependencies expressed similarly to how CMake would write + them via install(EXPORT). + """ + + dependencies = list(self.get_fragment_dependencies()) + + # Write out the CMake exports fragment. + make_install_dir(os.path.dirname(output_path)) + f = open(output_path, 'w') + + f.write("""\ +# Explicit library dependency information. +# +# The following property assignments tell CMake about link +# dependencies of libraries imported from LLVM. +""") + for ci in self.ordered_component_infos: + # We only write the information for libraries currently. + if ci.type_name != 'Library': + continue + + # Skip disabled targets. + tg = ci.get_parent_target_group() + if tg and not tg.enabled: + continue + + f.write("""\ +set_property(TARGET %s PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES %s)\n""" % ( + 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): """ write_make_fragment(output_path) -> None @@ -680,7 +719,9 @@ def add_magic_target_components(parser, project, opts): enable_targets = available_targets.values() else: # We support both space separated and semi-colon separated lists. - if ' ' in opts.enable_targets: + if opts.enable_targets == '': + enable_target_names = [] + elif ' ' in opts.enable_targets: enable_target_names = opts.enable_targets.split() else: enable_target_names = opts.enable_targets.split(';') @@ -742,7 +783,7 @@ def add_magic_target_components(parser, project, opts): # If we have a native target with a JIT, use that for the engine. Otherwise, # use the interpreter. if native_target and native_target.enabled and native_target.has_jit: - engine_group.required_libraries.append('JIT') + engine_group.required_libraries.append('MCJIT') engine_group.required_libraries.append(native_group.name) else: engine_group.required_libraries.append('Interpreter') @@ -780,6 +821,10 @@ def main(): dest="write_cmake_fragment", metavar="PATH", help="Write the CMake project information to PATH", action="store", default=None) + group.add_option("", "--write-cmake-exports-fragment", + dest="write_cmake_exports_fragment", metavar="PATH", + help="Write the CMake exports information to PATH", + action="store", default=None) group.add_option("", "--write-make-fragment", dest="write_make_fragment", metavar="PATH", help="Write the Makefile project information to PATH", @@ -861,6 +906,8 @@ given by --build-root) at the same SUBPATH""", # Write out the cmake fragment, if requested. if opts.write_cmake_fragment: project_info.write_cmake_fragment(opts.write_cmake_fragment) + if opts.write_cmake_exports_fragment: + project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment) # Configure target definition files, if requested. if opts.configure_target_def_files: