Skip to content

Commit

Permalink
[BOLT][CMake] Use LLVM macros for install targets
Browse files Browse the repository at this point in the history
The existing BOLT install targets are broken on Windows becase they
don't properly handle output extension. Rather than reimplementing
this logic in BOLT, reuse the existing LLVM macros which already
handle this aspect correctly.

Differential Revision: https://reviews.llvm.org/D151595
  • Loading branch information
petrhosek committed May 30, 2023
1 parent 54d45dd commit 627d5e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
10 changes: 8 additions & 2 deletions bolt/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ mark_as_advanced(BOLT_TOOLS_INSTALL_DIR)

macro(add_bolt_tool name)
llvm_add_tool(BOLT ${ARGV})
install(TARGETS ${name}
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT ${name}
)
add_llvm_install_targets(install-${name} DEPENDS ${name} COMPONENT ${name})
endmacro()

macro(add_bolt_tool_symlink name)
llvm_add_tool_symlink(BOLT ${ARGV})
macro(add_bolt_tool_symlink name dest)
llvm_add_tool_symlink(BOLT ${name} ${dest})
llvm_install_symlink(BOLT ${name} ${dest} ALWAYS_GENERATE)
endmacro()

add_subdirectory(driver)
Expand Down
7 changes: 0 additions & 7 deletions bolt/tools/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ set(BOLT_DEPENDS
)

add_custom_target(bolt DEPENDS ${BOLT_DEPENDS})
install(PROGRAMS
${CMAKE_BINARY_DIR}/bin/llvm-bolt
${CMAKE_BINARY_DIR}/bin/perf2bolt
${CMAKE_BINARY_DIR}/bin/llvm-boltdiff
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT bolt
)
add_llvm_install_targets(install-bolt DEPENDS bolt COMPONENT bolt)
set_target_properties(bolt PROPERTIES FOLDER "BOLT")
set_target_properties(install-bolt PROPERTIES FOLDER "BOLT")
Expand Down
5 changes: 0 additions & 5 deletions bolt/tools/merge-fdata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ add_bolt_tool(merge-fdata
set_target_properties(merge-fdata PROPERTIES FOLDER "BOLT")

add_dependencies(bolt merge-fdata)
install(PROGRAMS
${CMAKE_BINARY_DIR}/bin/merge-fdata
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT bolt
)

# Emit relocations for BOLT meta test (bolt/test/runtime/meta-merge-fdata.test)
if (BOLT_INCLUDE_TESTS AND UNIX AND NOT APPLE)
Expand Down

0 comments on commit 627d5e1

Please sign in to comment.