1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/tools/lto/CMakeLists.txt
David Tenty dcf97ff292 [AIX] Build libLTO as MODULE rather than SHARED
On CMake versions greater that >= 3.16 on AIX, shared libraries are
created as archives (which is the normal form for the platform). However
plugins libraries which are passed directly to a executable, like
libLTO to the linker, are usual build as plain `.so`, so this patch
restores this behaviour for libLTO on AIX (and adjust the name if need be
to account for the fact that llvm_add_library likes to force an empty
name prefix on modules), so we end up with the expected libLTO.so

Reviewed By: w2yehia

Differential Revision: https://reviews.llvm.org/D103824
2021-06-10 12:08:59 -04:00

48 lines
1.1 KiB
CMake

set(LLVM_LINK_COMPONENTS
AllTargetsAsmParsers
AllTargetsCodeGens
AllTargetsDescs
AllTargetsDisassemblers
AllTargetsInfos
BitReader
Core
CodeGen
LTO
MC
MCDisassembler
Support
Target
)
set(SOURCES
LTODisassembler.cpp
lto.cpp
)
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
if(CMAKE_SYSTEM_NAME STREQUAL AIX)
set(LTO_LIBRARY_TYPE MODULE)
set(LTO_LIBRARY_NAME libLTO)
else()
set(LTO_LIBRARY_TYPE SHARED)
set(LTO_LIBRARY_NAME LTO)
endif()
add_llvm_library(${LTO_LIBRARY_NAME} ${LTO_LIBRARY_TYPE} INSTALL_WITH_TOOLCHAIN
${SOURCES} DEPENDS intrinsics_gen)
install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
DESTINATION include/llvm-c
COMPONENT LTO)
if (APPLE)
set(LTO_VERSION ${LLVM_VERSION_MAJOR})
if(LLVM_LTO_VERSION_OFFSET)
math(EXPR LTO_VERSION "${LLVM_VERSION_MAJOR} + ${LLVM_LTO_VERSION_OFFSET}")
endif()
set_property(TARGET LTO APPEND_STRING PROPERTY
LINK_FLAGS
" -compatibility_version 1 -current_version ${LTO_VERSION}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}")
endif()