Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,58 @@ Simplified version of Firestorm targeting C instead of machine code directly.

# Local Build Setup

Brew:
### Install Dependencies

You need `ninja`, `cmake` (at least 3.28) and `llvm` 19.

On macOS:

```bash
brew install ninja cmake ccache hyperfine llvm@19
brew install ninja cmake hyperfine llvm@19
```

Get the sources
On Ubuntu 24.04:

```bash
git clone [email protected]:DragonRuby/lightstorm.git --recursive
sudo apt-get install ninja-build cmake
```

Create toolchain dir
To install LLVM 19 follow the instructions [here](https://apt.llvm.org).

### Checkout

```bash
sudo mkdir /opt/lightstorm.toolchain.dir
sudo chown `whoami` /opt/lightstorm.toolchain.dir
git clone [email protected]:DragonRuby/lightstorm.git --recursive
```

Build lightstorm
### Build & install

```bash
mkdir lightstorm-build; cd lightstorm-build
cmake -G Ninja -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/llvm@19/ \
-DCMAKE_INSTALL_PREFIX=/opt/lightstorm.toolchain.dir/lightstorm \
../lightstorm
# On Ubuntu
cmake --workflow --preset lightstorm-ubuntu-install
# On macOS
cmake --workflow --preset lightstorm-macos-install
```

# Build "Hello World"

ninja
```bash
> echo 'puts "Hello, Lightstorm"' > hello.rb
> ./install.dir/bin/lightstorm hello.rb -o hello.rb.c
> clang hello.rb.c -o hello_lightstorm \
-L./install.dir/lib/ \
-isystem./third_party/mruby/include -isystem./third_party/mruby/build/host/include/ \
-llightstorm_runtime_main -llightstorm_mruby -lm
> ./hello_lightstorm
Hello, Lightstorm
```

# Build and run tests

Build a test (`tests/integration/loads.rb`):

```bash
> cd build.dir
> ninja loads.rb.exe
> ../lightstorm/tests/integration/Output/loads.rb.tmp.exe
1
Expand Down