mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-21 23:33:13 +01:00
Refactoring feature of LDC runtime building as LLVM bytecode library
This refactoring required to make possible BUILD_BC_LIBS option work
together with options like BUILD_SINGLE_LIB and to build Phobos as
LLVM bytecode too.
- libdruntime-rt-ldc can be built as LLVM bytecode library. This feature
was commented out because of currently irrelevant reason.
- Removed irrelevant modifications of native code library content inside
BUILD_BC_LIBS logic.
- Decoupled BUILD_BC_LIBS logic from basic runtime building logic.
This commit is contained in:
@@ -291,34 +291,6 @@ macro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix)
|
||||
endif(BUILD_SINGLE_LIB)
|
||||
endif()
|
||||
|
||||
if(BUILD_BC_LIBS)
|
||||
find_program(LLVM_AR_EXE llvm-ar ${LLVM_INSTDIR}/bin DOC "path to llvm-ar tool")
|
||||
if(NOT LLVM_AR_EXE)
|
||||
message(SEND_ERROR "llvm-ar not found")
|
||||
endif(NOT LLVM_AR_EXE)
|
||||
|
||||
add_library(${RUNTIME_CC}-c ${CORE_C})
|
||||
add_library(${RUNTIME_DC}-c ${DCRT_C})
|
||||
list(APPEND LIBS
|
||||
${RUNTIME_CC}-c
|
||||
${RUNTIME_DC}-c
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT bclibs
|
||||
COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_CC}-bc.a ${CORE_BC}
|
||||
COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_GC}-bc.a ${GC_BC}
|
||||
# cannot parse genobj.bc if built with -g
|
||||
# COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_DC}-bc.a ${DCRT_BC}
|
||||
WORKING_DIRECTORY ${output_path}
|
||||
DEPENDS
|
||||
${CORE_BC}
|
||||
${GC_BC}
|
||||
${DCRT_BC}
|
||||
${LDC_IMPORTS}
|
||||
)
|
||||
set(BCLIBS bclibs)
|
||||
endif(BUILD_BC_LIBS)
|
||||
|
||||
set_target_properties(
|
||||
${LIBS} PROPERTIES
|
||||
VERSION ${DMDFE_VERSION}
|
||||
@@ -332,9 +304,6 @@ macro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix)
|
||||
)
|
||||
install(TARGETS ${LIBS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${path_suffix})
|
||||
|
||||
# BCLIBS is empty if BUILD_BC_LIBS is not selected
|
||||
add_custom_target(runtime${target_suffix} DEPENDS ${LIBS} ${BCLIBS})
|
||||
|
||||
if(PHOBOS2_DIR)
|
||||
set(PHOBOS2_O "")
|
||||
set(PHOBOS2_BC "")
|
||||
@@ -371,6 +340,30 @@ macro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix)
|
||||
install(TARGETS phobos-ldc${target_suffix} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${path_suffix})
|
||||
add_dependencies(phobos2 DEPENDS phobos-ldc${target_suffix})
|
||||
endif(PHOBOS2_DIR)
|
||||
|
||||
if(BUILD_BC_LIBS)
|
||||
find_program(LLVM_AR_EXE llvm-ar ${LLVM_INSTDIR}/bin DOC "path to llvm-ar tool")
|
||||
if(NOT LLVM_AR_EXE)
|
||||
message(SEND_ERROR "llvm-ar not found")
|
||||
endif(NOT LLVM_AR_EXE)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT bclibs
|
||||
COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_CC}-bc.a ${CORE_BC}
|
||||
COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_GC}-bc.a ${GC_BC}
|
||||
COMMAND ${LLVM_AR_EXE} rs lib${RUNTIME_DC}-bc.a ${DCRT_BC}
|
||||
WORKING_DIRECTORY ${output_path}
|
||||
DEPENDS
|
||||
${CORE_BC}
|
||||
${GC_BC}
|
||||
${DCRT_BC}
|
||||
${LDC_IMPORTS}
|
||||
)
|
||||
set(BCLIBS bclibs)
|
||||
endif(BUILD_BC_LIBS)
|
||||
|
||||
# BCLIBS is empty if BUILD_BC_LIBS is not selected
|
||||
add_custom_target(runtime${target_suffix} DEPENDS ${LIBS} ${BCLIBS})
|
||||
endmacro(build_runtime d_flags c_flags ld_flags lib_suffix path_suffix)
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user