mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-19 18:24:05 +00:00
CMake: Support for building 32 bit mode libs and binaries on
Linux/x86-64. llvm-svn: 58677
This commit is contained in:
parent
9f6d4e7fb0
commit
8e964f2e6f
@ -73,6 +73,21 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
|
||||
add_definitions( -D__STDC_LIMIT_MACROS )
|
||||
add_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 )
|
||||
# TODO: support other platforms and toolchains.
|
||||
option(BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
|
||||
if( BUILD_32_BITS )
|
||||
message(STATUS "Building 32 bits executables and libraries.")
|
||||
add_definitions( -m32 )
|
||||
set( CMAKE_EXE_LINKER_FLAGS "-m32 ${CMAKE_EXE_LINKER_FLAGS}" )
|
||||
set( CMAKE_LINK_LIBRARY_FLAG "-m32 ${CMAKE_LINK_LIBRARY_FLAG}" )
|
||||
set( LLVM_PLO_FLAGS -melf_i386 ${LLVM_PLO_FLAGS} )
|
||||
endif( BUILD_32_BITS )
|
||||
endif( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
|
||||
|
||||
if( MSVC )
|
||||
add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS )
|
||||
add_definitions( -D_SCL_SECURE_NO_WARNINGS -DCRT_NONSTDC_NO_WARNINGS )
|
||||
|
@ -24,7 +24,7 @@ macro(add_partially_linked_object lib)
|
||||
DEPENDS ${lib}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
|
||||
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
COMMAND ld -r *${CMAKE_CXX_OUTPUT_EXTENSION} -o ${pll}
|
||||
COMMAND ld "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
|
||||
COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION}
|
||||
)
|
||||
target_name_of_partially_linked_object(${lib} tnplo)
|
||||
|
Loading…
x
Reference in New Issue
Block a user