[llvm] Set up windows specific cmake defines for lldb bazel build and config for LZMA (PR #205823)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 25 07:20:49 PDT 2026
https://github.com/youngd007 created https://github.com/llvm/llvm-project/pull/205823
Adds an @platforms//os:windows branch to the ConfigHeader expand_template OS select(), alongside the
existing macos/linux branches. On Windows the POSIX-oriented features are disabled (HAVE_PTSNAME_R,
LLDB_ENABLE_POSIX, LLDB_ENABLE_TERMIOS → 0) and the platform-detection macros (HAVE_LIBCOMPRESSION,
HAVE_*_PROCESS_VM_READV, HAVE_PPOLL, HAVE_SYS_EVENT_H, LLDB_ENABLE_LIBXML2, LLDB_HAVE_EL_RFUNC_T) are
set to their Windows values. This complements the recently added Windows process plugin (#203146) so a
Windows-configured lldb gets a correct Config.h. Python stays disabled on Windows (base default
LLDB_ENABLE_PYTHON 0).
Continuing to work backwards from Meta's internally working buck2 build that is translated from this bazel. This lacked windows select entirely, so porting back what we ended up needing. There are still some changes needed on the build targets, but leave those to a follow up diff as I would hope build signals should be clean with this?
https://github.com/llvm/llvm-project/pull/201173 originally started full windows support and there were more changes to get it working on a remote build in
https://github.com/hermeticbuild/hermetic-llvm/pull/582/changes#diff-da3f010352329507a9e1e3f1dc911ae4ba69ba9747ce15e5eb76fbefe5f829b3.
If we look at 3rd_party/llvm-project/22.x/patches/lldb-windows-config-header.patch in the previous patch, it lines up with what we have here.
Meta does package LZMA support into our windows build, so switching to a config to control that.
>From efbd1e2d0a4ce52a2374e184dc578233fb89750b Mon Sep 17 00:00:00 2001
From: David Young <davidayoung at meta.com>
Date: Thu, 25 Jun 2026 07:12:43 -0700
Subject: [PATCH] Set up windows specific cmake defines for lldb bazel build
and config for LZMA
---
.../llvm-project-overlay/lldb/BUILD.bazel | 49 +++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
index 0245d01cfe32d..53c08bc037af7 100644
--- a/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/lldb/BUILD.bazel
@@ -70,6 +70,23 @@ selects.config_setting_group(
],
)
+bool_flag(
+ name = "enable_lzma",
+ build_setting_default = False,
+)
+
+config_setting(
+ name = "lzma_enabled_setting",
+ flag_values = {":enable_lzma": "true"},
+)
+
+selects.config_setting_group(
+ name = "lzma_enabled",
+ match_any = [
+ ":lzma_enabled_setting",
+ ],
+)
+
_VERSION_SUBSTITUTIONS = {
"@LLDB_VERSION@": PACKAGE_VERSION,
"@LLDB_VERSION_MAJOR@": LLVM_VERSION_MAJOR,
@@ -113,9 +130,6 @@ expand_template(
"#cmakedefine01 HAVE_PTSNAME_R": "#define HAVE_PTSNAME_R 1",
"#cmakedefine01 LLDB_ENABLE_TERMIOS": "#define LLDB_ENABLE_TERMIOS 1",
- # TODO: Add LZMA support by including the library in bazel
- "#cmakedefine01 LLDB_ENABLE_LZMA": "#define LLDB_ENABLE_LZMA 0",
-
# TODO: lua support
"#cmakedefine01 LLDB_ENABLE_LUA": "#define LLDB_ENABLE_LUA 0",
@@ -169,6 +183,23 @@ expand_template(
"#cmakedefine01 LLDB_ENABLE_LIBXML2": "#define LLDB_ENABLE_LIBXML2 0",
"#cmakedefine01 LLDB_HAVE_EL_RFUNC_T": "#define LLDB_HAVE_EL_RFUNC_T 1",
},
+ "@platforms//os:windows": {
+ # Self-contained dist: liblldb resolves a relative LLDB_PYTHON_HOME
+ # against its own dir when LLDB_EMBED_PYTHON_HOME=1. Inert until
+ # Python is enabled, but kept so the Windows config matches the MSDK build.
+ "#cmakedefine LLDB_PYTHON_HOME R\"(${LLDB_PYTHON_HOME})\"": "#define LLDB_PYTHON_HOME \"../python\"",
+ "#cmakedefine01 HAVE_LIBCOMPRESSION": "#define HAVE_LIBCOMPRESSION 0",
+ "#cmakedefine01 HAVE_NR_PROCESS_VM_READV": "#define HAVE_NR_PROCESS_VM_READV 0",
+ "#cmakedefine01 HAVE_PPOLL": "#define HAVE_PPOLL 0",
+ "#cmakedefine01 HAVE_PROCESS_VM_READV": "#define HAVE_PROCESS_VM_READV 0",
+ "#cmakedefine01 HAVE_PTSNAME_R": "#define HAVE_PTSNAME_R 0",
+ "#cmakedefine01 HAVE_SYS_EVENT_H": "#define HAVE_SYS_EVENT_H 0",
+ "#cmakedefine01 LLDB_EMBED_PYTHON_HOME": "#define LLDB_EMBED_PYTHON_HOME 1",
+ "#cmakedefine01 LLDB_ENABLE_LIBXML2": "#define LLDB_ENABLE_LIBXML2 0",
+ "#cmakedefine01 LLDB_ENABLE_POSIX": "#define LLDB_ENABLE_POSIX 0",
+ "#cmakedefine01 LLDB_ENABLE_TERMIOS": "#define LLDB_ENABLE_TERMIOS 0",
+ "#cmakedefine01 LLDB_HAVE_EL_RFUNC_T": "#define LLDB_HAVE_EL_RFUNC_T 0",
+ },
}) | select({
":curses_enabled": {
"#cmakedefine01 LLDB_ENABLE_CURSES": "#define LLDB_ENABLE_CURSES 1",
@@ -185,6 +216,13 @@ expand_template(
"#cmakedefine01 LLDB_EDITLINE_USE_WCHAR": "#define LLDB_EDITLINE_USE_WCHAR 0",
"#cmakedefine01 LLDB_ENABLE_LIBEDIT": "#define LLDB_ENABLE_LIBEDIT 0",
},
+ }) | select({
+ ":lzma_enabled": {
+ "#cmakedefine01 LLDB_ENABLE_LZMA": "#define LLDB_ENABLE_LZMA 1",
+ },
+ "//conditions:default": {
+ "#cmakedefine01 LLDB_ENABLE_LZMA": "#define LLDB_ENABLE_LZMA 0",
+ },
}),
template = "include/lldb/Host/Config.h.cmake",
)
@@ -623,6 +661,11 @@ cc_library(
"-lbsd",
],
"//conditions:default": [],
+ }) + select({
+ ":lzma_enabled": [
+ "-llzma",
+ ],
+ "//conditions:default": [],
}),
deps = [
":Headers",
More information about the llvm-commits
mailing list