[PATCH] D74588: Use DISABLE_LLVM_LINK_LLVM_DYLIB for TableGenTests

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 31 09:25:20 PDT 2021


beanz added a comment.

In D74588#2660401 <https://reviews.llvm.org/D74588#2660401>, @dsanders wrote:

>>> I then went with the object library so that CMake would build the objects that I could then link as part of llvm-tblgen instead of being a proper library but the bots running older CMake's objected to that.

I'm not sure what CMake issues you encountered. This does concern me a little bit because we've used object libraries in a lot of places in the past without issue even before the CMake version bump. CMake has supported object libraries for years, the only recent change to handling them was allowing them to be specified in `target_link_libraries`, which isn't super important here.

>> In my view the best solution would be to go with the original object library, which should be fine by now because we have `cmake_minimum_required(VERSION 3.13.4)` in `llvm/CMakeLists.txt`, so everybody has to use a CMake version that supports them. We're not talking about an awful number of sources, and for those not building unit tests it behaves just as if the sources were part of `llvm-tblgen`.
>
> That sounds good to me. Would you like me to change it back to that?

That sounds reasonable. Here's a patch:

  diff --git a/llvm/unittests/TableGen/CMakeLists.txt b/llvm/unittests/TableGen/CMakeLists.txt
  index 178018ba8967..c678f2b639d9 100644
  --- a/llvm/unittests/TableGen/CMakeLists.txt
  +++ b/llvm/unittests/TableGen/CMakeLists.txt
  @@ -12,6 +12,7 @@ add_public_tablegen_target(AutomataTestTableGen)
   add_llvm_unittest(TableGenTests
     CodeExpanderTest.cpp
     AutomataTest.cpp
  +  $<TARGET_OBJECTS:obj.LLVMTableGenGlobalISel>
     )
   include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../utils/TableGen)
  -target_link_libraries(TableGenTests PRIVATE LLVMTableGenGlobalISel LLVMTableGen)
  +target_link_libraries(TableGenTests PRIVATE LLVMTableGen)
  diff --git a/llvm/utils/TableGen/CMakeLists.txt b/llvm/utils/TableGen/CMakeLists.txt
  index 9e918852b1c0..8b01a40f3ad5 100644
  --- a/llvm/utils/TableGen/CMakeLists.txt
  +++ b/llvm/utils/TableGen/CMakeLists.txt
  @@ -56,6 +56,6 @@ add_tablegen(llvm-tblgen LLVM
     X86RecognizableInstr.cpp
     WebAssemblyDisassemblerEmitter.cpp
     CTagsEmitter.cpp
  +  $<TARGET_OBJECTS:obj.LLVMTableGenGlobalISel>
     )
  -target_link_libraries(llvm-tblgen PRIVATE LLVMTableGenGlobalISel)
   set_target_properties(llvm-tblgen PROPERTIES FOLDER "Tablegenning")
  diff --git a/llvm/utils/TableGen/GlobalISel/CMakeLists.txt b/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
  index c23ef6742f32..1cd741cd6be1 100644
  --- a/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
  +++ b/llvm/utils/TableGen/GlobalISel/CMakeLists.txt
  @@ -3,7 +3,7 @@ set(LLVM_LINK_COMPONENTS
     TableGen
     )
   
  -add_llvm_library(LLVMTableGenGlobalISel STATIC DISABLE_LLVM_LINK_LLVM_DYLIB
  +add_llvm_library(LLVMTableGenGlobalISel OBJECT
                    CodeExpander.cpp
                    GIMatchDag.cpp
                    GIMatchDagEdge.cpp




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74588



More information about the llvm-commits mailing list