Skip to content

Commit

Permalink
Add README on how to run examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderMertens committed Aug 3, 2022
1 parent 7371e68 commit 42271ce
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Examples
This folder contains code examples for the C and C++ APIs.

## Build with cmake
To build the examples with cmake, run the following commands from the root of the repository:

```
cd examples/c
mkdir cmake_build
cd cmake_build
cmake ..
cmake --build .
```

To build the C++ examples, run the same commands from examples/cpp:

```
cd examples/cpp
mkdir cmake_build
cd cmake_build
cmake ..
cmake --build .
```

This will produce two binaries for each example: one that links with a shared Flecs library, and one that is linked with static Flecs library. The binaries linked with the static library have the postfix _static.

To run a single example, execute it from the `cmake_build` directory:

```
./entities_basics_static
```

## Build with bake
To build the examples with bake, run bake once in the root of the repository, so it knows where to find Flecs:

```
bake
```

To run a single example, use the following command:

```
bake run examples/c/entities/basics
```

To run a single example with optimizations enabled, use the following command:

```
bake run examples/c/entities/basics --cfg release
```

To build all examples, run the following command:

```
bake examples
```

See the [bake repository](https://github.com/SanderMertens/bake) for instructions on how to install bake.

0 comments on commit 42271ce

Please sign in to comment.