Skip to content

Commit 2fb712a

Browse files
authored
Fix macOS build (#146)
* Fix macOS build * Fix *BSD build * Add missing *BSD include
1 parent 53bd92f commit 2fb712a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+107
-98
lines changed

appframework/sdlmgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class CSDLMgr : public ILauncherMgr
270270

271271
// Get the next N events. The function returns the number of events that were filled into your array.
272272
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
273-
#if defined(LINUX) || defined(BSD)
273+
#if defined(LINUX) || defined(PLATFORM_BSD)
274274
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
275275
#endif
276276

@@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
10041004
return nToWrite;
10051005
}
10061006

1007-
#if defined(LINUX) || defined(BSD)
1007+
#if defined(LINUX) || defined(PLATFORM_BSD)
10081008

10091009
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
10101010
{

appframework/wscript

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def build(bld):
5151

5252
libs = []
5353

54+
if bld.env.DEST_OS == 'darwin':
55+
libs += ['FOUNDATION', 'APPKIT', 'IOKIT']
56+
5457
bld.stlib(
5558
source = source,
5659
target = PROJECT_NAME,

common/freetype/config/ftconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#ifdef ANDROID
55
#include <sys/cdefs.h>
6-
#elif defined(OSX) || defined(BSD)
6+
#elif defined(OSX) || defined(PLATFORM_BSD)
77
#include <stdint.h>
88
#else
99
#include <bits/wordsize.h>

dedicated/filesystem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
#include <stdlib.h>
1414
#include "interface.h"
1515
#include <string.h>
16+
#ifdef OSX
17+
#include <malloc/malloc.h>
18+
#else
1619
#include <malloc.h>
20+
#endif
1721
#include "tier1/strtools.h"
1822
#include "tier0/icommandline.h"
1923
#include "tier0/dbg.h"

dedicated/sys_linux.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
#include <stdarg.h>
1313
#include <sys/types.h>
1414
#include <sys/time.h>
15+
#ifdef OSX
16+
#include <malloc/malloc.h>
17+
#else
1518
#include <malloc.h>
19+
#endif
1620
#include <stdio.h>
1721
#include <stdlib.h>
1822
#include <dlfcn.h>

dedicated_main/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ int main( int argc, char *argv[] )
206206
void *tier0 = dlopen( "libtier0" DLL_EXT_STRING, RTLD_NOW );
207207
void *vstdlib = dlopen( "libvstdlib" DLL_EXT_STRING, RTLD_NOW );
208208

209-
const char *pBinaryName = "dedicated" DLL_EXT_STRING;
209+
const char *pBinaryName = "bin/dedicated" DLL_EXT_STRING;
210210

211211
void *dedicated = dlopen( pBinaryName, RTLD_NOW );
212212
if ( !dedicated )
213-
dedicated = dlopen( "libdedicated" DLL_EXT_STRING, RTLD_NOW );
213+
dedicated = dlopen( "bin/libdedicated" DLL_EXT_STRING, RTLD_NOW );
214214

215215
if ( !dedicated )
216216
{

engine/bugreporter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include <copyfile.h>
2121
#import <mach/mach_host.h>
2222
#import <sys/sysctl.h>
23-
#elif defined(BSD)
23+
#elif defined(PLATFORM_BSD)
2424
# include <sys/sysctl.h>
2525
# include <sys/types.h>
2626
# include <fcntl.h>
@@ -110,7 +110,7 @@
110110
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
111111
#elif defined(OSX)
112112
#define BUG_REPOSITORY_URL "/Volumes/bugs"
113-
#elif defined(LINUX) || defined(BSD)
113+
#elif defined(LINUX) || defined(PLATFORM_BSD)
114114
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
115115
#else
116116
//#error
@@ -144,7 +144,7 @@ unsigned long GetRam()
144144
MEMORYSTATUS stat;
145145
GlobalMemoryStatus( &stat );
146146
return (stat.dwTotalPhys / (1024 * 1024));
147-
#elif defined(OSX) || defined(BSD)
147+
#elif defined(OSX) || defined(PLATFORM_BSD)
148148
int mib[2] = { CTL_HW, HW_MEMSIZE };
149149
u_int namelen = sizeof(mib) / sizeof(mib[0]);
150150
uint64_t memsize;
@@ -345,7 +345,7 @@ void DisplaySystemVersion( char *osversion, int maxlen )
345345

346346
fclose( fpKernelVer );
347347
}
348-
#elif BSD
348+
#elif PLATFORM_BSD
349349
#ifdef __FreeBSD__
350350
osversion = (char *)"FreeBSD";
351351
#else
@@ -2257,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
22572257
}
22582258
}
22592259

2260-
#if defined(LINUX) || defined(BSD)
2260+
#if defined(LINUX) || defined(PLATFORM_BSD)
22612261
#define COPYFILE_ALL 0
22622262
#define BSIZE 65535
22632263
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )

engine/sv_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con
27142714
event->SetString( "os", "LINUX" );
27152715
#elif defined ( OSX )
27162716
event->SetString( "os", "OSX" );
2717-
#elif defined(BSD)
2717+
#elif defined(PLATFORM_BSD)
27182718
event->SetString("os",
27192719
# ifdef __FreeBSD__
27202720
"FreeBSD"

engine/sv_uploadgamestats.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//$ #include <uuid/uuid.h>
2424
#ifdef OSX
2525
#include <uuid/uuid.h>
26-
#elif defined(BSD)
26+
#elif defined(PLATFORM_BSD)
2727
#include <uuid.h>
2828
#else
2929
typedef unsigned char uuid_t[16];
@@ -398,7 +398,7 @@ class CUploadGameStats : public IUploadGameStats
398398
uuid_t newId;
399399
#ifdef OSX
400400
uuid_generate( newId );
401-
#elif defined(BSD)
401+
#elif defined(PLATFORM_BSD)
402402
uint32_t status;
403403
uuid_create( &newId, &status );
404404
#endif

engine/sys_dll.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#elif defined(OSX)
1313
#include <Carbon/Carbon.h>
1414
#include <sys/sysctl.h>
15-
#elif defined(BSD)
15+
#elif defined(PLATFORM_BSD)
1616
#include <sys/types.h>
1717
#include <sys/sysctl.h>
1818
#define HW_MEMSIZE HW_PHYSMEM
@@ -668,7 +668,7 @@ void Sys_InitMemory( void )
668668
#elif defined(POSIX)
669669
uint64_t memsize = ONE_HUNDRED_TWENTY_EIGHT_MB;
670670

671-
#if defined(OSX) || defined(BSD)
671+
#if defined(OSX) || defined(PLATFORM_BSD)
672672
int mib[2] = { CTL_HW, HW_MEMSIZE };
673673
u_int namelen = sizeof(mib) / sizeof(mib[0]);
674674
size_t len = sizeof(memsize);
@@ -1586,7 +1586,7 @@ CON_COMMAND( star_memory, "Dump memory stats" )
15861586
struct mstats memstats = mstats( );
15871587
Msg( "Available %.2f MB, Used: %.2f MB, #mallocs = %lu\n",
15881588
memstats.bytes_free / ( 1024.0 * 1024.0), memstats.bytes_used / ( 1024.0 * 1024.0 ), memstats.chunks_used );
1589-
#elif BSD
1589+
#elif PLATFORM_BSD
15901590
# warning TODO: Implement memory stats (peace of sheet of course)
15911591
#else // Win32
15921592
MEMORYSTATUS stat;

0 commit comments

Comments
 (0)