[ENet-discuss] Creating a dynamic enet dll on Windows

Edgar Reynaldo edgarreynaldo at members.allegro.cc
Mon Feb 6 00:21:02 PST 2017


Hello fellow enet users and developers,

I made a patch to create a dynamic enet dll on windows with either MinGW 
or MSVC using CMake. I edited CMakeLists.txt to do so. The patch is 
attached if anyone is interested. If this is the wrong mailing list 
please direct me where to go.

If there are any changes you would like me to make, please let me know. 
I'm aware that it doesn't support *NIX or OSX at this point. If anyone 
wants to contribute that part of it I would appreciate it. All you 
should really have to do is set target_link_libraries to the appropriate 
libraries for networking on that platform under the compiler check 
section at the bottom of CMakeLists.txt.

Thanks for your time,
Edgar




-------------- next part --------------
--- enet-1.3.13\CMakeLists.old.txt	2015-04-30 08:42:08.000000000 -0500
+++ enet-1.3.13\CMakeLists.txt	2017-02-06 01:55:49.437132600 -0600
@@ -44,7 +44,7 @@
  
 include_directories(${PROJECT_SOURCE_DIR}/include)
  
-add_library(enet STATIC
+add_library(enet_static STATIC
         callbacks.c
         compress.c
         host.c
@@ -55,3 +55,22 @@
         unix.c
         win32.c
     )
+
+add_library(enet SHARED
+        callbacks.c
+        compress.c
+        host.c
+        list.c
+        packet.c
+        peer.c
+        protocol.c
+        unix.c
+        win32.c
+    )
+
+if(MINGW)
+   target_link_libraries(enet libws2_32.a libwinmm.a)
+elseif(MSVC)
+   target_link_libraries(enet libws2_32.lib libwinmm.lib)
+endif (MINGW)
+


More information about the ENet-discuss mailing list