Skip to content

Commit 5caa121

Browse files
committed
[gn build] include revision information in lld --version output
1 parent bed7626 commit 5caa121

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

llvm/utils/gn/build/write_vcsrevision.gni

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare_args() {
1919
template("write_vcsrevision") {
2020
assert(defined(invoker.header), "must set 'header' in $target_name")
2121

22-
action("write_vcsrevision") {
22+
action(target_name) {
2323
script = "//llvm/utils/gn/build/write_vcsrevision.py"
2424
header = invoker.header
2525
if (defined(invoker.names)) {

llvm/utils/gn/secondary/clang/lib/Basic/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ config("write_vcsrevision_config") {
66
visibility = [ ":write_vcsrevision" ]
77
}
88

9-
write_vcsrevision("write_vcsrevision") {
9+
write_vcsrevision("write_vcsversion") {
1010
visibility = [ ":Basic" ]
1111
header = "$target_gen_dir/VCSVersion.inc"
1212
names = [
@@ -29,7 +29,7 @@ static_library("Basic") {
2929
"//clang/include/clang/Basic:version",
3030
]
3131
deps = [
32-
":write_vcsrevision",
32+
":write_vcsversion",
3333
"//clang/include/clang/Basic:AttrHasAttributeImpl",
3434
"//clang/include/clang/Basic:arm_fp16",
3535
"//clang/include/clang/Basic:arm_neon",

llvm/utils/gn/secondary/lld/Common/BUILD.gn

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
import("//llvm/utils/gn/build/write_vcsrevision.gni")
2+
3+
config("write_vcsrevision_config") {
4+
# To pick up the generated inc file.
5+
include_dirs = [ target_gen_dir ]
6+
visibility = [ ":write_vcsrevision" ]
7+
}
8+
9+
write_vcsrevision("write_vcsversion") {
10+
visibility = [ ":Common" ]
11+
header = "$target_gen_dir/VCSVersion.inc"
12+
names = [ "LLD" ]
13+
public_configs = [ ":write_vcsrevision_config" ]
14+
}
15+
116
static_library("Common") {
217
output_name = "lldCommon"
318
configs += [ "//llvm/utils/gn/build:lld_code" ]
@@ -6,6 +21,7 @@ static_library("Common") {
621
"//lld/include/lld/Common:version",
722
]
823
deps = [
24+
":write_vcsversion",
925
"//llvm/lib/CodeGen",
1026
"//llvm/lib/Demangle",
1127
"//llvm/lib/IR",
@@ -25,8 +41,7 @@ static_library("Common") {
2541
"TargetOptionsCommandFlags.cpp",
2642
"Threads.cpp",
2743
"Timer.cpp",
28-
29-
# FIXME: This should be in its own target that passes -DHAVE_VCS_VERSION_INC
3044
"Version.cpp",
3145
]
46+
defines = [ "HAVE_VCS_VERSION_INC" ] # For Version.cpp
3247
}

0 commit comments

Comments
 (0)