Installation
Best way to get Swirl currently is to build it from source.
Prerequisites
To build Swirl from source, you need the following prerequisites:
- Git
- C++ compiler (e.g.,
g++
orclang++
)- Make sure it supports C++23
- CMake (version 3.20 or higher)
- LLVM Development libraries (version 17 or higher)
Linux
- Ubuntu
- Fedora
- Arch Linux
Update packages:
sudo apt update && sudo apt upgrade -y
Install the required packages:
sudo apt install git cmake clang llvm-dev
Update packages:
sudo dnf update -y
Install the required packages:
sudo dnf install git cmake clang llvm-devel
Update packages:
sudo pacman -Syu
Install the required packages:
sudo pacman -S git cmake clang llvm
MacOS
Install the required packages:
brew install git cmake llvm
After installing LLVM you need to add LLVM binaries and libraries to your PATH.
- Zsh
- Bash
- Fish
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc && \
echo 'export LLVM_DIR="/usr/local/opt/llvm/lib/cmake/llvm"' >> ~/.zshrc
source ~/.zshrc
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.bashrc && \
echo 'export LLVM_DIR="/usr/local/opt/llvm/lib/cmake/llvm"' >> ~/.bashrc
source ~/.bashrc
fish_add_path /usr/local/opt/llvm/bin &&
set -Ux LLVM_DIR /usr/local/opt/llvm/lib/cmake/llvm
Windows
To build Swirl on Windows, you can use the Windows Subsystem for Linux (WSL) and follow the Linux instructions above.
Building
Clone the repository and navigate into it:
git clone https://github.com/swirllang/swirl.git
cd swirl
Generate the build files:
cmake -B build -S .
Build the project:
cmake --build build --config Release
The Swirl binary will be located in the build
directory.
Running
To run Swirl, you can use the following command:
./build/swirl
Dev setup
To get the best experience building Swirl, we recommend using Visual Studio Code with the following extensions: