Browse Source

Revert "Update CMakeLists, Unit Tests"

This reverts commit 9e6e79a873881656d0cc1c13041a79c709c1903e.
Matt Coburn 5 years ago
parent
commit
538504d546
3 changed files with 3 additions and 51 deletions
  1. 2 32
      CMakeLists.txt
  2. 1 1
      MSBuild/ENetTests/ENetTests.csproj
  3. 0 18
      MSBuild/ENetTests/UnitTests.cs

+ 2 - 32
CMakeLists.txt

@@ -24,17 +24,12 @@ set(ENET_LIB_NAME enet)
 cmake_minimum_required(VERSION 3.1)
 project(${ENET_LIB_NAME} LANGUAGES C)
 
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-set(ENET_MIMALLOC OFF CACHE BOOL "Add mimalloc heap allocators to enet")
-
 set(ENET_DEBUG OFF CACHE BOOL "Do debug things")
 set(ENET_PLUGIN_DIR_BASE "${CMAKE_CURRENT_SOURCE_DIR}/Unity/Plugins")
 set(ENET_PLUGIN_DIR_ARCH "x86_64")
 set(ENET_DEFINES -DENET_NO_PRAGMA_LINK -DENET_DLL)
-set(ENET_LINK_LIBS "")
 set(ENET_DEPS "")
 set(ENET_SRCDIR "Source/Native")
-set(ENET_DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps)
 set(ENET_SRCS
 	${ENET_SRCDIR}/enet.c
 	${ENET_SRCDIR}/enet.h
@@ -45,10 +40,6 @@ if(ENET_DEBUG)
     list(APPEND ENET_DEFINES -DENET_DEBUG)
 endif()
 
-if(NOT EXISTS ${ENET_DEPS_DIR})
-	file(MAKE_DIRECTORY ${ENET_DEPS_DIR})
-endif()
-
 if(MSVC)
 	set(CompilerFlags
         CMAKE_C_FLAGS
@@ -60,33 +51,12 @@ if(MSVC)
 	endforeach()
 
     list(APPEND ENET_DEFINES -D_CRT_SECURE_NO_WARNINGS)
-    list(APPEND ENET_LINK_LIBS Ws2_32 Winmm)
+	list(APPEND ENET_DEPS Ws2_32 Winmm)
 endif()
 
-# mimalloc support
-#
-# build mimalloc
-if(ENET_MIMALLOC)
-    if(NOT EXISTS ${ENET_DEPS_DIR}/mimalloc)
-        execute_process(COMMAND git clone https://github.com/microsoft/mimalloc WORKING_DIRECTORY ${ENET_DEPS_DIR})
-    endif()
-
-    add_custom_target(mimalloc_update
-        COMMAND git checkout master
-        COMMAND git pull
-        WORKING_DIRECTORY ${ENET_DEPS_DIR}/mimalloc
-    )
-
-    include_directories(${ENET_DEPS_DIR}/mimalloc/include)
-    add_subdirectory(${ENET_DEPS_DIR}/mimalloc)
-
-    list(APPEND ENET_DEFINES -DENET_MIMALLOC)
-    list(APPEND ENET_LINK_LIBS mimalloc-static)
-endif(ENET_MIMALLOC)
-
 include_directories(${ENET_SRCDIR})
 add_library(${ENET_LIB_NAME} SHARED ${ENET_SRCS})
-target_link_libraries(${ENET_LIB_NAME} ${ENET_LINK_LIBS})
+target_link_libraries(${ENET_LIB_NAME} ${ENET_DEPS})
 target_compile_definitions(${ENET_LIB_NAME} PRIVATE ${ENET_DEFINES})
 
 set(ENET_PLUGIN_DIR ${ENET_PLUGIN_DIR_BASE}/${ENET_PLUGIN_DIR_ARCH})

+ 1 - 1
MSBuild/ENetTests/ENetTests.csproj

@@ -22,7 +22,7 @@ SOFTWARE.
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp3.0</TargetFramework>
+    <TargetFramework>netcoreapp2.2</TargetFramework>
     <langversion>7.1</langversion>
     <IsPackable>false</IsPackable>
   </PropertyGroup>

+ 0 - 18
MSBuild/ENetTests/UnitTests.cs

@@ -21,7 +21,6 @@
  */
 using NUnit.Framework;
 using System;
-using System.Collections.Generic;
 using System.Net;
 using System.Diagnostics;
 using ENet;
@@ -59,23 +58,6 @@ public class UnitTests
     {
     }
 
-    [Test]
-    public void MallocAndFree()
-    {
-        Stack<IntPtr> allocs = new Stack<IntPtr>();
-        for (int i = 0; i < 1024; i++)
-        {
-            IntPtr alloc = ENet.Library.Malloc(1024);
-            Assert.NotNull(alloc);
-            allocs.Push(alloc);
-        }
-
-        while (allocs.Count > 0)
-        {
-            ENet.Library.Free(allocs.Pop());
-        }
-    }
-
     [Test]
     public void InitAndUninit()
     {