[PATCH] D126397: [pseudo] Fix pseudo-gen usage when cross-compiling
Shoaib Meenai via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 25 11:08:29 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4baae166ce33: [pseudo] Fix pseudo-gen usage when cross-compiling (authored by smeenai).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126397/new/
https://reviews.llvm.org/D126397
Files:
clang-tools-extra/pseudo/include/CMakeLists.txt
Index: clang-tools-extra/pseudo/include/CMakeLists.txt
===================================================================
--- clang-tools-extra/pseudo/include/CMakeLists.txt
+++ clang-tools-extra/pseudo/include/CMakeLists.txt
@@ -1,25 +1,35 @@
# The cxx.bnf grammar file
set(cxx_bnf ${CMAKE_CURRENT_SOURCE_DIR}/../lib/cxx.bnf)
+# Using CMAKE_CROSSCOMPILING and not LLVM_USE_HOST_TOOLS because the latter is
+# also set for LLVM_OPTIMIZED_TABLEGEN, which we don't care about here.
+if(CMAKE_CROSSCOMPILING)
+ build_native_tool(pseudo-gen pseudo_gen)
+ set(pseudo_gen_target "${pseudo_gen}")
+else()
+ set(pseudo_gen $<TARGET_FILE:pseudo-gen>)
+ set(pseudo_gen_target pseudo-gen)
+endif()
+
# Generate inc files.
set(cxx_symbols_inc ${CMAKE_CURRENT_BINARY_DIR}/CXXSymbols.inc)
add_custom_command(OUTPUT ${cxx_symbols_inc}
- COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/pseudo-gen"
+ COMMAND "${pseudo_gen}"
--grammar ${cxx_bnf}
--emit-symbol-list
-o ${cxx_symbols_inc}
COMMENT "Generating nonterminal symbol file for cxx grammar..."
- DEPENDS pseudo-gen
+ DEPENDS ${pseudo_gen_target}
VERBATIM)
set(cxx_bnf_inc ${CMAKE_CURRENT_BINARY_DIR}/CXXBNF.inc)
add_custom_command(OUTPUT ${cxx_bnf_inc}
- COMMAND "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/pseudo-gen"
+ COMMAND "${pseudo_gen}"
--grammar ${cxx_bnf}
--emit-grammar-content
-o ${cxx_bnf_inc}
COMMENT "Generating bnf string file for cxx grammar..."
- DEPENDS pseudo-gen
+ DEPENDS ${pseudo_gen_target}
VERBATIM)
# add_custom_command does not create a new target, we need to deine a target
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126397.432052.patch
Type: text/x-patch
Size: 1615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220525/084a1700/attachment.bin>
More information about the cfe-commits
mailing list