Index: bolt/CMakeLists.txt =================================================================== --- bolt/CMakeLists.txt +++ bolt/CMakeLists.txt @@ -55,6 +55,7 @@ -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR} + -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} BUILD_ALWAYS True ) install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)" @@ -87,3 +88,6 @@ if (BOLT_INCLUDE_DOCS) add_subdirectory(docs) endif() + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in + ${CMAKE_CURRENT_BINARY_DIR}/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc @ONLY) Index: bolt/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in =================================================================== --- /dev/null +++ bolt/include/bolt/RuntimeLibs/RuntimeLibraryVariables.inc.in @@ -0,0 +1,17 @@ +//===-- RuntimeLibraryVariables.inc.in - bolt build variables -*- C++ -*---===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is configured by the build system to define the runtime library +// location. +// +// The variant of this file not ending with .in has been autogenerated by the +// LLVM build. Do not edit! +// +//===----------------------------------------------------------------------===// + +#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" Index: bolt/lib/RuntimeLibs/RuntimeLibrary.cpp =================================================================== --- bolt/lib/RuntimeLibs/RuntimeLibrary.cpp +++ bolt/lib/RuntimeLibs/RuntimeLibrary.cpp @@ -11,6 +11,7 @@ //===----------------------------------------------------------------------===// #include "bolt/RuntimeLibs/RuntimeLibrary.h" +#include "bolt/RuntimeLibs/RuntimeLibraryVariables.inc" #include "bolt/Utils/Utils.h" #include "llvm/BinaryFormat/Magic.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" @@ -28,12 +29,12 @@ StringRef LibFileName) { StringRef Dir = llvm::sys::path::parent_path(ToolPath); SmallString<128> LibPath = llvm::sys::path::parent_path(Dir); - llvm::sys::path::append(LibPath, "lib"); + llvm::sys::path::append(LibPath, "lib" LLVM_LIBDIR_SUFFIX); if (!llvm::sys::fs::exists(LibPath)) { // In some cases we install bolt binary into one level deeper in bin/, // we need to go back one more level to find lib directory. LibPath = llvm::sys::path::parent_path(llvm::sys::path::parent_path(Dir)); - llvm::sys::path::append(LibPath, "lib"); + llvm::sys::path::append(LibPath, "lib" LLVM_LIBDIR_SUFFIX); } llvm::sys::path::append(LibPath, LibFileName); if (!llvm::sys::fs::exists(LibPath)) { Index: bolt/runtime/CMakeLists.txt =================================================================== --- bolt/runtime/CMakeLists.txt +++ bolt/runtime/CMakeLists.txt @@ -15,10 +15,12 @@ instr.cpp ${CMAKE_CURRENT_BINARY_DIR}/config.h ) +set_target_properties(bolt_rt_instr PROPERTIES LIBRARY_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}") add_library(bolt_rt_hugify STATIC hugify.cpp ${CMAKE_CURRENT_BINARY_DIR}/config.h ) +set_target_properties(bolt_rt_hugify PROPERTIES LIBRARY_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}") set(BOLT_RT_FLAGS -ffreestanding @@ -33,17 +35,18 @@ target_compile_options(bolt_rt_hugify PRIVATE ${BOLT_RT_FLAGS}) target_include_directories(bolt_rt_hugify PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -install(TARGETS bolt_rt_instr DESTINATION "${CMAKE_INSTALL_LIBDIR}") -install(TARGETS bolt_rt_hugify DESTINATION "${CMAKE_INSTALL_LIBDIR}") +install(TARGETS bolt_rt_instr DESTINATION "lib${LLVM_LIBDIR_SUFFIX}") +install(TARGETS bolt_rt_hugify DESTINATION "lib${LLVM_LIBDIR_SUFFIX}") if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*") add_library(bolt_rt_instr_osx STATIC instr.cpp ${CMAKE_CURRENT_BINARY_DIR}/config.h ) + set_target_properties(bolt_rt_instr_osx PROPERTIES LIBRARY_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}") target_include_directories(bolt_rt_instr_osx PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_compile_options(bolt_rt_instr_osx PRIVATE -target x86_64-apple-darwin19.6.0 ${BOLT_RT_FLAGS}) - install(TARGETS bolt_rt_instr_osx DESTINATION "${CMAKE_INSTALL_LIBDIR}") + install(TARGETS bolt_rt_instr_osx DESTINATION "lib${LLVM_LIBDIR_SUFFIX}") endif()