[all-commits] [llvm/llvm-project] e2ee8b: [Bazel][GN] Reuse the GN LLVM config file generati...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Tue May 31 19:43:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e2ee8bf9818189b900e65d6ea8f1ae6fc75455ce
      https://github.com/llvm/llvm-project/commit/e2ee8bf9818189b900e65d6ea8f1ae6fc75455ce
  Author: Reid Kleckner <rnk at google.com>
  Date:   2022-05-31 (Tue, 31 May 2022)

  Changed paths:
    M llvm/utils/gn/build/write_cmake_config.gni
    R llvm/utils/gn/build/write_cmake_config.py
    A llvm/utils/write_cmake_config.py
    M utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
    M utils/bazel/llvm-project-overlay/llvm/config.bzl
    R utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
    R utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h
    A utils/bazel/llvm-project-overlay/llvm/write_cmake_config.bzl

  Log Message:
  -----------
  [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




More information about the All-commits mailing list