[llvm] [BOLT] Enable standalone build (PR #97130)

Konrad Kleine via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 00:38:33 PST 2025


================
@@ -16,12 +16,19 @@ add_library(bolt_rt_instr STATIC
   instr.cpp
   ${CMAKE_CURRENT_BINARY_DIR}/config.h
   )
-set_target_properties(bolt_rt_instr PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${LLVM_LIBRARY_DIR}")
+set_target_properties(bolt_rt_instr PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
 add_library(bolt_rt_hugify STATIC
   hugify.cpp
   ${CMAKE_CURRENT_BINARY_DIR}/config.h
   )
-set_target_properties(bolt_rt_hugify PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${LLVM_LIBRARY_DIR}")
+set_target_properties(bolt_rt_hugify PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+
+if(NOT BOLT_BUILT_STANDALONE)
+  add_custom_command(TARGET bolt_rt_instr POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lib/libbolt_rt_instr.a" "${LLVM_LIBRARY_DIR}")
----------------
kwk wrote:

How can you copr from `${CMAKE_CURRENT_BINARY_DIR}/lib/libbolt_rt_instr.a` when the `ARCHIVE_OUTPUT_DIRECTORY` directory for the `bolt_rt_instr` target (and `bolt_rt_hugify` for that matter) was previously set to `${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}`? Why do you need to copy here at all?

https://github.com/llvm/llvm-project/pull/97130


More information about the llvm-commits mailing list