[libcxx-commits] [libcxx] [libc++] Update CMake dependency for generate_iwyu_mapping.py (PR #115387)
Alexander Richardson via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 7 14:47:15 PST 2024
https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/115387
This script does not depend on the generated headers since those are
already special-cased in header_information.py. Change the dependency
list to depend on header_information.py instead. While looking at this
code also simplify the assignment to libcxx_root inside this script.
>From 9493a1f7073f58d61bcf76da580e4e6ecc6c7f1b Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Thu, 7 Nov 2024 14:47:01 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6-beta.1
---
libcxx/include/CMakeLists.txt | 2 +-
libcxx/include/__cxx03/CMakeLists.txt | 2 +-
libcxx/utils/libcxx/header_information.py | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index ae2e8bcb32aaa4..ebd6eda9ba30f8 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1059,7 +1059,7 @@ endforeach()
# "include" for dependency tracking.
add_custom_command(OUTPUT "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp"
COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_iwyu_mapping.py" "-o" "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp"
- DEPENDS ${_all_includes}
+ DEPENDS "${LIBCXX_SOURCE_DIR}/utils/libcxx/header_information.py"
COMMENT "Generate the mapping file for include-what-you-use"
)
list(APPEND _all_includes "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp")
diff --git a/libcxx/include/__cxx03/CMakeLists.txt b/libcxx/include/__cxx03/CMakeLists.txt
index 32579272858a8e..b61442da89d4bf 100644
--- a/libcxx/include/__cxx03/CMakeLists.txt
+++ b/libcxx/include/__cxx03/CMakeLists.txt
@@ -1037,7 +1037,7 @@ endforeach()
# "include" for dependency tracking.
add_custom_command(OUTPUT "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp"
COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_iwyu_mapping.py" "-o" "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp"
- DEPENDS ${_all_includes}
+ DEPENDS "${LIBCXX_SOURCE_DIR}/utils/libcxx/header_information.py"
COMMENT "Generate the mapping file for include-what-you-use"
)
list(APPEND _all_includes "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp")
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index 7d88b73d0331bb..9a723b61524cd5 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -6,9 +6,9 @@
#
# ===----------------------------------------------------------------------===##
-import os, pathlib, functools
+import pathlib, functools
-libcxx_root = pathlib.Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+libcxx_root = pathlib.Path(__file__).resolve().parent.parent.parent
libcxx_include = libcxx_root / "include"
assert libcxx_root.exists()
More information about the libcxx-commits
mailing list