Add zig buildfile for examples. (#2051)

* Add zig buildfile for examples.

- `zig build` to compile all examples
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)

You can use `-Dtarget=` to compile for a non-native platform, such as
`zig build -Dtarget=x86_64-windows-gnu` to compile from Linux to
Windows.

* Skip pthread example on Windows.

* Select appropriate lib file based on target.
This commit is contained in:
Ryan Roden-Corrent 2021-10-14 07:24:00 -04:00 committed by GitHub
parent 52c1a4e7d0
commit 588131c9d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 0 deletions

View file

@ -1,3 +1,21 @@
## Building the Examples
The examples assume you have already built the `raylib` library in `../src`.
### With GNU make
- `make` builds all examples
- `make [module]` builds all examples for a particular module (e.g `make core`)
### With Zig
The [Zig](https://ziglang.org/) toolchain can compile `C` and `C++` in addition to `Zig`.
You may find it easier to use than other toolchains, especially when it comes to cross-compiling.
- `zig build` to compile all examples
- `zig build [module]` to compile all examples for a module (e.g. `zig build core`)
- `zig build [example]` to compile _and run_ a particular example (e.g. `zig build core_basic_window`)
## EXAMPLES LIST
### category: core