Skip to content

Commit edcbfc9

Browse files
authored
Merge pull request #9 from DragonRuby/alexdenisov/add-some-docs
Update docs to include a hello-world example
2 parents beb0f8b + 2ab442a commit edcbfc9

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

README.md

+32-13
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,58 @@ Simplified version of Firestorm targeting C instead of machine code directly.
44

55
# Local Build Setup
66

7-
Brew:
7+
### Install Dependencies
8+
9+
You need `ninja`, `cmake` (at least 3.28) and `llvm` 19.
10+
11+
On macOS:
812

913
```bash
10-
brew install ninja cmake ccache hyperfine llvm@19
14+
brew install ninja cmake hyperfine llvm@19
1115
```
1216

13-
Get the sources
17+
On Ubuntu 24.04:
1418

1519
```bash
16-
git clone [email protected]:DragonRuby/lightstorm.git --recursive
20+
sudo apt-get install ninja-build cmake
1721
```
1822

19-
Create toolchain dir
23+
To install LLVM 19 follow the instructions [here](https://apt.llvm.org).
24+
25+
### Checkout
2026

2127
```bash
22-
sudo mkdir /opt/lightstorm.toolchain.dir
23-
sudo chown `whoami` /opt/lightstorm.toolchain.dir
28+
git clone [email protected]:DragonRuby/lightstorm.git --recursive
2429
```
2530

26-
Build lightstorm
31+
### Build & install
2732

2833
```bash
29-
mkdir lightstorm-build; cd lightstorm-build
30-
cmake -G Ninja -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/llvm@19/ \
31-
-DCMAKE_INSTALL_PREFIX=/opt/lightstorm.toolchain.dir/lightstorm \
32-
../lightstorm
34+
# On Ubuntu
35+
cmake --workflow --preset lightstorm-ubuntu-install
36+
# On macOS
37+
cmake --workflow --preset lightstorm-macos-install
38+
```
39+
40+
# Build "Hello World"
3341

34-
ninja
42+
```bash
43+
> echo 'puts "Hello, Lightstorm"' > hello.rb
44+
> ./install.dir/bin/lightstorm hello.rb -o hello.rb.c
45+
> clang hello.rb.c -o hello_lightstorm \
46+
-L./install.dir/lib/ \
47+
-isystem./third_party/mruby/include -isystem./third_party/mruby/build/host/include/ \
48+
-llightstorm_runtime_main -llightstorm_mruby -lm
49+
> ./hello_lightstorm
50+
Hello, Lightstorm
3551
```
3652

53+
# Build and run tests
54+
3755
Build a test (`tests/integration/loads.rb`):
3856

3957
```bash
58+
> cd build.dir
4059
> ninja loads.rb.exe
4160
> ../lightstorm/tests/integration/Output/loads.rb.tmp.exe
4261
1

0 commit comments

Comments
 (0)