[llvm] aaca634 - gn build: Add support for building with libcurl.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 12:52:42 PDT 2022


Author: Peter Collingbourne
Date: 2022-03-14T12:52:19-07:00
New Revision: aaca634c94c6dc6a18e07b4e33530cc1c07faeeb

URL: https://github.com/llvm/llvm-project/commit/aaca634c94c6dc6a18e07b4e33530cc1c07faeeb
DIFF: https://github.com/llvm/llvm-project/commit/aaca634c94c6dc6a18e07b4e33530cc1c07faeeb.diff

LOG: gn build: Add support for building with libcurl.

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

Added: 
    llvm/utils/gn/build/libs/curl/BUILD.gn
    llvm/utils/gn/build/libs/curl/enable.gni

Modified: 
    llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
    llvm/utils/gn/secondary/llvm/lib/Debuginfod/BUILD.gn
    llvm/utils/gn/secondary/llvm/test/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/libs/curl/BUILD.gn b/llvm/utils/gn/build/libs/curl/BUILD.gn
new file mode 100644
index 0000000000000..ba7b50a7723ca
--- /dev/null
+++ b/llvm/utils/gn/build/libs/curl/BUILD.gn
@@ -0,0 +1,12 @@
+import("//llvm/utils/gn/build/libs/curl/enable.gni")
+
+config("curl_config") {
+  visibility = [ ":curl" ]
+  libs = [ "curl" ]
+}
+
+group("curl") {
+  if (llvm_enable_libcurl) {
+    public_configs = [ ":curl_config" ]
+  }
+}

diff  --git a/llvm/utils/gn/build/libs/curl/enable.gni b/llvm/utils/gn/build/libs/curl/enable.gni
new file mode 100644
index 0000000000000..90d662ac1e3e3
--- /dev/null
+++ b/llvm/utils/gn/build/libs/curl/enable.gni
@@ -0,0 +1,3 @@
+declare_args() {
+  llvm_enable_libcurl = false
+}

diff  --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
index 64f06a8086055..6cd6c4f2af9e7 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -5,6 +5,7 @@ import("//llvm/lib/Target/targets_with_disassemblers.gni")
 import("//llvm/lib/Target/targets_with_mcas.gni")
 import("//llvm/triples.gni")
 import("//llvm/utils/gn/build/buildflags.gni")
+import("//llvm/utils/gn/build/libs/curl/enable.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")
@@ -333,7 +334,6 @@ write_cmake_config("llvm-config") {
     "LLVM_BUILD_LLVM_DYLIB=",
     "LLVM_BUILD_SHARED_LIBS=",
     "LLVM_DEFAULT_TARGET_TRIPLE=$llvm_target_triple",
-    "LLVM_ENABLE_CURL=",
     "LLVM_ENABLE_DUMP=",
     "LLVM_ENABLE_NEW_PASS_MANAGER=1",
     "LLVM_FORCE_ENABLE_STATS=",
@@ -388,6 +388,12 @@ write_cmake_config("llvm-config") {
   } else {
     values += [ "LLVM_ENABLE_ZLIB=" ]
   }
+
+  if (llvm_enable_libcurl) {
+    values += [ "LLVM_ENABLE_CURL=1" ]
+  } else {
+    values += [ "LLVM_ENABLE_CURL=" ]
+  }
 }
 
 ##############################################################################

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Debuginfod/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Debuginfod/BUILD.gn
index 975dfbf47497a..923192b677557 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Debuginfod/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Debuginfod/BUILD.gn
@@ -1,6 +1,9 @@
 static_library("Debuginfod") {
   output_name = "LLVMDebuginfod"
-  deps = [ "//llvm/lib/Support" ]
+  deps = [
+    "//llvm/lib/Support",
+    "//llvm/utils/gn/build/libs/curl",
+  ]
   sources = [
     "DIFetcher.cpp",
     "Debuginfod.cpp",

diff  --git a/llvm/utils/gn/secondary/llvm/test/BUILD.gn b/llvm/utils/gn/secondary/llvm/test/BUILD.gn
index bcf8dcaa32fc3..d37f5616acdcf 100644
--- a/llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -2,6 +2,7 @@ import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
 import("//llvm/lib/Target/targets_string.gni")
 import("//llvm/triples.gni")
 import("//llvm/utils/gn/build/buildflags.gni")
+import("//llvm/utils/gn/build/libs/curl/enable.gni")
 import("//llvm/utils/gn/build/libs/pthread/enable.gni")
 import("//llvm/utils/gn/build/libs/xar/enable.gni")
 import("//llvm/utils/gn/build/libs/xml/enable.gni")
@@ -58,7 +59,6 @@ write_lit_config("lit_site_cfg") {
     # (That check also checks LLVM_HOST_TRIPLE.)
     "HOST_LDFLAGS=",
 
-    "LLVM_ENABLE_CURL=0",
     "LLVM_ENABLE_FFI=0",
     "LLVM_HAVE_OPT_VIEWER_MODULES=0",
     "LLVM_HOST_TRIPLE=$llvm_current_triple",
@@ -208,6 +208,12 @@ write_lit_config("lit_site_cfg") {
   } else {
     extra_values += [ "LLVM_ENABLE_ZLIB=0" ]  # Must be 0.
   }
+
+  if (llvm_enable_libcurl) {
+    extra_values += [ "LLVM_ENABLE_CURL=1" ]
+  } else {
+    extra_values += [ "LLVM_ENABLE_CURL=0" ]  # Must be 0.
+  }
 }
 
 write_lit_config("lit_unit_site_cfg") {


        


More information about the llvm-commits mailing list