[llvm] [llvm] Add CMake flag to compile out the telemetry framework (PR #124850)

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 14:15:41 PST 2025


https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/124850

Add a CMake flag (LLVM_BUILD_TELEMETRY) to disable building the telemetry framework. The flag being enabled does *not* mean that telemetry is being collected, it merely means we're building the generic telemetry framework. Hence the flag is enabled by default.

Motivated by this Discourse thread: https://discourse.llvm.org/t/how-to-disable-building-llvm-clang-telemetry/84305

>From ba9a66642e8050e0518318e3fdaf9f8d423b766c Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Tue, 28 Jan 2025 14:12:58 -0800
Subject: [PATCH] [llvm] Add CMake flag to compile out the telemetry framework

Add a CMake flag (LLVM_BUILD_TELEMETRY) to disable building the
telemetry framework. The flag being enabled does *not* mean that
telemetry is being collected, it merely means we're building the generic
telemetry framework. Hence the flag is enabled by default.

Motivated by this Discourse thread: https://discourse.llvm.org/t/how-to-disable-building-llvm-clang-telemetry/84305
---
 llvm/CMakeLists.txt           | 1 +
 llvm/lib/CMakeLists.txt       | 5 +++--
 llvm/unittests/CMakeLists.txt | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c9ff3696e22d69..d1b4c2700ce8ef 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -829,6 +829,7 @@ option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm API documentation." OF
 option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
 option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
 option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
+option (LLVM_BUILD_TELEMETRY "Build the telemtry library. This does not enable telemetry." ON)
 
 set(LLVM_INSTALL_DOXYGEN_HTML_DIR "${CMAKE_INSTALL_DOCDIR}/llvm/doxygen-html"
     CACHE STRING "Doxygen-generated HTML documentation install directory")
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index f6465612d30c0b..27dcad72a990c6 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -41,9 +41,10 @@ add_subdirectory(ProfileData)
 add_subdirectory(Passes)
 add_subdirectory(TargetParser)
 add_subdirectory(TextAPI)
-add_subdirectory(Telemetry)
+if (LLVM_BUILD_TELEMETRY)
+  add_subdirectory(Telemetry)
+endif()
 add_subdirectory(ToolDrivers)
-add_subdirectory(XRay)
 if (LLVM_INCLUDE_TESTS)
   add_subdirectory(Testing)
 endif()
diff --git a/llvm/unittests/CMakeLists.txt b/llvm/unittests/CMakeLists.txt
index 81abce51b8939f..12e229b1c34984 100644
--- a/llvm/unittests/CMakeLists.txt
+++ b/llvm/unittests/CMakeLists.txt
@@ -63,7 +63,9 @@ add_subdirectory(Support)
 add_subdirectory(TableGen)
 add_subdirectory(Target)
 add_subdirectory(TargetParser)
-add_subdirectory(Telemetry)
+if (LLVM_BUILD_TELEMETRY)
+  add_subdirectory(Telemetry)
+endif()
 add_subdirectory(Testing)
 add_subdirectory(TextAPI)
 add_subdirectory(Transforms)



More information about the llvm-commits mailing list