Skip to content

Commit 9457f2b

Browse files
committed
[PPC][BOLT] Fix build error, copy PPGenInstrInfo.inc to include dir as soon as it is generated, before any compilation step tries to include it
1 parent 4ebd40a commit 9457f2b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

bolt/lib/Target/PowerPC/CMakeLists.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@ target_include_directories(LLVMBOLTTargetPowerPC PRIVATE
77
${LLVM_SOURCE_DIR}/include
88
)
99

10+
# Ensure the destination directory exists
1011
file(MAKE_DIRECTORY "${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC")
1112

12-
add_custom_command(TARGET LLVMBOLTTargetPowerPC POST_BUILD
13+
# Custom command to copy the .inc file when it's generated
14+
add_custom_command(
15+
OUTPUT "${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/PPCGenInstrInfo.inc"
1316
COMMAND ${CMAKE_COMMAND} -E copy_if_different
1417
"${LLVM_BINARY_DIR}/lib/Target/PowerPC/PPCGenInstrInfo.inc"
1518
"${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/PPCGenInstrInfo.inc"
16-
)
19+
DEPENDS "${LLVM_BINARY_DIR}/lib/Target/PowerPC/PPCGenInstrInfo.inc"
20+
COMMENT "Copying PPCGenInstrInfo.inc to include directory"
21+
)
22+
23+
# Custom target to represent the copied .inc file
24+
add_custom_target(
25+
BoltCopyPPCGenInstrInfoInc ALL
26+
DEPENDS "${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/PPCGenInstrInfo.inc"
27+
)
28+
29+
# Make your library depend on the copy
30+
add_dependencies(LLVMBOLTTargetPowerPC BoltCopyPPCGenInstrInfoInc)

0 commit comments

Comments
 (0)