[PATCH] D136392: [bazel] Generate `//:vars.bzl` from `llvm/CMakeLists.txt`

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 16:27:58 PDT 2022


chapuni created this revision.
chapuni added reviewers: GMNGeoffrey, thakis, MaskRay.
Herald added a subscriber: StephenFan.
Herald added a project: All.
chapuni requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

`_extract_cmake_settings()` generates `vars.bzl` in `llvm_configure()`.
It would be easier to use external commands like sed(1) and python.
For portability, the parser should run on Starlark.

`//:vars.bzl` may be loaded from both WORKSPACE and BUILD.

At the moment, `vars.bzl` provides some values as string.

- CMAKE_CXX_STANDARD = "17"
- LLVM_VERSION_MAJOR = "16"
- LLVM_VERSION_MINOR = "0"
- LLVM_VERSION_PATCH = "0"
- LLVM_VERSION = "16.0.0"
- llvm_vars = (dict of these values)

`CMAKE_CXX_STANDARD` may be used to configure toolchain.

[bazel] Migrate LLVM_VERSION stuff to llvm_config_defines

It would be smarter if the BUILD phase could generate `llvm-config.h`.
Since I am afraid of the discussion in D126581 <https://reviews.llvm.org/D126581>, I just remove
LLVM_VERSION stuff out of the static `llvm-config.h`.

[bazel] Define LLD_VERSION_STRING with vars.bzl.

[bazel] Define CLANG_VERSION stuff with vars.bzl


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136392

Files:
  utils/bazel/configure.bzl
  utils/bazel/llvm-project-overlay/clang/BUILD.bazel
  utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
  utils/bazel/llvm-project-overlay/lld/BUILD.bazel
  utils/bazel/llvm-project-overlay/llvm/config.bzl
  utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136392.469402.patch
Type: text/x-patch
Size: 7971 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221020/07f1abec/attachment.bin>


More information about the llvm-commits mailing list