fpetrogalli created this revision.
fpetrogalli added reviewers: mgorny, tstellar.
Herald added subscribers: luismarques, s.egerton, kadircet, PkmX, simoncook, 
arichardson.
Herald added a project: All.
fpetrogalli requested review of this revision.
Herald added subscribers: cfe-commits, pcwang-thead, MaskRay, ilya-biryukov.
Herald added a project: clang.

By the time we start building clangDriver and clangBasic, we need to
make sure that the header file include `#include
"llvm/TargetParser/RISCVTargetParserDef.inc"` used by
`llvm/include/llvm/Targetparser/RISCVTargetParser.h` is created before
the .h file itself is used in the aforementioned clang components.

We opted for this solution because:

1. Adding TargetParser to the LLVM_LINK_COMPONENTS list of clangDriver

and clangBasic can incur in parallel builds, where the clang libraries
are built before LLVMTargetParser is ready. This generates errors like
`fatal error: llvm/TargetParser/RISCVTargetParserDef.inc: No such file
or directory`.

2. Using the original RISCVTargetParserTablegen as DEPENDS of

clangDriver and clangBasic breaks stand-alone builds [1] of clang
(because cmake configuration does not know about the cmake-tree of
llvm, in which RISCVTargetParserTablegen is created).

[1] https://llvm.org/docs/GettingStarted.html#stand-alone-builds

This commit is a rework of https://reviews.llvm.org/D141581, which was
reverted in https://reviews.llvm.org/rG20ffb9aaf982.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142403

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Driver/CMakeLists.txt


Index: clang/lib/Driver/CMakeLists.txt
===================================================================
--- clang/lib/Driver/CMakeLists.txt
+++ clang/lib/Driver/CMakeLists.txt
@@ -93,7 +93,7 @@
 
   DEPENDS
   ClangDriverOptions
-  RISCVTargetParserTableGen
+  LLVMTargetParser
 
   LINK_LIBS
   clangBasic
Index: clang/lib/Basic/CMakeLists.txt
===================================================================
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -110,7 +110,7 @@
 
   DEPENDS
   omp_gen
-  RISCVTargetParserTableGen
+  LLVMTargetParser
   )
 
 target_link_libraries(clangBasic


Index: clang/lib/Driver/CMakeLists.txt
===================================================================
--- clang/lib/Driver/CMakeLists.txt
+++ clang/lib/Driver/CMakeLists.txt
@@ -93,7 +93,7 @@
 
   DEPENDS
   ClangDriverOptions
-  RISCVTargetParserTableGen
+  LLVMTargetParser
 
   LINK_LIBS
   clangBasic
Index: clang/lib/Basic/CMakeLists.txt
===================================================================
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -110,7 +110,7 @@
 
   DEPENDS
   omp_gen
-  RISCVTargetParserTableGen
+  LLVMTargetParser
   )
 
 target_link_libraries(clangBasic
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to