[libcxx-commits] [libcxx] 30feb35 - [libc++] Update CMake dependency for generate_iwyu_mapping.py (#115387)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 11 07:00:01 PST 2024


Author: Alexander Richardson
Date: 2024-11-11T09:59:58-05:00
New Revision: 30feb35c1ebc6f09d85df814f8aac57e8eb6fcc2

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

LOG: [libc++] Update CMake dependency for generate_iwyu_mapping.py (#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.

Added: 
    

Modified: 
    libcxx/include/CMakeLists.txt
    libcxx/include/__cxx03/CMakeLists.txt
    libcxx/utils/libcxx/header_information.py

Removed: 
    


################################################################################
diff  --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 938d0bb872e0b5..a4b97b1d7658cc 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -1057,7 +1057,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