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

Edgar Reynaldo edgarreynaldo at members.allegro.cc
Mon Feb 6 01:24:51 PST 2017


Here's an updated patch that defines ENET_DLL when building the shared 
library.

On 2/6/2017 2:25 AM, Edgar Reynaldo wrote:
>
> It looks like I forgot to add -DENET_DLL to the CFLAGS variable. Let 
> me update my patch and then I'll post it again.
>
>
> On 2/6/2017 2:21 AM, Edgar Reynaldo wrote:
>> 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 02:48:10.158535100 -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,24 @@
         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
+    )
+
+set_target_properties(enet PROPERTIES DEFINE_SYMBOL ENET_DLL)
+    
+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