mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-30 07:14:53 +00:00
Eliminate object-relinking support from CMake. Fixes PR 4429 and
cleans up the CMake-based build system a bit. Started by a patch from Xerxes Rånby. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73969 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
83a2129332
commit
7e9e36a23e
@ -180,9 +180,6 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
|
|||||||
add_llvm_definitions( -D__STDC_LIMIT_MACROS )
|
add_llvm_definitions( -D__STDC_LIMIT_MACROS )
|
||||||
add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
|
add_llvm_definitions( -D__STDC_CONSTANT_MACROS )
|
||||||
|
|
||||||
set(LLVM_PLO_FLAGS "" CACHE
|
|
||||||
STRING "Flags for creating partially linked objects.")
|
|
||||||
|
|
||||||
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
||||||
# TODO: support other platforms and toolchains.
|
# TODO: support other platforms and toolchains.
|
||||||
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
|
option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
|
||||||
@ -221,7 +218,6 @@ endif( MSVC )
|
|||||||
include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
|
include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
|
||||||
|
|
||||||
include(AddLLVM)
|
include(AddLLVM)
|
||||||
include(AddPartiallyLinkedObject)
|
|
||||||
include(TableGen)
|
include(TableGen)
|
||||||
|
|
||||||
add_subdirectory(lib/Support)
|
add_subdirectory(lib/Support)
|
||||||
|
@ -61,8 +61,10 @@ macro(add_llvm_target target_name)
|
|||||||
add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS})
|
add_dependencies(${target_name}Table_gen ${LLVM_COMMON_DEPENDS})
|
||||||
endif( TABLEGEN_OUTPUT )
|
endif( TABLEGEN_OUTPUT )
|
||||||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
add_partially_linked_object(LLVM${target_name} ${ARGN})
|
add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
|
||||||
|
if (FALSE)
|
||||||
if( TABLEGEN_OUTPUT )
|
if( TABLEGEN_OUTPUT )
|
||||||
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
|
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
|
||||||
endif( TABLEGEN_OUTPUT )
|
endif( TABLEGEN_OUTPUT )
|
||||||
|
endif ()
|
||||||
endmacro(add_llvm_target)
|
endmacro(add_llvm_target)
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
include(LLVMProcessSources)
|
|
||||||
|
|
||||||
macro(target_name_of_partially_linked_object lib var)
|
|
||||||
if( USE_EXPLICIT_DEPENDENCIES )
|
|
||||||
set(${var} ${lib})
|
|
||||||
else( )
|
|
||||||
set(${var} ${lib}_pll)
|
|
||||||
endif( )
|
|
||||||
endmacro(target_name_of_partially_linked_object lib var)
|
|
||||||
|
|
||||||
|
|
||||||
macro(add_partially_linked_object lib)
|
|
||||||
if( USE_EXPLICIT_DEPENDENCIES )
|
|
||||||
add_llvm_library( ${lib} ${ARGN})
|
|
||||||
else( )
|
|
||||||
set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${lib}.o)
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
||||||
llvm_process_sources( ALL_FILES ${ARGN} )
|
|
||||||
if( BUILD_SHARED_LIBS AND SUPPORTS_FPIC_FLAG )
|
|
||||||
add_definitions(-fPIC)
|
|
||||||
endif()
|
|
||||||
add_library( ${lib} STATIC ${ALL_FILES})
|
|
||||||
if( LLVM_COMMON_DEPENDS )
|
|
||||||
add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
|
|
||||||
endif( LLVM_COMMON_DEPENDS )
|
|
||||||
add_custom_command(OUTPUT ${pll}
|
|
||||||
COMMENT "Building ${lib}.o..."
|
|
||||||
DEPENDS ${lib}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib/${CMAKE_CFG_INTDIR}
|
|
||||||
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
|
||||||
COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove -f *${CMAKE_CXX_OUTPUT_EXTENSION}
|
|
||||||
)
|
|
||||||
target_name_of_partially_linked_object(${lib} tnplo)
|
|
||||||
add_custom_target(${tnplo} ALL DEPENDS ${pll})
|
|
||||||
set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
|
|
||||||
set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE )
|
|
||||||
endif( )
|
|
||||||
install(FILES ${pll}
|
|
||||||
DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
|
||||||
endmacro(add_partially_linked_object lib)
|
|
@ -1,4 +1,4 @@
|
|||||||
add_partially_linked_object(LLVMExecutionEngine
|
add_llvm_library(LLVMExecutionEngine
|
||||||
ExecutionEngine.cpp
|
ExecutionEngine.cpp
|
||||||
ExecutionEngineBindings.cpp
|
ExecutionEngineBindings.cpp
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
add_partially_linked_object(LLVMInterpreter
|
add_llvm_library(LLVMInterpreter
|
||||||
Execution.cpp
|
Execution.cpp
|
||||||
ExternalFunctions.cpp
|
ExternalFunctions.cpp
|
||||||
Interpreter.cpp
|
Interpreter.cpp
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# TODO: Support other architectures. See Makefile.
|
# TODO: Support other architectures. See Makefile.
|
||||||
add_definitions(-DENABLE_X86_JIT)
|
add_definitions(-DENABLE_X86_JIT)
|
||||||
|
|
||||||
add_partially_linked_object(LLVMJIT
|
add_llvm_library(LLVMJIT
|
||||||
Intercept.cpp
|
Intercept.cpp
|
||||||
JIT.cpp
|
JIT.cpp
|
||||||
JITDwarfEmitter.cpp
|
JITDwarfEmitter.cpp
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||||
|
|
||||||
add_partially_linked_object(LLVMARMAsmPrinter
|
add_llvm_library(LLVMARMAsmPrinter
|
||||||
ARMAsmPrinter.cpp
|
ARMAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMARMCodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMARMAsmPrinter ${n})
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||||
|
|
||||||
add_partially_linked_object(LLVMAlphaAsmPrinter
|
add_llvm_library(LLVMAlphaAsmPrinter
|
||||||
AlphaAsmPrinter.cpp
|
AlphaAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMAlphaCodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMAlphaAsmPrinter ${n})
|
|
||||||
|
@ -3,10 +3,6 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
)
|
)
|
||||||
|
|
||||||
add_partially_linked_object(LLVMCellSPUAsmPrinter
|
add_llvm_library(LLVMCellSPUAsmPrinter
|
||||||
SPUAsmPrinter.cpp
|
SPUAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMCellSPUCodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMCellSPUAsmPrinter ${n})
|
|
||||||
|
@ -3,10 +3,6 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
)
|
)
|
||||||
|
|
||||||
add_partially_linked_object(LLVMIA64AsmPrinter
|
add_llvm_library(LLVMIA64AsmPrinter
|
||||||
IA64AsmPrinter.cpp
|
IA64AsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMIA64CodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMIA64AsmPrinter ${n})
|
|
||||||
|
@ -3,10 +3,6 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||||
)
|
)
|
||||||
|
|
||||||
add_partially_linked_object(LLVMMipsAsmPrinter
|
add_llvm_library(LLVMMipsAsmPrinter
|
||||||
MipsAsmPrinter.cpp
|
MipsAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMMipsCodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMMipsAsmPrinter ${n})
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||||
|
|
||||||
add_partially_linked_object(LLVMPowerPCAsmPrinter
|
add_llvm_library(LLVMPowerPCAsmPrinter
|
||||||
PPCAsmPrinter.cpp
|
PPCAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMPowerPCCodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMPowerPCAsmPrinter ${n})
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||||
|
|
||||||
add_partially_linked_object(LLVMSparcAsmPrinter
|
add_llvm_library(LLVMSparcAsmPrinter
|
||||||
SparcAsmPrinter.cpp
|
SparcAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMSparcCodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMSparcAsmPrinter ${n})
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
include_directories( ${CMAKE_CURRENT_BINARY_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/.. )
|
||||||
|
|
||||||
add_partially_linked_object(LLVMX86AsmPrinter
|
add_llvm_library(LLVMX86AsmPrinter
|
||||||
X86ATTAsmPrinter.cpp
|
X86ATTAsmPrinter.cpp
|
||||||
X86ATTInstPrinter.cpp
|
X86ATTInstPrinter.cpp
|
||||||
X86AsmPrinter.cpp
|
X86AsmPrinter.cpp
|
||||||
X86IntelAsmPrinter.cpp
|
X86IntelAsmPrinter.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_name_of_partially_linked_object(LLVMX86CodeGen n)
|
|
||||||
|
|
||||||
add_dependencies(LLVMX86AsmPrinter ${n})
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user