fix(shell/CMakeLists): mark libleanstatic.a and libleanstdlib.a as cyclically dependent

This commit is contained in:
Sebastian Ullrich 2019-07-26 13:14:31 +02:00
parent 5a1380ec6a
commit e129a65948
5 changed files with 12 additions and 13 deletions

View file

@ -16,4 +16,5 @@ for cxx in $LEAN_CXX @CMAKE_CXX_COMPILER@ /usr/bin/g++; do
fi
done
[ -f $LEAN_CXX ] || command -v $LEAN_CXX || error "no suitable C++ compiler found!"
$LEAN_CXX -std=c++14 -D LEAN_MULTI_THREAD -pthread -fPIC "-I$bindir/../src" "-I$bindir/../include" "$@" "-L$bindir" "-L$bindir/../lib" -lleanstatic -lleanstdlib -lgmp @LEANC_EXTRA_FLAGS@ -Wno-unused-command-line-argument
# NOTE: leanstatic and leanstdlib are cyclically dependent
$LEAN_CXX -std=c++14 -D LEAN_MULTI_THREAD -pthread -fPIC "-I$bindir/../src" "-I$bindir/../include" "$@" "-L$bindir" "-L$bindir/../lib" -lleanstatic -lleanstdlib -lleanstatic -lleanstdlib -lgmp @LEANC_EXTRA_FLAGS@ -Wno-unused-command-line-argument

View file

@ -457,13 +457,13 @@ add_library(leanstatic_stage0 ${LEAN_LIBRARY_TYPE} ${LEAN_OBJS} $<TARGET_OBJECTS
target_link_libraries(leanstatic_stage0 ${EXTRA_LIBS})
add_library(leanstatic ${LEAN_LIBRARY_TYPE} ${LEAN_OBJS})
target_link_libraries(leanstatic "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a" ${EXTRA_LIBS})
add_dependencies(leanstatic stdlib)
add_library(leanstdlib STATIC IMPORTED)
target_link_libraries(leanstatic leanstdlib ${EXTRA_LIBS})
ADD_CUSTOM_TARGET(bin_lib ALL
COMMAND "${CMAKE_COMMAND}" -E make_directory "${LEAN_SOURCE_DIR}/../bin"
COMMAND "${CMAKE_COMMAND}" -E copy ${COPY_LIBS} "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a" "${CMAKE_CURRENT_BINARY_DIR}/libleanstatic.a" "${LEAN_SOURCE_DIR}/../bin"
DEPENDS leanstatic
COMMAND "${CMAKE_COMMAND}" -E copy ${COPY_LIBS} "$<TARGET_FILE:leanstdlib>" "$<TARGET_FILE:leanstatic>" "${LEAN_SOURCE_DIR}/../bin"
DEPENDS leanstatic leanstdlib
)
# Configure leanc
configure_file("${LEAN_SOURCE_DIR}/../bin/leanc.in" "${CMAKE_CURRENT_BINARY_DIR}/tmp/leanc")

View file

@ -10,7 +10,6 @@ Author: Leonardo de Moura
#include "runtime/thread.h"
#include "runtime/object.h"
#include "runtime/io.h"
#include "runtime/platform.h"
namespace lean {
void initialize_runtime_module() {
@ -20,10 +19,8 @@ void initialize_runtime_module() {
initialize_io();
initialize_serializer();
initialize_thread();
initialize_platform();
}
void finalize_runtime_module() {
finalize_platform();
finalize_thread();
finalize_serializer();
finalize_io();

View file

@ -22,7 +22,4 @@ extern "C" uint8 lean_system_platform_windows(obj_arg) {
return 0;
#endif
}
void initialize_platform() {}
void finalize_platform() {}
}

View file

@ -18,13 +18,17 @@ else()
set(LEANC_OPTS "-g")
endif()
add_custom_target(stdlib
add_custom_target(make_stdlib
# '-G Ninja' complains otherwise
BYPRODUCTS "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a"
WORKING_DIRECTORY "${LEAN_SOURCE_DIR}/../library"
COMMAND ${CMAKE_COMMAND} -E env "LEAN_PATH=." make -j8 "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a" "LEAN=$<TARGET_FILE:lean_stage0>" "LEANC_OPTS=${LEANC_OPTS}" "STAGE1_OUT=${CMAKE_BINARY_DIR}/stage1"
DEPENDS lean_stage0)
install(FILES "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a" DESTINATION lib)
set_target_properties(leanstdlib PROPERTIES
IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a"
IMPORTED_LINK_INTERFACE_LIBRARIES leanstatic)
add_dependencies(leanstdlib make_stdlib)
install(FILES "$<TARGET_FILE:leanstdlib>" DESTINATION lib)
add_custom_target(update-stage0
COMMAND make update-stage0 "STAGE1_OUT=${CMAKE_BINARY_DIR}/stage1"