mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Update CMake configuration for easier maintenance (#642)
* Update CMake configuration for easier maintenance * Incorrect casing fix * Move package requirement * Update CTest linking * Add logs to the CMake * Add linking for common libraries Added linking for common libraries in tests subdirectory. * Move test subdirectory higher up for some reason * Whitespace a log removal Missed new line * Add dCommon to dChatFilter * Update library output dir * Correct libBcrypt * Further refactor CMake behaviour * Repair bad comments and update library defines * Revert to old include directory method * Implement platform defines * Add missing include Mac needs a specific include for defining platform. Does not compile without this. Co-authored-by: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com>
This commit is contained in:
26
dCommon/CMakeLists.txt
Normal file
26
dCommon/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
set(DCOMMON_SOURCES "AMFFormat.cpp"
|
||||
"AMFFormat_BitStream.cpp"
|
||||
"BinaryIO.cpp"
|
||||
"dConfig.cpp"
|
||||
"Diagnostics.cpp"
|
||||
"dLogger.cpp"
|
||||
"GeneralUtils.cpp"
|
||||
"LDFFormat.cpp"
|
||||
"MD5.cpp"
|
||||
"Metrics.cpp"
|
||||
"NiPoint3.cpp"
|
||||
"NiQuaternion.cpp"
|
||||
"SHA512.cpp"
|
||||
"Type.cpp"
|
||||
"ZCompression.cpp")
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/dCommon/)
|
||||
|
||||
add_library(dCommon STATIC ${DCOMMON_SOURCES})
|
||||
|
||||
target_link_libraries(dCommon libbcrypt)
|
||||
|
||||
if (UNIX)
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(dCommon ZLIB::ZLIB)
|
||||
endif()
|
@@ -1,5 +1,7 @@
|
||||
#include "ZCompression.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
namespace ZCompression
|
||||
@@ -70,4 +72,6 @@ namespace ZCompression
|
||||
return(nRet); // -1 or len of output
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -2,6 +2,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "dPlatforms.h"
|
||||
|
||||
#ifndef DARKFLAME_PLATFORM_WIN32
|
||||
|
||||
namespace ZCompression
|
||||
{
|
||||
int32_t GetMaxCompressedLength(int32_t nLenSrc);
|
||||
@@ -10,3 +14,5 @@ namespace ZCompression
|
||||
|
||||
int32_t Decompress(const uint8_t* abSrc, int32_t nLenSrc, uint8_t* abDst, int32_t nLenDst, int32_t& nErr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
29
dCommon/dPlatforms.h
Normal file
29
dCommon/dPlatforms.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define DARKFLAME_PLATFORM_WIN32
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
|
||||
#define DARKFLAME_PLATFORM_IOS
|
||||
#elif TARGET_OS_MAC
|
||||
#define DARKFLAME_PLATFORM_MACOS
|
||||
#else
|
||||
#error unknown Apple operating system
|
||||
#endif
|
||||
#elif defined(__unix__)
|
||||
#define DARKFLAME_PLATFORM_UNIX
|
||||
#if defined(__ANDROID__)
|
||||
#define DARKFLAME_PLATFORM_ANDROID
|
||||
#elif defined(__linux__)
|
||||
#define DARKFLAME_PLATFORM_LINUX
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#define DARKFLAME_PLATFORM_FREEBSD
|
||||
#elif defined(__CYGWIN__)
|
||||
#define DARKFLAME_PLATFORM_CYGWIN
|
||||
#else
|
||||
#error unknown unix operating system
|
||||
#endif
|
||||
#else
|
||||
#error unknown operating system
|
||||
#endif
|
Reference in New Issue
Block a user