From 07e38f3d12ea1f1f68fcf70cf32782e4d15a33e9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 23 Sep 2019 08:40:02 +0200 Subject: [PATCH] - made enet a separate library. --- CMakeLists.txt | 2 ++ libraries/enet/CMakeLists.txt | 24 +++++++++++++++++++ {source => libraries}/enet/LICENSE | 0 .../enet/src => libraries/enet}/callbacks.c | 0 .../enet/src => libraries/enet}/compress.c | 0 .../enet}/enet/callbacks.h | 0 .../include => libraries/enet}/enet/enet.h | 0 .../include => libraries/enet}/enet/list.h | 0 .../enet}/enet/protocol.h | 0 .../include => libraries/enet}/enet/time.h | 0 .../include => libraries/enet}/enet/types.h | 0 .../include => libraries/enet}/enet/unix.h | 0 .../include => libraries/enet}/enet/utility.h | 0 .../include => libraries/enet}/enet/win32.h | 0 {source/enet/src => libraries/enet}/host.c | 0 {source/enet/src => libraries/enet}/list.c | 0 {source/enet/src => libraries/enet}/packet.c | 0 {source/enet/src => libraries/enet}/peer.c | 0 .../enet/src => libraries/enet}/protocol.c | 0 {source/enet/src => libraries/enet}/unix.c | 0 {source/enet/src => libraries/enet}/win32.c | 0 source/CMakeLists.txt | 23 ++++-------------- 22 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 libraries/enet/CMakeLists.txt rename {source => libraries}/enet/LICENSE (100%) rename {source/enet/src => libraries/enet}/callbacks.c (100%) rename {source/enet/src => libraries/enet}/compress.c (100%) rename {source/enet/include => libraries/enet}/enet/callbacks.h (100%) rename {source/enet/include => libraries/enet}/enet/enet.h (100%) rename {source/enet/include => libraries/enet}/enet/list.h (100%) rename {source/enet/include => libraries/enet}/enet/protocol.h (100%) rename {source/enet/include => libraries/enet}/enet/time.h (100%) rename {source/enet/include => libraries/enet}/enet/types.h (100%) rename {source/enet/include => libraries/enet}/enet/unix.h (100%) rename {source/enet/include => libraries/enet}/enet/utility.h (100%) rename {source/enet/include => libraries/enet}/enet/win32.h (100%) rename {source/enet/src => libraries/enet}/host.c (100%) rename {source/enet/src => libraries/enet}/list.c (100%) rename {source/enet/src => libraries/enet}/packet.c (100%) rename {source/enet/src => libraries/enet}/peer.c (100%) rename {source/enet/src => libraries/enet}/protocol.c (100%) rename {source/enet/src => libraries/enet}/unix.c (100%) rename {source/enet/src => libraries/enet}/win32.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9645d3db9..da54ed65c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,6 +391,7 @@ else() endif() set( LZMA_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/lzma/C" ) +set( ENET_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libraries/enet" ) if( NOT CMAKE_CROSSCOMPILING ) if( NOT CROSS_EXPORTS ) @@ -412,6 +413,7 @@ add_subdirectory( libraries/lzma ) add_subdirectory( tools ) add_subdirectory( libraries/dumb ) add_subdirectory( libraries/gdtoa ) +add_subdirectory( libraries/enet ) #add_subdirectory( wadsrc ) add_subdirectory( source ) diff --git a/libraries/enet/CMakeLists.txt b/libraries/enet/CMakeLists.txt new file mode 100644 index 000000000..176361b3c --- /dev/null +++ b/libraries/enet/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required( VERSION 2.8.7 ) + +make_release_only() + +if( DEM_CMAKE_COMPILER_IS_GNUC_COMPATIBLE ) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -fomit-frame-pointer" ) +endif() + +if (MSVC) + set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4244 /wd4018 /wd4267" ) # this code throws a lot of warnings. +endif() + +add_library( enet STATIC + callbacks.c + compress.c + host.c + list.c + packet.c + peer.c + protocol.c + unix.c # This and the next one are platform safe! + win32.c + ) +target_link_libraries( enet ) diff --git a/source/enet/LICENSE b/libraries/enet/LICENSE similarity index 100% rename from source/enet/LICENSE rename to libraries/enet/LICENSE diff --git a/source/enet/src/callbacks.c b/libraries/enet/callbacks.c similarity index 100% rename from source/enet/src/callbacks.c rename to libraries/enet/callbacks.c diff --git a/source/enet/src/compress.c b/libraries/enet/compress.c similarity index 100% rename from source/enet/src/compress.c rename to libraries/enet/compress.c diff --git a/source/enet/include/enet/callbacks.h b/libraries/enet/enet/callbacks.h similarity index 100% rename from source/enet/include/enet/callbacks.h rename to libraries/enet/enet/callbacks.h diff --git a/source/enet/include/enet/enet.h b/libraries/enet/enet/enet.h similarity index 100% rename from source/enet/include/enet/enet.h rename to libraries/enet/enet/enet.h diff --git a/source/enet/include/enet/list.h b/libraries/enet/enet/list.h similarity index 100% rename from source/enet/include/enet/list.h rename to libraries/enet/enet/list.h diff --git a/source/enet/include/enet/protocol.h b/libraries/enet/enet/protocol.h similarity index 100% rename from source/enet/include/enet/protocol.h rename to libraries/enet/enet/protocol.h diff --git a/source/enet/include/enet/time.h b/libraries/enet/enet/time.h similarity index 100% rename from source/enet/include/enet/time.h rename to libraries/enet/enet/time.h diff --git a/source/enet/include/enet/types.h b/libraries/enet/enet/types.h similarity index 100% rename from source/enet/include/enet/types.h rename to libraries/enet/enet/types.h diff --git a/source/enet/include/enet/unix.h b/libraries/enet/enet/unix.h similarity index 100% rename from source/enet/include/enet/unix.h rename to libraries/enet/enet/unix.h diff --git a/source/enet/include/enet/utility.h b/libraries/enet/enet/utility.h similarity index 100% rename from source/enet/include/enet/utility.h rename to libraries/enet/enet/utility.h diff --git a/source/enet/include/enet/win32.h b/libraries/enet/enet/win32.h similarity index 100% rename from source/enet/include/enet/win32.h rename to libraries/enet/enet/win32.h diff --git a/source/enet/src/host.c b/libraries/enet/host.c similarity index 100% rename from source/enet/src/host.c rename to libraries/enet/host.c diff --git a/source/enet/src/list.c b/libraries/enet/list.c similarity index 100% rename from source/enet/src/list.c rename to libraries/enet/list.c diff --git a/source/enet/src/packet.c b/libraries/enet/packet.c similarity index 100% rename from source/enet/src/packet.c rename to libraries/enet/packet.c diff --git a/source/enet/src/peer.c b/libraries/enet/peer.c similarity index 100% rename from source/enet/src/peer.c rename to libraries/enet/peer.c diff --git a/source/enet/src/protocol.c b/libraries/enet/protocol.c similarity index 100% rename from source/enet/src/protocol.c rename to libraries/enet/protocol.c diff --git a/source/enet/src/unix.c b/libraries/enet/unix.c similarity index 100% rename from source/enet/src/unix.c rename to libraries/enet/unix.c diff --git a/source/enet/src/win32.c b/libraries/enet/win32.c similarity index 100% rename from source/enet/src/win32.c rename to libraries/enet/win32.c diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index adf504d69..20a962dbe 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -506,9 +506,9 @@ endif() # Ugh... These precompiled dependencies need to go. if (WIN32) - include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include/vpx" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include/sdl2") + include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ENET_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include/vpx" "${CMAKE_CURRENT_SOURCE_DIR}/../platform/windows/include/sdl2") else () -include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" ) +include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GME_INCLUDE_DIR}" "${ENET_INCLUDE_DIR}") endif() @@ -667,7 +667,6 @@ file( GLOB HEADER_FILES audiolib/src/*.h blood/src/*.h build/include/*.h - enet/include/enet/*.h glad/include/glad/*.h glad/include/Khr/*.h glbackend/*.h @@ -701,16 +700,6 @@ set( NOT_COMPILED_SOURCE_FILES # Enable fast math for some sources where performance matters (or where the PCH must not be used.) (This would be good for rendering code, but unfortunately that is hopelessly intermingled with the playsim code in engine.cpp.) set( FASTMATH_SOURCES - # This should better be made a library subproject later, once things are working. - enet/src/callbacks.c - enet/src/compress.c - enet/src/host.c - enet/src/list.c - enet/src/packet.c - enet/src/peer.c - enet/src/protocol.c - enet/src/unix.c # This and the next one are platform safe! - enet/src/win32.c # This should better be made a library subproject later, once things are working. libsmackerdec/src/BitReader.cpp @@ -1015,13 +1004,12 @@ if( UNIX ) endif() endif() -target_link_libraries( demolition ${DEMOLITION_LIBS} gdtoa dumb lzma ) +target_link_libraries( demolition ${DEMOLITION_LIBS} enet gdtoa dumb lzma ) include_directories( build/include mact/include audiolib/include - enet/include glad/include libxmp-lite/include libxmp-lite/include/libxmp-lite @@ -1029,6 +1017,8 @@ include_directories( thirdparty/include ${CMAKE_BINARY_DIR}/libraries/gdtoa + ${CMAKE_BINARY_DIR}/libraries/enet + #${SYSTEM_SOURCES_DIR} ) @@ -1126,9 +1116,6 @@ install(TARGETS demolition source_group("Utility\\Audiolib" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/audiolib/.+") source_group("Utility\\Audiolib Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/audiolib/include/.+") source_group("Utility\\Audiolib Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/audiolib/src/.+") -source_group("Utility\\ENet" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/enet/.+") -source_group("Utility\\ENet Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/enet/include/enet/.+") -source_group("Utility\\ENet Sources" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/enet/src/.+") source_group("Utility\\Glad" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/glad/.+") source_group("Utility\\Glad Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/glad/include/glad/.+") source_group("Utility\\Glad Khr Headers" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/glad/include/Khr/.+")