Skip to content

Commit

Permalink
add enet package
Browse files Browse the repository at this point in the history
  • Loading branch information
wheybags committed Jul 17, 2017
1 parent 00d70c6 commit 2dab396
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ hunter_config(CppNetlib VERSION 0.10.1-hunter-3)
hunter_config(CppNetlibUri VERSION 1.0.4-hunter)
hunter_config(CsvParserCPlusPlus VERSION 1.0.1)
hunter_config(Eigen VERSION 3.3.4-p0)
hunter_config(enet VERSION 1.3.13-p1)
hunter_config(Expat VERSION 2.1.1)
if(MSVC)
hunter_config(getopt VERSION 1.0.0-p0)
Expand Down
27 changes: 27 additions & 0 deletions cmake/projects/enet/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# cmake/projects/Example/hunter.cmake

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

# Load used modules
include(hunter_add_version)
include(hunter_download)
include(hunter_pick_scheme)
include(hunter_cacheable)

# List of versions here...
hunter_add_version(
PACKAGE_NAME
enet
VERSION
"1.3.13-p1"
URL
"https://github.com/hunter-packages/enet/archive/v1.3.13-p1.tar.gz"
SHA1
40f97cc8d5e41f36fab05c9170836fb55d64191e
)

# Pick a download scheme
hunter_pick_scheme(DEFAULT url_sha1_cmake) # use scheme for cmake projects

hunter_cacheable(enet)
hunter_download(PACKAGE_NAME enet)
14 changes: 14 additions & 0 deletions examples/enet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.0)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(example-enet)

hunter_add_package(enet)

find_package(enet CONFIG REQUIRED)

add_executable(example-enet main.c)
target_link_libraries(example-enet enet::enet)
15 changes: 15 additions & 0 deletions examples/enet/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <enet/enet.h>
#include <stdio.h>

int
main (int argc, char ** argv)
{
if (enet_initialize () != 0)
{
fprintf (stderr, "An error occurred while initializing ENet.\n");
return EXIT_FAILURE;
}
atexit (enet_deinitialize);

return 0;
}

0 comments on commit 2dab396

Please sign in to comment.