Browse Source

Update to match NX's latest repo commit

Matthew Coburn 6 years ago
parent
commit
bdb0e24221
3 changed files with 14 additions and 5 deletions
  1. 7 2
      Source/Native/CMakeLists.txt
  2. 2 2
      Source/Native/enet.h
  3. 5 1
      Source/Native/jni/Android.mk

+ 7 - 2
Source/Native/CMakeLists.txt

@@ -1,18 +1,23 @@
 cmake_minimum_required(VERSION 2.6)
 project(enet C)
 
+set(ENET_DEBUG "0" CACHE BOOL "Enable debug functionality")
 set(ENET_STATIC "0" CACHE BOOL "Create a static library")
 set(ENET_SHARED "0" CACHE BOOL "Create a shared library")
 set(ENET_LZ4 "0" CACHE BOOL "Add support for an optional packet-level compression")
 
 if (MSVC)
-	add_definitions(-W3)
+    add_definitions(-W3)
 else()
-	add_definitions(-Wno-error)
+    add_definitions(-Wno-error)
 endif()
 
 include_directories(${PROJECT_SOURCE_DIR})
 
+if (ENET_DEBUG)
+    add_definitions(-DENET_DEBUG)
+endif()
+
 if (ENET_LZ4)
     add_definitions(-DENET_LZ4)
     set(SOURCES lz4/lz4.c)

+ 2 - 2
Source/Native/enet.h

@@ -2749,7 +2749,7 @@ extern "C" {
 							host->headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED;
 							shouldCompress     = compressedSize;
 
-							#ifdef ENET_DEBUG_COMPRESS
+							#ifdef ENET_DEBUG
 								printf("peer %u: compressed %u->%u (%u%%)\n", currentPeer->incomingPeerID, originalSize, compressedSize, (compressedSize * 100) / originalSize);
 							#endif
 						}
@@ -5084,4 +5084,4 @@ extern "C" {
 }
 #endif
 #endif
-#endif
+#endif

+ 5 - 1
Source/Native/jni/Android.mk

@@ -4,6 +4,10 @@ include $(CLEAR_VARS)
 LOCAL_MODULE    := libenet
 LOCAL_SRC_FILES := ..\enet.c
 
+ifdef ENET_DEBUG
+	LOCAL_CFLAGS += -DENET_DEBUG
+endif
+
 ifdef ENET_LZ4
 	LOCAL_CFLAGS += -DENET_LZ4
 	LOCAL_SRC_FILES += ..\lz4\lz4.c
@@ -13,4 +17,4 @@ ifdef ENET_STATIC
 	include $(BUILD_STATIC_LIBRARY)
 else
 	include $(BUILD_SHARED_LIBRARY)
-endif
+endif