mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[CMake] Bug 25059 - CMake libllvm.so.$MAJOR.$MINOR shared object name not compatible with ldconfig
Summary: This change makes the CMake build system generate libraries for Linux and Darwin matching the makefile build system. Linux libraries follow the pattern lib${name}.${MAJOR}.${MINOR}.so so that ldconfig won't pick it up incorrectly. Darwin libraries are not versioned. Note: On linux the non-versioned symlink is generated at install-time not build time. I plan to fix that eventually, but I expect that is good enough for the purposes of fixing this bug. Reviewers: loladiro, tstellarAMD Subscribers: axw, llvm-commits Differential Revision: http://reviews.llvm.org/D13841 llvm-svn: 252093
This commit is contained in:
parent
6cc9101fe1
commit
c127f2db5e
@ -324,10 +324,12 @@ endfunction(set_windows_version_resource_properties)
|
|||||||
# Same semantics as target_link_libraries().
|
# Same semantics as target_link_libraries().
|
||||||
# ADDITIONAL_HEADERS
|
# ADDITIONAL_HEADERS
|
||||||
# May specify header files for IDE generators.
|
# May specify header files for IDE generators.
|
||||||
|
# SONAME
|
||||||
|
# Should set SONAME link flags and create symlinks
|
||||||
# )
|
# )
|
||||||
function(llvm_add_library name)
|
function(llvm_add_library name)
|
||||||
cmake_parse_arguments(ARG
|
cmake_parse_arguments(ARG
|
||||||
"MODULE;SHARED;STATIC;DISABLE_LLVM_LINK_LLVM_DYLIB"
|
"MODULE;SHARED;STATIC;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME"
|
||||||
"OUTPUT_NAME"
|
"OUTPUT_NAME"
|
||||||
"ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
|
"ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
|
||||||
${ARGN})
|
${ARGN})
|
||||||
@ -432,11 +434,6 @@ function(llvm_add_library name)
|
|||||||
PREFIX ""
|
PREFIX ""
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${name}
|
|
||||||
PROPERTIES
|
|
||||||
SOVERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}
|
|
||||||
VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ARG_MODULE OR ARG_SHARED)
|
if(ARG_MODULE OR ARG_SHARED)
|
||||||
@ -501,7 +498,7 @@ endfunction()
|
|||||||
|
|
||||||
macro(add_llvm_library name)
|
macro(add_llvm_library name)
|
||||||
cmake_parse_arguments(ARG
|
cmake_parse_arguments(ARG
|
||||||
"SHARED"
|
"SHARED;SONAME"
|
||||||
""
|
""
|
||||||
""
|
""
|
||||||
${ARGN})
|
${ARGN})
|
||||||
@ -544,6 +541,19 @@ macro(add_llvm_library name)
|
|||||||
-DCMAKE_INSTALL_COMPONENT=${name}
|
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||||
endif()
|
endif()
|
||||||
|
if(ARG_SHARED AND UNIX)
|
||||||
|
if(NOT APPLE AND ARG_SONAME)
|
||||||
|
set(library_name ${name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}${LLVM_VERSION_SUFFIX})
|
||||||
|
set(api_name ${name}-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX})
|
||||||
|
set_target_properties(${name} PROPERTIES OUTPUT_NAME ${library_name})
|
||||||
|
llvm_install_library_symlink(${api_name} ${library_name} SHARED
|
||||||
|
COMPONENT ${name}
|
||||||
|
ALWAYS_GENERATE)
|
||||||
|
llvm_install_library_symlink(${name} ${library_name} SHARED
|
||||||
|
COMPONENT ${name}
|
||||||
|
ALWAYS_GENERATE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
|
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
|
||||||
endif()
|
endif()
|
||||||
@ -1042,6 +1052,41 @@ function(add_lit_testsuites project directory)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(llvm_install_library_symlink name dest type)
|
||||||
|
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
|
||||||
|
foreach(path ${CMAKE_MODULE_PATH})
|
||||||
|
if(EXISTS ${path}/LLVMInstallSymlink.cmake)
|
||||||
|
set(INSTALL_SYMLINK ${path}/LLVMInstallSymlink.cmake)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(component ${ARG_COMPONENT})
|
||||||
|
if(NOT component)
|
||||||
|
set(component ${name})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
|
||||||
|
set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
|
||||||
|
|
||||||
|
set(output_dir lib)
|
||||||
|
if(WIN32 AND "${type}" STREQUAL "SHARED")
|
||||||
|
set(output_dir bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(SCRIPT ${INSTALL_SYMLINK}
|
||||||
|
CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
|
||||||
|
COMPONENT ${component})
|
||||||
|
|
||||||
|
if (NOT CMAKE_CONFIGURATION_TYPES AND NOT ARG_ALWAYS_GENERATE)
|
||||||
|
add_custom_target(install-${name}
|
||||||
|
DEPENDS ${name} ${dest} install-${dest}
|
||||||
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
|
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||||
|
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
function(llvm_install_symlink name dest)
|
function(llvm_install_symlink name dest)
|
||||||
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "" "" ${ARGN})
|
cmake_parse_arguments(ARG "ALWAYS_GENERATE" "" "" ${ARGN})
|
||||||
foreach(path ${CMAKE_MODULE_PATH})
|
foreach(path ${CMAKE_MODULE_PATH})
|
||||||
|
@ -38,7 +38,7 @@ if(LLVM_DYLIB_EXPORTED_SYMBOL_FILE)
|
|||||||
add_custom_target(libLLVMExports DEPENDS ${LLVM_EXPORTED_SYMBOL_FILE})
|
add_custom_target(libLLVMExports DEPENDS ${LLVM_EXPORTED_SYMBOL_FILE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB ${SOURCES})
|
add_llvm_library(LLVM SHARED DISABLE_LLVM_LINK_LLVM_DYLIB SONAME ${SOURCES})
|
||||||
|
|
||||||
list(REMOVE_DUPLICATES LIB_NAMES)
|
list(REMOVE_DUPLICATES LIB_NAMES)
|
||||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") # FIXME: It should be "GNU ld for elf"
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") # FIXME: It should be "GNU ld for elf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user