[Bazel][GN] Reuse the GN LLVM config file generation code
Currently, the Bazel build uses static, checked in [llvm-]config.h files in combination with global macro definitions to mimic CMake's generated headers. This change reuses the write_cmake_config.py script from the GN build to generate the headers from source in the same way. The purpose is to ensure that the Bazel build stays up to date with any changes to the CMake config files. The write_cmake_config.py script has good error checking to ensure that unneeded, stale variables are not passed, and that any missing variables are reported as errors. I tried to closely follow the logic in the GN build here: llvm/utils/gn/secondary/llvm/include/Config/BUILD.gn The duplication between this file and config.bzl is significant, and we could consider going further, but I'd like to hold off on it for now. The GN build changes are to move the write_cmake_config.py script up to //llvm/utils/write_cmake_config.py, and update the paths accordingly. The next logical change is to generate Clang's config.h header. Differential Revision: https://reviews.llvm.org/D126581
Loading
Please sign in to comment