[llvm] 303f140 - gn build: Support llvm_enable_zstd.
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 11:28:27 PDT 2024
Author: pcc
Date: 2024-06-04T11:28:24-07:00
New Revision: 303f1405949ca3ea800a6e326c0365e5fc7168a3
URL: https://github.com/llvm/llvm-project/commit/303f1405949ca3ea800a6e326c0365e5fc7168a3
DIFF: https://github.com/llvm/llvm-project/commit/303f1405949ca3ea800a6e326c0365e5fc7168a3.diff
LOG: gn build: Support llvm_enable_zstd.
Reviewers: aeubanks
Reviewed By: aeubanks
Pull Request: https://github.com/llvm/llvm-project/pull/88457
Added:
llvm/utils/gn/build/libs/zstd/BUILD.gn
llvm/utils/gn/build/libs/zstd/enable.gni
Modified:
llvm/utils/gn/build/toolchain/BUILD.gn
llvm/utils/gn/secondary/clang/test/BUILD.gn
llvm/utils/gn/secondary/lld/test/BUILD.gn
llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
llvm/utils/gn/secondary/llvm/test/BUILD.gn
Removed:
################################################################################
diff --git a/llvm/utils/gn/build/libs/zstd/BUILD.gn b/llvm/utils/gn/build/libs/zstd/BUILD.gn
new file mode 100644
index 0000000000000..a59fca5baacc8
--- /dev/null
+++ b/llvm/utils/gn/build/libs/zstd/BUILD.gn
@@ -0,0 +1,12 @@
+import("//llvm/utils/gn/build/libs/zstd/enable.gni")
+
+config("zstd_config") {
+ visibility = [ ":zstd" ]
+ libs = [ "zstd" ]
+}
+
+group("zstd") {
+ if (llvm_enable_zstd) {
+ public_configs = [ ":zstd_config" ]
+ }
+}
diff --git a/llvm/utils/gn/build/libs/zstd/enable.gni b/llvm/utils/gn/build/libs/zstd/enable.gni
new file mode 100644
index 0000000000000..f5e1bc1beca7f
--- /dev/null
+++ b/llvm/utils/gn/build/libs/zstd/enable.gni
@@ -0,0 +1,4 @@
+declare_args() {
+ # Whether to include code that links against zstd.
+ llvm_enable_zstd = false
+}
diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
index 8fd05e84a2db1..e4852549bba6c 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -187,6 +187,7 @@ template("stage2_unix_toolchain") {
forward_variables_from(invoker.toolchain_args, "*")
clang_base_path = root_build_dir
+ llvm_enable_zstd = false
}
deps = [
diff --git a/llvm/utils/gn/secondary/clang/test/BUILD.gn b/llvm/utils/gn/secondary/clang/test/BUILD.gn
index f0ff2516c9045..2575dbf3cd0dd 100644
--- a/llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -5,6 +5,7 @@ import("//llvm/lib/Target/targets.gni")
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/libs/pthread/enable.gni")
import("//llvm/utils/gn/build/libs/zlib/enable.gni")
+import("//llvm/utils/gn/build/libs/zstd/enable.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/utils/llvm-lit/lit_path_function.gni")
import("//llvm/version.gni")
@@ -64,7 +65,6 @@ write_lit_config("lit_site_cfg") {
"CMAKE_C_COMPILER=cc",
"ENABLE_BACKTRACES=1",
"ENABLE_SHARED=0",
- "LLVM_ENABLE_ZSTD=0",
"LLVM_EXTERNAL_LIT=",
"LLVM_HOST_TRIPLE=$llvm_current_triple",
"LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build.
@@ -94,6 +94,12 @@ write_lit_config("lit_site_cfg") {
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
}
+ if (llvm_enable_zstd) {
+ extra_values += [ "LLVM_ENABLE_ZSTD=1" ]
+ } else {
+ extra_values += [ "LLVM_ENABLE_ZSTD=0" ] # Must be 0.
+ }
+
if (host_cpu == "x64") {
extra_values += [ "HOST_ARCH=x86_64" ]
} else if (host_cpu == "arm64") {
diff --git a/llvm/utils/gn/secondary/lld/test/BUILD.gn b/llvm/utils/gn/secondary/lld/test/BUILD.gn
index 356d93bf052a6..a2313965a41fd 100644
--- a/llvm/utils/gn/secondary/lld/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/lld/test/BUILD.gn
@@ -2,6 +2,7 @@ import("//llvm/lib/DebugInfo/PDB/enable_dia.gni")
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/libs/xml/enable.gni")
import("//llvm/utils/gn/build/libs/zlib/enable.gni")
+import("//llvm/utils/gn/build/libs/zstd/enable.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/utils/llvm-lit/lit_path_function.gni")
import("lld_lit_site_cfg_files.gni")
@@ -51,7 +52,6 @@ write_lit_cfg("lit_site_cfg") {
"LLD_DEFAULT_LD_LLD_IS_MINGW=0",
"LLVM_BUILD_EXAMPLES=0",
- "LLVM_ENABLE_ZSTD=0",
"LLVM_BYE_LINK_INTO_TOOLS=0",
]
@@ -94,6 +94,12 @@ write_lit_cfg("lit_site_cfg") {
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
}
+ if (llvm_enable_zstd) {
+ extra_values += [ "LLVM_ENABLE_ZSTD=1" ]
+ } else {
+ extra_values += [ "LLVM_ENABLE_ZSTD=0" ] # Must be 0.
+ }
+
if (current_cpu == "x64" || current_cpu == "arm64" ||
current_cpu == "ppc64") {
extra_values += [ "CMAKE_SIZEOF_VOID_P=8" ]
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 d8266fee05014..1b0d4a10e4610 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn
@@ -13,6 +13,7 @@ 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")
import("//llvm/utils/gn/build/libs/zlib/enable.gni")
+import("//llvm/utils/gn/build/libs/zstd/enable.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/version.gni")
@@ -315,7 +316,6 @@ write_cmake_config("llvm-config") {
"LLVM_DEFAULT_TARGET_TRIPLE=$llvm_target_triple",
"LLVM_ENABLE_DUMP=",
"LLVM_ENABLE_HTTPLIB=",
- "LLVM_ENABLE_ZSTD=",
"LLVM_FORCE_USE_OLD_TOOLCHAIN=",
"LLVM_HAS_ATOMICS=1",
"LLVM_HAS_LOGF128=",
@@ -387,6 +387,12 @@ write_cmake_config("llvm-config") {
values += [ "LLVM_ENABLE_ZLIB=" ]
}
+ if (llvm_enable_zstd) {
+ values += [ "LLVM_ENABLE_ZSTD=1" ]
+ } else {
+ values += [ "LLVM_ENABLE_ZSTD=" ]
+ }
+
if (llvm_enable_libcurl) {
values += [ "LLVM_ENABLE_CURL=1" ]
} else {
diff --git a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
index 7728455499bf3..0d4725716191d 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn
@@ -7,6 +7,7 @@ static_library("Support") {
"//llvm/lib/Demangle",
"//llvm/utils/gn/build/libs/pthread",
"//llvm/utils/gn/build/libs/zlib",
+ "//llvm/utils/gn/build/libs/zstd",
]
# public_deps are used for depending on targets that generate headers
diff --git a/llvm/utils/gn/secondary/llvm/test/BUILD.gn b/llvm/utils/gn/secondary/llvm/test/BUILD.gn
index 60d6d7b8c3ce7..4206489f39368 100644
--- a/llvm/utils/gn/secondary/llvm/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/test/BUILD.gn
@@ -8,6 +8,7 @@ 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")
import("//llvm/utils/gn/build/libs/zlib/enable.gni")
+import("//llvm/utils/gn/build/libs/zstd/enable.gni")
import("//llvm/utils/gn/build/mac_sdk.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("//llvm/utils/llvm-lit/lit_path_function.gni")
@@ -62,7 +63,6 @@ write_lit_config("lit_site_cfg") {
"LLVM_APPEND_VC_REV=0",
"LLVM_ENABLE_FFI=0",
"LLVM_ENABLE_HTTPLIB=0",
- "LLVM_ENABLE_ZSTD=0",
"LLVM_FORCE_VC_REVISION=",
"LLVM_HAS_LOGF128=0",
"LLVM_HAVE_OPT_VIEWER_MODULES=0",
@@ -211,6 +211,12 @@ write_lit_config("lit_site_cfg") {
extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0.
}
+ if (llvm_enable_zstd) {
+ extra_values += [ "LLVM_ENABLE_ZSTD=1" ]
+ } else {
+ extra_values += [ "LLVM_ENABLE_ZSTD=0" ] # Must be 0.
+ }
+
if (llvm_enable_libcurl) {
extra_values += [ "LLVM_ENABLE_CURL=1" ]
} else {
More information about the llvm-commits
mailing list