2008-11-14 22:06:14 +00:00
|
|
|
include(LLVMProcessSources)
|
2008-09-22 01:08:49 +00:00
|
|
|
|
2008-09-22 18:21:51 +00:00
|
|
|
macro(target_name_of_partially_linked_object lib var)
|
2009-06-04 19:53:37 +00:00
|
|
|
if( USE_EXPLICIT_DEPENDENCIES )
|
2008-09-22 18:21:51 +00:00
|
|
|
set(${var} ${lib})
|
2009-06-04 19:53:37 +00:00
|
|
|
else( )
|
2008-09-22 18:21:51 +00:00
|
|
|
set(${var} ${lib}_pll)
|
2009-06-04 19:53:37 +00:00
|
|
|
endif( )
|
2008-09-22 18:21:51 +00:00
|
|
|
endmacro(target_name_of_partially_linked_object lib var)
|
|
|
|
|
|
|
|
|
2008-09-22 01:08:49 +00:00
|
|
|
macro(add_partially_linked_object lib)
|
2009-06-04 19:53:37 +00:00
|
|
|
if( USE_EXPLICIT_DEPENDENCIES )
|
2008-09-22 01:08:49 +00:00
|
|
|
add_llvm_library( ${lib} ${ARGN})
|
2009-06-04 19:53:37 +00:00
|
|
|
else( )
|
2009-03-16 22:53:26 +00:00
|
|
|
set(pll ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${lib}.o)
|
2008-09-22 01:08:49 +00:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib)
|
2008-11-15 02:08:08 +00:00
|
|
|
llvm_process_sources( ALL_FILES ${ARGN} )
|
2008-11-20 03:10:17 +00:00
|
|
|
if( BUILD_SHARED_LIBS AND SUPPORTS_FPIC_FLAG )
|
|
|
|
add_definitions(-fPIC)
|
|
|
|
endif()
|
2008-11-15 02:08:08 +00:00
|
|
|
add_library( ${lib} STATIC ${ALL_FILES})
|
2008-09-22 18:21:51 +00:00
|
|
|
if( LLVM_COMMON_DEPENDS )
|
|
|
|
add_dependencies( ${lib} ${LLVM_COMMON_DEPENDS} )
|
|
|
|
endif( LLVM_COMMON_DEPENDS )
|
2008-09-22 01:08:49 +00:00
|
|
|
add_custom_command(OUTPUT ${pll}
|
2008-09-22 02:33:43 +00:00
|
|
|
COMMENT "Building ${lib}.o..."
|
2008-09-22 01:08:49 +00:00
|
|
|
DEPENDS ${lib}
|
2009-03-16 22:53:26 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib/${CMAKE_CFG_INTDIR}
|
2008-09-22 01:08:49 +00:00
|
|
|
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
2008-11-09 18:53:19 +00:00
|
|
|
COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
|
2009-01-07 19:24:44 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove -f *${CMAKE_CXX_OUTPUT_EXTENSION}
|
2008-09-22 01:08:49 +00:00
|
|
|
)
|
2008-09-22 18:21:51 +00:00
|
|
|
target_name_of_partially_linked_object(${lib} tnplo)
|
|
|
|
add_custom_target(${tnplo} ALL DEPENDS ${pll})
|
2008-09-22 01:08:49 +00:00
|
|
|
set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE)
|
2008-09-22 18:21:51 +00:00
|
|
|
set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE )
|
2009-06-04 19:53:37 +00:00
|
|
|
endif( )
|
2008-10-22 02:56:07 +00:00
|
|
|
install(FILES ${pll}
|
2009-06-12 02:49:53 +00:00
|
|
|
DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
2008-09-22 01:08:49 +00:00
|
|
|
endmacro(add_partially_linked_object lib)
|