[PATCH] D126581: [Bazel][GN] Reuse the GN LLVM config file generation code

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 17:29:46 PDT 2022


rnk created this revision.
rnk added reviewers: thakis, GMNGeoffrey, MaskRay.
Herald added subscribers: StephenFan, mgorny.
Herald added a project: All.
rnk requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126581

Files:
  llvm/utils/gn/build/write_cmake_config.gni
  llvm/utils/gn/build/write_cmake_config.py
  llvm/utils/write_cmake_config.py
  utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
  utils/bazel/llvm-project-overlay/llvm/config.bzl
  utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
  utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h
  utils/bazel/llvm-project-overlay/llvm/write_cmake_config.bzl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126581.432674.patch
Type: text/x-patch
Size: 36273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220528/ed6f3006/attachment.bin>


More information about the llvm-commits mailing list