chore: update stage0

This commit is contained in:
Leonardo de Moura 2020-05-22 11:23:38 -07:00
parent ae3a433f9c
commit 5eae116e66
3 changed files with 10 additions and 4 deletions

View file

@ -535,15 +535,21 @@ install(FILES ${CMAKE_BINARY_DIR}/lib/lean/libleancpp.a DESTINATION lib/lean)
if(${STAGE} EQUAL 0)
add_library(Init STATIC $<TARGET_OBJECTS:stage0>)
add_library(Std STATIC $<TARGET_OBJECTS:stage0>)
else()
# created by the previous stage
add_library(Init STATIC IMPORTED)
set_target_properties(Init PROPERTIES
IMPORTED_LOCATION "${PREV_STAGE}/lib/lean/libInit.a")
add_library(Std STATIC IMPORTED)
set_target_properties(Std PROPERTIES
IMPORTED_LOCATION "${PREV_STAGE}/lib/lean/libStd.a")
endif()
# leancpp and Init are cyclically dependent
target_link_libraries(Init INTERFACE leancpp)
target_link_libraries(leancpp INTERFACE Init ${EXTRA_LIBS})
target_link_libraries(Std INTERFACE leancpp)
target_link_libraries(leancpp INTERFACE Init Std ${EXTRA_LIBS})
if(LLVM)
target_link_libraries(leancpp INTERFACE ${llvm_libs})
@ -551,7 +557,7 @@ endif()
add_custom_target(update-stage0
COMMAND cmake -E env LIB=${CMAKE_BINARY_DIR}/lib bash script/update-stage0
DEPENDS Init
DEPENDS Init Std
WORKING_DIRECTORY "${LIB_SOURCE_DIR}/..")
configure_file("${LEAN_SOURCE_DIR}/bin/leanc.in" "${CMAKE_BINARY_DIR}/bin/leanc" @ONLY)

View file

@ -18,7 +18,7 @@ cflags=("-I$bindir/../include")
ldflags=("-L$bindir/../lib/lean" "-lgmp" @LEANC_EXTRA_FLAGS@)
# static linker flags
# NOTE: libleancpp and libInit are cyclically dependent
ldflags_ext=("-lleancpp" "-lInit" "-lleancpp" "-lInit")
ldflags_ext=("-lleancpp" "-lInit" "-lStd" "-lleancpp" "-lInit" "-lStd")
for arg in "$@"; do
# passed -shared ~> switch to shared linker flags
[[ $arg == "-shared" ]] && ldflags_ext=(@LEANC_SHARED_LINKER_FLAGS@)

View file

@ -1,6 +1,6 @@
add_executable(lean lean.cpp)
set_target_properties(lean PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
target_link_libraries(lean leancpp Init)
target_link_libraries(lean leancpp Init Std)
# create import library on Windows to link plugins against
set_target_properties(lean PROPERTIES ENABLE_EXPORTS ON)