diff --git a/cmake/Modules/FindENet.cmake b/cmake/Modules/FindENet.cmake new file mode 100644 index 0000000000000000000000000000000000000000..3228aadb68b4e61c45a58ae276b9092f51cf35d3 --- /dev/null +++ b/cmake/Modules/FindENet.cmake @@ -0,0 +1,34 @@ +# Find ENet +# Once done, this will define +# +# ENET_FOUND - system has SDL2 +# ENET_INCLUDE_DIRS - SDL2 include directories +# ENET_LIBRARIES - link libraries + +include(LibFindMacros) + +libfind_pkg_check_modules(ENET_PKGCONF ENET) + +# includes +find_path(ENET_INCLUDE_DIR + NAMES enet.h + PATHS + ${ENET_PKGCONF_INCLUDE_DIRS} + "/usr/include/enet" + "/usr/local/include/enet" +) + +# library +find_library(ENET_LIBRARY + NAMES libenet + PATHS + ${ENET_PKGCONF_LIBRARY_DIRS} + "/usr/lib" + "/usr/local/lib" +) + + +# set include dir variables +set(ENET_PROCESS_INCLUDES ENET_INCLUDE_DIR) +set(ENET_PROCESS_LIBS ENET_LIBRARY) +libfind_process(ENET) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 716cf6cf848f4f2c8c2e70bbef30a18a66996141..1eee89b968c164e5fb2caa0e2987f8021c64d9bb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -404,6 +404,8 @@ else() add_definitions(-DNOASM -DNONX86) endif() +find_package(ENet) + # Targets # Compatibility flag with later versions of GCC diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index b3fa5390c50a748d60e87920073f46f5c28ff117..abbd5f2842f416335487f7385e018743dc517414 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -125,6 +125,7 @@ if(${SDL2_FOUND}) ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} + ${ENET_LIBRARIES} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "Sonic Robo Blast 2") else() @@ -134,6 +135,7 @@ if(${SDL2_FOUND}) ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} + ${ENET_LIBRARIES} ) if(${CMAKE_SYSTEM} MATCHES Linux) @@ -201,6 +203,7 @@ if(${SDL2_FOUND}) ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} + ${ENET_INCLUDE_DIRS} ) if(${SRB2_HAVE_MIXER})