llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.42k stars 12.15k forks source link

LLVM_EXPERIMENTAL_TARGETS_TO_BUILD - CMake Error: could not find TARGET #58915

Closed thetemplar closed 2 years ago

thetemplar commented 2 years ago

I want to add a new backend/target: https://github.com/TriDis/llvm-tricore/tree/tricore/lib/Target/TriCore

Since the code above is for a very old version, I want to merge it into the current master branch.

Reading the documentation at https://llvm.org/docs/WritingAnLLVMBackend.html#preliminaries it says adding -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=TriCore should be sufficient, but I get the following error:

.....
-- Targeting SystemZ
-- Targeting VE
-- Targeting WebAssembly
-- Targeting X86
-- Targeting XCore-- Targeting XCore
-- Targeting TriCore
CMake Error at cmake/modules/LLVM-Build.cmake:42 (get_property):
  get_property could not find TARGET TriCore.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  lib/CMakeLists.txt:65 (LLVMBuildGenerateCFragment)

CMake Error at cmake/modules/LLVM-Build.cmake:43 (get_property):
  get_property could not find TARGET TriCore.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  lib/CMakeLists.txt:65 (LLVMBuildGenerateCFragment)

Going further to https://llvm.org/docs/WritingAnLLVMBackend.html#target-registration it says For more information, see https://llvm.org/doxygen/TargetRegistry_8h-source.html., but the link is dead.

thetemplar commented 2 years ago

I also tried adding "TriCore" to the set(LLVM_ALL_TARGETS ... list in the mail CMakeLists.txt

thetemplar commented 2 years ago

add_llvm_component_group(TriCore) was missing in the lib/Target/TriCore/CMakeLists.txt file.