| # This file allows lake to build Lean, Init, and Lake as Lean libraries. | |
| # | |
| # This is the file used when working with the stage0 compiler on the libraries | |
| # | |
| # It is not yet possible to build the compiler and other tooling executables with Lake; to build | |
| # them, please consult the instructions in doc/dev/index.md. | |
| name = "lean4" | |
| bootstrap = true | |
| defaultTargets = ["Init", "Std", "Lean", "LeanExport", "Lake", "LakeMain", "LeanIR", "Leanc", "LeanChecker"] | |
| # Have Lake use CMake's build type (e.g., `Release`, `Debug`) where possible | |
| buildType = "${CMAKE_BUILD_TYPE_TOML}" | |
| # The root of all the compiler output directories | |
| buildDir = "${CMAKE_BINARY_DIR}" | |
| # Enables the Lake artifact cache if configured via CMake | |
| # (i.e., for stage 1 when the CMake `USE_LAKE_CACHE` option is set). | |
| enableArtifactCache = ${LAKE_ARTIFACT_CACHE_TOML} | |
| # Ensure build artifacts end up in the build directory even when the Lake | |
| # local artifact cache is enabled. This is necessary because subsequent stages | |
| # will expect the previous stage's artifacts to be in the build directory. | |
| restoreAllArtifacts = true | |
| # Lean expects its libraries to always have a `lib` prefix | |
| libPrefixOnWindows = true | |
| # The directory of Lean source files (i.e., `src`) | |
| srcDir = "${LEAN_SOURCE_DIR}" | |
| # Destination C files and other intermediate representations | |
| irDir = "lib/temp" | |
| # Destination for olean files | |
| leanLibDir = "lib/lean" | |
| # Destination for static libraries | |
| nativeLibDir = "lib/lean" | |
| # Additional options derived from the CMake configuration | |
| moreLeanArgs = [${LEAN_EXTRA_OPTS_TOML}] | |
| # `lake serve` does not forward `moreLeanArgs` to the language server, so pass them explicitly | |
| moreGlobalServerArgs = [${LEAN_EXTRA_OPTS_TOML}] | |
| # Enable core-only linters | |
| leanOptions.linter.coreInternal = true | |
| leanOptions.linter.redundantVisibility = true | |
| # Uncomment to limit number of reported errors further in case of overwhelming cmdline output | |
| #weakLeanArgs = ["-DmaxErrors=1"] | |
| # CMake's `LEANC_EXTRA_CC_FLAGS` | |
| moreLeancArgs = [${LEAN_MORE_LEANC_ARGS_TOML}] | |
| # CMake's `LEANC_INTERNAL_FLAGS` | |
| weakLeancArgs = [${LEAN_WEAK_LEANC_ARGS_TOML}] | |
| ${LEAN_EXTRA_LAKEFILE_TOML} | |
| [[lean_lib]] | |
| name = "Init" | |
| defaultFacets = ["static", "static.export"] | |
| [[lean_lib]] | |
| name = "Std" | |
| defaultFacets = ["static", "static.export"] | |
| [[lean_lib]] | |
| name = "Lean" | |
| defaultFacets = ["static", "static.export"] | |
| globs = [ | |
| # Library root | |
| "Lean", | |
| # Deliberate orphan file so `import Lean` does not induce an LLVM dependency | |
| "Lean.Compiler.IR.EmitLLVM", | |
| # New compiler orphan file used in tests | |
| "Lean.Compiler.LCNF.Probing", | |
| ] | |
| [[lean_lib]] | |
| name = "LeanExport" | |
| globs = ["LeanExport.*"] | |
| # `Lake` links the parser into `libLake_shared`, so the export facet is required as well | |
| defaultFacets = ["static", "static.export"] | |
| [[lean_lib]] | |
| name = "Lake" | |
| srcDir = "lake" | |
| # Build Lake and all its submodules (which may not be imported elsewhere) | |
| globs = ["Lake.*"] | |
| defaultFacets = ["static", "static.export"] | |
| # Load the previous stage's lake native code into lake's build process in order to prevent ABI | |
| # breakages from affecting bootstrapping. | |
| weakLeanArgs = ["--plugin", "${PREV_STAGE}/${CMAKE_RELATIVE_LIBRARY_OUTPUT_DIRECTORY}/libLake_shared${CMAKE_SHARED_LIBRARY_SUFFIX}=initialize_Lake_All"] | |
| [[lean_lib]] | |
| name = "LakeMain" | |
| srcDir = "lake" | |
| defaultFacets = ["static.export"] | |
| [[lean_lib]] | |
| name = "LeanIR" | |
| libName = "${LAKE_LIB_PREFIX}LeanIR" | |
| defaultFacets = ["static"] | |
| [[lean_lib]] | |
| name = "Leanc" | |
| srcDir = "${CMAKE_BINARY_DIR}/leanc" | |
| defaultFacets = ["static"] | |
| [[lean_lib]] | |
| name = "LeanChecker" | |
| defaultFacets = ["static"] |