This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Allow optionally to build `tablegen` in `Release` and use it in `Debug` for the `Ninja Multi-Config` generator
Needs ReviewPublic

Authored by akyrtzi on Jan 25 2022, 1:40 PM.

Details

Summary

If Ninja Multi-Config is used and LLVM_OPTIMIZED_TABLEGEN=YES is set
tablegen binaries will be built in Release, even when building for Debug configuration,
without needing a separate configured build directory just for tablegen binaries.
To get such a setup you'd configure like this:

cmake -G 'Ninja Multi-Config' /path/to/llvm-project/llvm \
     -DCMAKE_CONFIGURATION_TYPES="Debug;Release" -DCMAKE_CROSS_CONFIGS="Release" \
     -DLLVM_OPTIMIZED_TABLEGEN=YES                       \
   ....

Also note the other benefit of Ninja Multi-Config is saving configure time, particularly when
switching between Debug and Release during development.

Diff Detail

Event Timeline

akyrtzi created this revision.Jan 25 2022, 1:40 PM
akyrtzi requested review of this revision.Jan 25 2022, 1:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 25 2022, 1:40 PM
compnerd added inline comments.Jan 31 2022, 10:07 AM
llvm/cmake/modules/TableGen.cmake
103

This can actually break the dependency tracking; I think that we should figure out how to get the target setup and use that. At that point, rather than computing the path manually, we should be able to use the generator expression $<TARGET_FILE:target> to get the path.

akyrtzi added inline comments.Feb 21 2022, 5:12 PM
llvm/cmake/modules/TableGen.cmake
103

Could you suggest a specific change? Unfortunately my CMake-foo is rather weak..😅

Godin added a subscriber: Godin.Aug 25 2022, 2:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2022, 2:08 AM