Skip to content

Commit

Permalink
Refactor examples build process
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraVoves committed Apr 14, 2024
1 parent ae03204 commit 57c249f
Show file tree
Hide file tree
Showing 16 changed files with 251 additions and 239 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ jobs:
with:
version: ${{ steps.zigversion.outputs.content }}

- name: Build example 00
- name: Build examples
shell: bash
run: cd examples/00-minimal && zig build
- name: Build example 01
shell: bash
run: cd examples/01-zgui && zig build
- name: Build example 02
shell: bash
run: cd examples/02-runtime-shaderc && zig build
- name: Build example 03
shell: bash
run: cd examples/03-debugdraw && zig build
run: cd examples/ && zig build
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,36 @@ See examples for binding usage and [bgfx](https://github.com/bkaradzic/bgfx) for

## Build options

| Build option | Default | Description |
|-----------------------|---------|------------------------------------------------------|
| `imgui_include` | `null` | Path to ImGui includes (need for imgui bgfx backend) |
| `multithread` | `true` | Compile with BGFX_CONFIG_MULTITHREAD |
| `with_shaderc` | `true` | Compile with shaderc executable |
| `with_static_shaderc` | `true` | Compile with shaderc as static lib |
| Build option | Default | Description |
|-----------------|---------|------------------------------------------------------|
| `imgui_include` | `null` | Path to ImGui includes (need for imgui bgfx backend) |
| `multithread` | `true` | Compile with BGFX_CONFIG_MULTITHREAD |
| `with_shaderc` | `true` | Compile with `shaderc` |

## Examples

Examples use [zig-gamedev](https://github.com/zig-gamedev/zig-gamedev) as submodule.
Run this:

Run this to fetch `zig-gamedev`:

```bash
git submodule update --init --depth=1
```

And this for build all examples:

```sh
cd examples
zig build
```

### [00-Minimal](examples/00-minimal/)

Minimal setup with GLFW for window and input.

```sh
cd examples/00-minimal
zig build
zig-out/bin/minimal
cd examples
zig-out/bin/00-minimal
```

| Key | Description |
Expand All @@ -101,9 +107,8 @@ zig-out/bin/minimal
Minimal setup for zgui/ImGui.

```sh
cd examples/01-zgui
zig build
zig-out/bin/zgui
cd examples
zig-out/bin/01-zgui
```

| Key | Description |
Expand All @@ -117,9 +122,8 @@ Basic usage of shader compile in runtime.
Try edit shaders in `zig-out/bin/shaders` and hit `r` to recompile.

```sh
cd examples/02-runtime-shaderc
zig build
zig-out/bin/runtime-shaderc
cd examples
zig-out/bin/02-runtime-shaderc
```

| Key | Description |
Expand All @@ -133,15 +137,14 @@ zig-out/bin/runtime-shaderc
DebugDraw api usage example.

```sh
cd examples/03-debugdraw
zig build
zig-out/bin/runtime-shaderc
cd examples
zig-out/bin/03-debugdraw
```

| Key | Description |
|-----|-----------------------------|
| `v` | Vsync on/off |
| `d` | Debug on/off |
| Key | Description |
|-----|--------------|
| `v` | Vsync on/off |
| `d` | Debug on/off |

## License

Expand Down
Loading

0 comments on commit 57c249f

Please sign in to comment.