The included CMakeLists.txt at the top level of the project provides cross-platform build rules for auto-bootstrapping the compiler all the way to stage 3.
For reference, the stages:
Stage 0: The bootstrap compiler. This compiler, written in autogenerated C++ is able to parse Jakt source code and output C++ code.
Stage 1: Jakt selfhost compiler. This compiler, written in Jakt, is compiled with the Stage 0 compiler and outputs C++.
Stage 2: Jakt selfhost compiler. This is the same Jakt source code as the Stage 1 compiler, but compiled with the Stage 1 compiler. It outputs C++.
All the stages are compiled with the provided CMAKE_CXX_COMPILER.
Provide a suitable CMake invocation. Note that a clang version >= 13 is required.
cmake -B build -GNinja -DCMAKE_CXX_COMPILER=clang++-14
Invoke the specified generator
cmake --build build
# OR
ninja -C build
If you want to install the compilers to a location of your choice, provide an install prefix at your favorite location.
cmake -B build -GNinja -DCMAKE_CXX_COMPILER=clang++-14 -DCMAKE_INSTALL_PREFIX=jakt-install
ninja -C build install
If you want to enable optimizations, be sure to set CMAKE_BUILD_TYPE.
The CMakeLists have an option for what the final stage of the compiler should be, that defaults to stage 1. If you want to build the stage 2 compiler
for validation, set the CMake cache variable FINAL_STAGE
to 2
.
Jakt is known to compile with clang >=13 on Linux, macOS and Windows. g++ also works, provided the version is >=10.2.
MSVC is not supported, however clang-cl.exe and clang.exe do work and clang-cl is used in CI.
On MSYS2, g++ may error out with a "string table overflow" error. In that case, re-configure the build directory with -DCMAKE_BUILD_TYPE=MinSizeRel to get the -Os flag. Do note that using WSL2 or clang directly on windows is a more supported build platform. Maintainers will be reluctant to merge runtime or jakttest patches for MSYS2 quirks to keep the number of supported platfoms under control.