chore(shell/CMakeLists): add bin_lean_stage0 target

This commit is contained in:
Sebastian Ullrich 2019-03-21 12:50:17 +01:00
parent beae045ebc
commit 0279d29741
2 changed files with 9 additions and 1 deletions

View file

@ -97,7 +97,10 @@ Development Workflows
C++ change. The `lean` target can be used to build the same binary without copying
it to `bin/`, which can be useful for quickly building a debug version without
changing the binary used by the editor. The `LEAN_PATH` variable may need to be set
to the location of `library/` manually in this case.
to the location of `library/` manually in this case. Conversely, if you did a C++
change but the stdlib fails to build, you can use the `bin_lean_stage0` target to
temporarily use `lean_stage0` as `bin/lean` so that you can fix the stdlib in your
editor.
* When making a parallel change in both Lean and C++, there usually is no simple
way of writing C++ code that builds in both stage0 and stage1. In this case,
temporarily set `-DREBUILD_STAGE0=OFF` to deactivate rebuilding `lean_stage0`,

View file

@ -6,6 +6,11 @@ else()
set_target_properties(lean_stage0 PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lean_stage0")
endif()
ADD_CUSTOM_TARGET(bin_lean_stage0 ALL
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$<TARGET_FILE:lean_stage0>" "${LEAN_SOURCE_DIR}/../bin/lean"
DEPENDS lean_stage0
)
add_custom_target(stdlib
# '-G Ninja' complains otherwise
BYPRODUCTS "${CMAKE_BINARY_DIR}/stage1/libleanstdlib.a"