Skip to content

Commit 72610ea

Browse files
feliwirFighter19
andauthored
[CORE][CMAKE] Fix Linux compilation of WWDebug (#699)
Co-authored-by: Patrick Zacharias <1475802+Fighter19@users.noreply.github.com>
1 parent 68c9b5b commit 72610ea

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Core/Libraries/Source/WWVegas/WWDebug/wwdebug.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343

4444

4545
#include "wwdebug.h"
46-
#include <windows.h>
4746
//#include "win.h" can use this if allowed to see wwlib
4847
#include <stdlib.h>
4948
#include <stdarg.h>
@@ -53,6 +52,11 @@
5352
#include <signal.h>
5453
#include "Except.h"
5554

55+
#ifdef _WIN32
56+
#include <windows.h>
57+
#else
58+
#include <errno.h>
59+
#endif
5660

5761
static PrintFunc _CurMessageHandler = NULL;
5862
static AssertPrintFunc _CurAssertHandler = NULL;
@@ -79,7 +83,11 @@ void Convert_System_Error_To_String(int id, char* buffer, int buf_len)
7983

8084
int Get_Last_System_Error()
8185
{
86+
#ifdef _WIN32
8287
return GetLastError();
88+
#else
89+
return errno;
90+
#endif
8391
}
8492

8593
/***********************************************************************************************

Core/Libraries/Source/WWVegas/WWDebug/wwmemlog.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "wwdebug.h"
4444
#include "Vector.H"
4545
#include "FastAllocator.h"
46-
#include <windows.h>
4746

4847
#define USE_FAST_ALLOCATOR
4948

@@ -70,7 +69,8 @@
7069
** Enable one of the following #defines to specify which thread-sychronization
7170
** method to use.
7271
*/
73-
#ifndef _UNIX
72+
#ifdef _WIN32
73+
#include <windows.h>
7474
#define MEMLOG_USE_MUTEX 0
7575
#define MEMLOG_USE_CRITICALSECTION 1
7676
#define MEMLOG_USE_FASTCRITICALSECTION 0
@@ -289,6 +289,10 @@ WWINLINE void * Get_Mem_Log_Mutex(void)
289289
return _MemLogCriticalSectionHandle;
290290

291291
#endif
292+
293+
#if DISABLE_MEMLOG
294+
return NULL;
295+
#endif
292296
}
293297

294298
WWINLINE void Lock_Mem_Log_Mutex(void)

Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
#include "wwprofile.h"
5454
#include "FastAllocator.h"
5555
#include "wwdebug.h"
56-
#include <windows.h>
5756
//#include "systimer.h"
5857
#include "systimer.h"
5958
#include "RAWFILE.H"

0 commit comments

Comments
 (0)