Skip to content

Commit e74c4fa

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

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

bolt/lib/Target/PowerPC/CMakeLists.txt

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

10-
# Ensure the destination directory exists
1110
file(MAKE_DIRECTORY "${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC")
1211

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"
16-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
17-
"${LLVM_BINARY_DIR}/lib/Target/PowerPC/PPCGenInstrInfo.inc"
18-
"${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/PPCGenInstrInfo.inc"
19-
DEPENDS "${LLVM_BINARY_DIR}/lib/Target/PowerPC/PPCGenInstrInfo.inc"
20-
COMMENT "Copying PPCGenInstrInfo.inc to include directory"
12+
foreach(incfile IN ITEMS
13+
PPCGenInstrInfo.inc
14+
PPCGenRegisterInfo.inc
2115
)
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)
16+
add_custom_command(
17+
OUTPUT "${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/${incfile}"
18+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
19+
"${LLVM_BINARY_DIR}/lib/Target/PowerPC/${incfile}"
20+
"${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/${incfile}"
21+
DEPENDS "${LLVM_BINARY_DIR}/lib/Target/PowerPC/${incfile}"
22+
COMMENT "Copying ${incfile} to include directory"
23+
)
24+
add_custom_target(
25+
"BoltCopy${incfile}" ALL
26+
DEPENDS "${LLVM_BINARY_DIR}/include/llvm/Target/PowerPC/${incfile}"
27+
)
28+
add_dependencies(LLVMBOLTTargetPowerPC "BoltCopy${incfile}")
29+
endforeach()

0 commit comments

Comments
 (0)