Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions llvm/cmake/modules/TableGen.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ macro(add_tablegen target project)

# FIXME: Quick fix to reflect LLVM_TABLEGEN to llvm-min-tblgen
if("${target}" STREQUAL "llvm-min-tblgen"
AND NOT "${LLVM_TABLEGEN}" STREQUAL ""
AND NOT "${LLVM_TABLEGEN}" STREQUAL "llvm-tblgen")
set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose ${LLVM_TABLEGEN} is llvm-tblgen by default.
You can modify it if you want to use out-of-tree llvm-tblgen.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use an out-of-tree llvm-tblgen. For me, on input to this block, ${LLVM_TABLEGEN} is of the form:
C:\path\to\dir-within-build-dir\bin\llvm-tblgen.exe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, ${LLVM_TABLEGEN} is llvm-tblgen by default.

AND NOT "${LLVM_TABLEGEN}" STREQUAL "")
# Extract base filename from full path.
get_filename_component(RAW_LLVM_TABLEGEN ${LLVM_TABLEGEN} NAME_WE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder get_filename_component would be applicable here.
Would it match if ${LLVM_TABLEGEN} points the explicit out-of-tree /path/to/llvm-tblgen.exe?

${LLVM_HOST_EXECUTABLE_SUFFIX} may be available here, I guess.

Copy link
Collaborator Author

@wjristow wjristow Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the question. For me, when ${LLVM_TABLEGEN} is of the form:
C:\path\to\dir-within-build-dir\bin\llvm-tblgen.exe

the line:
get_filename_component(RAW_LLVM_TABLEGEN ${LLVM_TABLEGEN} NAME_WE)

sets RAW_LLVM_TABLEGEN to simply llvm-tblgen, which is what I want -- essentially, enabling the portion of the change that suppresses the setting of ${project}_TABLEGEN_DEFAULT that you made in the commit 95d4506.

if(NOT "${RAW_LLVM_TABLEGEN}" STREQUAL ""
AND NOT "${RAW_LLVM_TABLEGEN}" STREQUAL "llvm-tblgen")
set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}")
endif()
endif()

if(ADD_TABLEGEN_EXPORT)
Expand Down
Loading