[llvm] 437f9ec - [gn build] (manually) merge 24ab9b537e61b3 more
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 2 08:44:41 PST 2020
Author: Nico Weber
Date: 2020-01-02T11:44:34-05:00
New Revision: 437f9ec140b769c4603f2dbbe8fe03cefd6db28c
URL: https://github.com/llvm/llvm-project/commit/437f9ec140b769c4603f2dbbe8fe03cefd6db28c
DIFF: https://github.com/llvm/llvm-project/commit/437f9ec140b769c4603f2dbbe8fe03cefd6db28c.diff
LOG: [gn build] (manually) merge 24ab9b537e61b3 more
Added:
llvm/utils/gn/secondary/llvm/include/llvm/Support/write_extension_def.py
Modified:
llvm/utils/gn/secondary/llvm/include/llvm/Support/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
Removed:
################################################################################
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 f64ecebebcb0..6991ac729284 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 000000000000..768e57db6644
--- /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 2c0850add95c..b5d8e62b5d2b 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",
More information about the llvm-commits
mailing list