diff options
author | Nico Weber <thakis@chromium.org> | 2020-01-02 11:44:07 -0500 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2020-01-02 11:44:34 -0500 |
commit | 437f9ec140b769c4603f2dbbe8fe03cefd6db28c (patch) | |
tree | f387dda24040fccf82febc9d3f4c1051d0d21822 /llvm/utils | |
parent | 0d275431a3abc96fdee3e09afdc84e59df0e1d3b (diff) | |
download | bcm5719-llvm-437f9ec140b769c4603f2dbbe8fe03cefd6db28c.tar.gz bcm5719-llvm-437f9ec140b769c4603f2dbbe8fe03cefd6db28c.zip |
[gn build] (manually) merge 24ab9b537e61b3 more
Diffstat (limited to 'llvm/utils')
3 files changed, 43 insertions, 0 deletions
diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Support/BUILD.gn index f64ecebebcb..6991ac72928 100644 --- a/llvm/utils/gn/secondary/llvm/include/llvm/Support/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Support/BUILD.gn @@ -3,3 +3,21 @@ import("//llvm/utils/gn/build/write_vcsrevision.gni") write_vcsrevision("write_vcsrevision") { header = "$target_gen_dir/VCSRevision.h" } + +# Corresponds to process_llvm_pass_plugins() in the CMake build. +# For now, just turn everything off. +# If we ever add real support for this, the GN way for this is probably +# to have a declare_args() list with plugin names that people can override +# in their args.gn and with empty defaults (similar to llvm_targets_to_build). +action("write_extension_def") { + script = "//llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py" + outputs = [ + "$target_gen_dir/Extension.def", + ] + # If any extensions should be enabled, they'd be passed as additional + # arguments, e.g. `args += [ "Bye", "Polly" ]`. + args = [ + "-o", + rebase_path(outputs[0], root_build_dir), + ] +} diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py b/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py new file mode 100755 index 00000000000..768e57db664 --- /dev/null +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +from __future__ import print_function + +import argparse +import os +import sys + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('exts', nargs='*', help='list of supported extensions') + parser.add_argument('-o', '--output', required=True, help='output file') + args = parser.parse_args() + + output = ''.join(['HANDLE_EXTENSION(%s)\n' % ext for ext in args.exts]) + + if not os.path.exists(args.output) or open(args.output).read() != output: + open(args.output, 'w').write(output) + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn index 2c0850add95..b5d8e62b5d2 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn @@ -22,6 +22,9 @@ static_library("Support") { # public_dep because public header TargetSelect.h includes these .def files. "//llvm/include/llvm/Config:write_target_def_files", + + # public_dep because random targets assume its output exists. + "//llvm/include/llvm/Support:write_extension_def", ] include_dirs = [ "Unix", |