[PATCH] D64837: [cmake] Convert the NATIVE llvm build process to be project agnostic

Nathan Lanza via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 11:59:26 PDT 2019


lanza added a comment.

In D64837#1588826 <https://reviews.llvm.org/D64837#1588826>, @smeenai wrote:

> This just seems like it's replacing all instances of LLVM with `${CMAKE_PROJECT_NAME}`?
>
> I think it'd be cleaner and more explicit to pass an additional project name parameter to `llvm_create_cross_target` instead of implicitly using `${CMAKE_PROJECT_NAME}`. There's some prior art for that, e.g. in https://reviews.llvm.org/diffusion/L/browse/llvm/trunk/cmake/modules/AddLLVM.cmake;366290$1009?as=source&blame=off


That's what I did originally. However, the users of `build_natve_tool` wouldn't have the proper context to know what to use. It's only non-llvm specific usage is within `add_tablegen` which would then have to learn how to decide what `project_name` variable to pass in. e.g. if `lldb` is part of `ENABLE_PROJECTS` then `add_tablegen` should call `llvm_native_build(LLVM NATIVE ...)` else `llvm_native_build(LLDB NATIVE ...)`. So we'd have to propagate that to all users of `add_tablegen` where we'd have to figure out whether the build is standalone or not via checking `CMAKE_PROJECT_NAME` anyways. e.g.

   if (${CMAKE_PROJECT_NAME} MATCHES lldb)
      add_tablegen(lldb lldb lldb-tblgen)
  else()
      add_tablegen(llvm lldb lldb-tblgen)
  endif()

I'm not convinced that adding the granularity to choose your `llvm_create_cross_target` project is worth propagating the configuration outwards given that there are no users that don't satisfy `CMAKE_PROJECT_NAME == project_name`.

An alternative would be to have some global variable `llvm_cross_targets` list that `build_native_tool` iterates over. But this is making an already clumsy solution more clumsy.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64837/new/

https://reviews.llvm.org/D64837





More information about the llvm-commits mailing list