[PATCH] D141581: [clang] Make clangBasic and clangDriver depend on LLVMTargetParser.

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 05:26:27 PST 2023


fpetrogalli updated this revision to Diff 491320.
fpetrogalli added a comment.
Herald added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, sstefan1.
Herald added a project: LLVM.

@mgorny, I have updated the patch according to the suggestions from @tstellar in https://reviews.llvm.org/D141581#4069857.

I have used the script below to test the stand-alone build of clang. Indeed, the error related to the cmake configuration for RISCVTargetParserDefs has disappeared. However, there is an (unreltaed) error that does not allow me to test the full build:

  CMake Error at /Users/fpetrogalli/projects/cpu-defs/install/lib/cmake/llvm/LLVMExports.cmake:1222 (set_target_properties):
    The link interface of target "LLVMLineEditor" contains:
  
      LibEdit::LibEdit
  
    but the target was not found.  Possible reasons include:
  
      * There is a typo in the target name.
      * A find_package call is missing for an IMPORTED target.
      * An ALIAS target is missing.
  
  Call Stack (most recent call first):
    /Users/fpetrogalli/projects/cpu-defs/install/lib/cmake/llvm/LLVMConfig.cmake:329 (include)
    CMakeLists.txt:38 (find_package)

Script used for testing:

  % cat standalone.sh
  #!/bin/sh
  
  build_llvm=`pwd`/build-llvm
  build_clang=`pwd`/build-clang
  installprefix=`pwd`/install
  llvm=`pwd`/llvm-project
  mkdir -p $build_llvm
  mkdir -p $installprefix
  
  cmake -G Ninja -S $llvm/llvm -B $build_llvm \
        -DLLVM_INSTALL_UTILS=ON \
        -DCMAKE_INSTALL_PREFIX=$installprefix \
        -DCMAKE_BUILD_TYPE=Release
  
  ninja -C $build_llvm install
  
  cmake -G Ninja -S $llvm/clang -B $build_clang \
        -DLLVM_EXTERNAL_LIT=$build_llvm/utils/lit \
        -DLLVM_ROOT=$installprefix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141581

Files:
  clang/lib/Basic/CMakeLists.txt
  clang/lib/Driver/CMakeLists.txt
  llvm/cmake/modules/LLVMConfig.cmake.in


Index: llvm/cmake/modules/LLVMConfig.cmake.in
===================================================================
--- llvm/cmake/modules/LLVMConfig.cmake.in
+++ llvm/cmake/modules/LLVMConfig.cmake.in
@@ -140,9 +140,9 @@
   @llvm_config_include_buildtree_only_exports@
 endif()
 
-# By creating intrinsics_gen, omp_gen and acc_gen here, subprojects that depend
-# on LLVM's tablegen-generated headers can always depend on this target whether
-# building in-tree with LLVM or not.
+# By creating the following targets here, subprojects that depend on
+# LLVM's tablegen-generated headers can always depend on this target
+# whether building in-tree with LLVM or not.
 if(NOT TARGET intrinsics_gen)
   add_custom_target(intrinsics_gen)
 endif()
@@ -152,6 +152,9 @@
 if(NOT TARGET acc_gen)
   add_custom_target(acc_gen)
 endif()
+if(NOT TARGET RISCVTargetParserTableGen)
+  add_custom_target(RISCVTargetParserTableGen)
+endif()
 
 set_property(GLOBAL PROPERTY LLVM_TARGETS_CONFIGURED On)
 include(${LLVM_CMAKE_DIR}/LLVM-Config.cmake)
Index: clang/lib/Driver/CMakeLists.txt
===================================================================
--- clang/lib/Driver/CMakeLists.txt
+++ clang/lib/Driver/CMakeLists.txt
@@ -93,7 +93,6 @@
 
   DEPENDS
   ClangDriverOptions
-  RISCVTargetParserTableGen
 
   LINK_LIBS
   clangBasic
Index: clang/lib/Basic/CMakeLists.txt
===================================================================
--- clang/lib/Basic/CMakeLists.txt
+++ clang/lib/Basic/CMakeLists.txt
@@ -110,7 +110,6 @@
 
   DEPENDS
   omp_gen
-  RISCVTargetParserTableGen
   )
 
 target_link_libraries(clangBasic


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141581.491320.patch
Type: text/x-patch
Size: 1610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230123/8e3540a1/attachment.bin>


More information about the llvm-commits mailing list