Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,23 @@ $ cmake -B build -DENET_STATIC=1 -DCMAKE_BUILD_TYPE=Release
$ cmake --build build
```

Or assuming you have enet cloned into `external_libraries` you can use this minimal `CMakeLists.txt` file

```cmake
cmake_minimum_required(VERSION 3.10)

project(mwe_networking)

add_executable(mwe_networking main.cpp)

SET(ENET_STATIC ON CACHE BOOL "" FORCE)

add_subdirectory(external_libraries/enet)
include_directories(external_libraries/enet/include)

target_link_libraries(mwe_networking enet_static)
```

Use it:

```c
Expand All @@ -114,8 +131,12 @@ In this case, library will be embedded to the project itself.

Make sure you add a define for `ENET_IMPLEMENTATION` exactly in one source file before including the `enet.h`.

## Client Server Demo

Here is a simple server and client demo, it will wait 1 second for events, and then exit if none were found:

*Note: here `enet` is being used through the single header include method.*

Server:

```c
Expand Down