Skip to content

Commit

Permalink
* Modify the MinGW makefile slightly to allow compilation for earlier…
Browse files Browse the repository at this point in the history
… Windows versions
  • Loading branch information
iProgramMC committed May 19, 2024
1 parent f0d65ea commit e2ba9e1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MakefileMinGW
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ TGL_DIR=thirdparty/GL
TARGET=minecraftcpp.exe

# Compilation flags for C++ source files
CXXFLAGS=-Isource -I. -Ithirdparty/raknet -Ithirdparty/zlib -DUSE_MATH_DEFINES -DSHA1_HAS_TCHAR -DHANDLE_CHARS_SEPARATELY -DUSE_WIN32_THREADS -DNDEBUG -O3 -MMD $(VBO_EMULATION_FLAG)
CXXFLAGS=-Isource -I. -Ithirdparty/raknet -Ithirdparty/zlib -DUSE_MATH_DEFINES -DSHA1_HAS_TCHAR -DHANDLE_CHARS_SEPARATELY -DUSE_WIN32_THREADS -DLOCKLESS_TYPES_USE_MUTEX -DNDEBUG -O3 -mno-sse -mno-sse2 -mno-mmx -march=i386 -MMD $(VBO_EMULATION_FLAG)

# Compilation flags for zlib source files
ZLIBFLAGS=-O3 -I. -MMD -Ithirdparty/stb_image/include
Expand Down
8 changes: 4 additions & 4 deletions thirdparty/raknet/LocklessTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ LocklessUint32_t::LocklessUint32_t(uint32_t initial)
}
uint32_t LocklessUint32_t::Increment(void)
{
#ifdef _WIN32
#if defined(_WIN32) && !defined(LOCKLESS_TYPES_USE_MUTEX)
return (uint32_t) InterlockedIncrement(&value);
#elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
#elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__) || defined(LOCKLESS_TYPES_USE_MUTEX)
uint32_t v;
mutex.Lock();
++value;
Expand All @@ -37,9 +37,9 @@ uint32_t LocklessUint32_t::Increment(void)
}
uint32_t LocklessUint32_t::Decrement(void)
{
#ifdef _WIN32
#if defined(_WIN32) && !defined(LOCKLESS_TYPES_USE_MUTEX)
return (uint32_t) InterlockedDecrement(&value);
#elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
#elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__) || defined(LOCKLESS_TYPES_USE_MUTEX)
uint32_t v;
mutex.Lock();
--value;
Expand Down
6 changes: 3 additions & 3 deletions thirdparty/raknet/LocklessTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "Export.h"
#include "NativeTypes.h"
#include "WindowsIncludes.h"
#if defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
#if defined(ANDROID) || defined(__S3E__) || defined(__APPLE__) || defined(LOCKLESS_TYPES_USE_MUTEX)
// __sync_fetch_and_add not supported apparently
#include "SimpleMutex.h"
#endif
Expand All @@ -34,9 +34,9 @@ class RAK_DLL_EXPORT LocklessUint32_t
uint32_t GetValue(void) const {return value;}

protected:
#ifdef _WIN32
#if defined(_WIN32) && !defined(LOCKLESS_TYPES_USE_MUTEX)
volatile LONG value;
#elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__)
#elif defined(ANDROID) || defined(__S3E__) || defined(__APPLE__) || defined(LOCKLESS_TYPES_USE_MUTEX)
// __sync_fetch_and_add not supported apparently
SimpleMutex mutex;
uint32_t value;
Expand Down

0 comments on commit e2ba9e1

Please sign in to comment.