[gn build] Add build files for llvm/lib/{LineEditor,Testing/Support,TextAPI}
authorNico Weber <nicolasweber@gmx.de>
Fri, 4 Jan 2019 17:11:46 +0000 (17:11 +0000)
committerNico Weber <nicolasweber@gmx.de>
Fri, 4 Jan 2019 17:11:46 +0000 (17:11 +0000)
Nothing pulls them in yet, but they will be needed for check-llvm.

LineEditor depends on libedit, so create a gn/build/lib for it, following the
usual pattern.

Differential Revision: https://reviews.llvm.org/D56316

llvm-svn: 350407

llvm/utils/gn/build/libs/edit/BUILD.gn [new file with mode: 0644]
llvm/utils/gn/build/libs/edit/enable.gni [new file with mode: 0644]
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/LineEditor/BUILD.gn [new file with mode: 0644]
llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn [new file with mode: 0644]
llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn [new file with mode: 0644]

diff --git a/llvm/utils/gn/build/libs/edit/BUILD.gn b/llvm/utils/gn/build/libs/edit/BUILD.gn
new file mode 100644 (file)
index 0000000..c22a7e6
--- /dev/null
@@ -0,0 +1,12 @@
+import("//llvm/utils/gn/build/libs/edit/enable.gni")
+
+config("edit_config") {
+  visibility = [ ":edit" ]
+  libs = [ "edit" ]
+}
+
+group("edit") {
+  if (llvm_enable_libedit) {
+    public_configs = [ ":edit_config" ]
+  }
+}
diff --git a/llvm/utils/gn/build/libs/edit/enable.gni b/llvm/utils/gn/build/libs/edit/enable.gni
new file mode 100644 (file)
index 0000000..b973b0e
--- /dev/null
@@ -0,0 +1,3 @@
+declare_args() {
+  llvm_enable_libedit = host_os == "mac"
+}
index 38ec86d..44ad0a0 100644 (file)
@@ -1,6 +1,7 @@
 import("//llvm/lib/Target/targets.gni")
 import("//llvm/triples.gni")
 import("//llvm/utils/gn/build/buildflags.gni")
+import("//llvm/utils/gn/build/libs/edit/enable.gni")
 import("//llvm/utils/gn/build/libs/pthread/enable.gni")
 import("//llvm/utils/gn/build/libs/terminfo/enable.gni")
 import("//llvm/utils/gn/build/libs/xar/enable.gni")
@@ -178,7 +179,6 @@ action("config") {
       "HAVE_CRASHREPORTER_INFO=1",
       "HAVE_DECL_ARC4RANDOM=1",
       "HAVE_DLADDR=1",
-      "HAVE_LIBEDIT=1",
       "HAVE_MALLOC_H=",
       "HAVE_MACH_MACH_H=1",
       "HAVE_MALLOC_MALLOC_H=1",
@@ -190,7 +190,6 @@ action("config") {
       "HAVE_CRASHREPORTER_INFO=",
       "HAVE_DECL_ARC4RANDOM=",
       "HAVE_DLADDR=",
-      "HAVE_LIBEDIT=",
       "HAVE_MACH_MACH_H=",
       "HAVE_MALLOC_H=1",
       "HAVE_MALLOC_MALLOC_H=",
@@ -292,6 +291,12 @@ action("config") {
     args += [ "LTDL_SHLIB_EXT=.dll" ]
   }
 
+  if (llvm_enable_libedit) {
+    args += [ "HAVE_LIBEDIT=1" ]
+  } else {
+    args += [ "HAVE_LIBEDIT=" ]
+  }
+
   if (llvm_enable_libxar) {
     args += [ "HAVE_LIBXAR=1" ]
   } else {
diff --git a/llvm/utils/gn/secondary/llvm/lib/LineEditor/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/LineEditor/BUILD.gn
new file mode 100644 (file)
index 0000000..b8f6185
--- /dev/null
@@ -0,0 +1,12 @@
+static_library("LineEditor") {
+  output_name = "LLVMLineEditor"
+  deps = [
+    "//llvm/include/llvm/Config:config",
+    "//llvm/lib/Support",
+    "//llvm/utils/gn/build/libs/edit",
+  ]
+
+  sources = [
+    "LineEditor.cpp",
+  ]
+}
diff --git a/llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Testing/Support/BUILD.gn
new file mode 100644 (file)
index 0000000..064d5ec
--- /dev/null
@@ -0,0 +1,12 @@
+static_library("Support") {
+  output_name = "LLVMTestingSupport"
+  deps = [
+    "//llvm/lib/Support",
+    "//llvm/utils/unittest:gtest",
+  ]
+  sources = [
+    "Error.cpp",
+    "SupportHelpers.cpp",
+  ]
+  testonly = true
+}
diff --git a/llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/TextAPI/BUILD.gn
new file mode 100644 (file)
index 0000000..0daf58b
--- /dev/null
@@ -0,0 +1,12 @@
+static_library("TextAPI") {
+  output_name = "LLVMTextAPI"
+  deps = [
+    "//llvm/lib/BinaryFormat",
+    "//llvm/lib/Support",
+  ]
+  include_dirs = [ "." ]
+  sources = [
+    "ELF/ELFStub.cpp",
+    "ELF/TBEHandler.cpp",
+  ]
+}