mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
Fix macOS build (#146)
* Fix macOS build * Fix *BSD build * Add missing *BSD include
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include <copyfile.h>
|
||||
#import <mach/mach_host.h>
|
||||
#import <sys/sysctl.h>
|
||||
#elif defined(BSD)
|
||||
#elif defined(PLATFORM_BSD)
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/types.h>
|
||||
# include <fcntl.h>
|
||||
@@ -110,7 +110,7 @@
|
||||
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
||||
#elif defined(OSX)
|
||||
#define BUG_REPOSITORY_URL "/Volumes/bugs"
|
||||
#elif defined(LINUX) || defined(BSD)
|
||||
#elif defined(LINUX) || defined(PLATFORM_BSD)
|
||||
#define BUG_REPOSITORY_URL "\\\\fileserver\\bugs"
|
||||
#else
|
||||
//#error
|
||||
@@ -144,7 +144,7 @@ unsigned long GetRam()
|
||||
MEMORYSTATUS stat;
|
||||
GlobalMemoryStatus( &stat );
|
||||
return (stat.dwTotalPhys / (1024 * 1024));
|
||||
#elif defined(OSX) || defined(BSD)
|
||||
#elif defined(OSX) || defined(PLATFORM_BSD)
|
||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||
uint64_t memsize;
|
||||
@@ -345,7 +345,7 @@ void DisplaySystemVersion( char *osversion, int maxlen )
|
||||
|
||||
fclose( fpKernelVer );
|
||||
}
|
||||
#elif BSD
|
||||
#elif PLATFORM_BSD
|
||||
#ifdef __FreeBSD__
|
||||
osversion = (char *)"FreeBSD";
|
||||
#else
|
||||
@@ -2257,7 +2257,7 @@ void NonFileSystem_CreatePath (const char *path)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(LINUX) || defined(BSD)
|
||||
#if defined(LINUX) || defined(PLATFORM_BSD)
|
||||
#define COPYFILE_ALL 0
|
||||
#define BSIZE 65535
|
||||
int copyfile( const char *local, const char *remote, void *ignored, int ignoredFlags )
|
||||
|
||||
+1
-1
@@ -2714,7 +2714,7 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con
|
||||
event->SetString( "os", "LINUX" );
|
||||
#elif defined ( OSX )
|
||||
event->SetString( "os", "OSX" );
|
||||
#elif defined(BSD)
|
||||
#elif defined(PLATFORM_BSD)
|
||||
event->SetString("os",
|
||||
# ifdef __FreeBSD__
|
||||
"FreeBSD"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
//$ #include <uuid/uuid.h>
|
||||
#ifdef OSX
|
||||
#include <uuid/uuid.h>
|
||||
#elif defined(BSD)
|
||||
#elif defined(PLATFORM_BSD)
|
||||
#include <uuid.h>
|
||||
#else
|
||||
typedef unsigned char uuid_t[16];
|
||||
@@ -398,7 +398,7 @@ public:
|
||||
uuid_t newId;
|
||||
#ifdef OSX
|
||||
uuid_generate( newId );
|
||||
#elif defined(BSD)
|
||||
#elif defined(PLATFORM_BSD)
|
||||
uint32_t status;
|
||||
uuid_create( &newId, &status );
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
#elif defined(OSX)
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <sys/sysctl.h>
|
||||
#elif defined(BSD)
|
||||
#elif defined(PLATFORM_BSD)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#define HW_MEMSIZE HW_PHYSMEM
|
||||
@@ -668,7 +668,7 @@ void Sys_InitMemory( void )
|
||||
#elif defined(POSIX)
|
||||
uint64_t memsize = ONE_HUNDRED_TWENTY_EIGHT_MB;
|
||||
|
||||
#if defined(OSX) || defined(BSD)
|
||||
#if defined(OSX) || defined(PLATFORM_BSD)
|
||||
int mib[2] = { CTL_HW, HW_MEMSIZE };
|
||||
u_int namelen = sizeof(mib) / sizeof(mib[0]);
|
||||
size_t len = sizeof(memsize);
|
||||
@@ -1586,7 +1586,7 @@ CON_COMMAND( star_memory, "Dump memory stats" )
|
||||
struct mstats memstats = mstats( );
|
||||
Msg( "Available %.2f MB, Used: %.2f MB, #mallocs = %lu\n",
|
||||
memstats.bytes_free / ( 1024.0 * 1024.0), memstats.bytes_used / ( 1024.0 * 1024.0 ), memstats.chunks_used );
|
||||
#elif BSD
|
||||
#elif PLATFORM_BSD
|
||||
# warning TODO: Implement memory stats (peace of sheet of course)
|
||||
#else // Win32
|
||||
MEMORYSTATUS stat;
|
||||
|
||||
+6
-5
@@ -15,7 +15,8 @@
|
||||
#include <Psapi.h>
|
||||
#endif
|
||||
|
||||
#if defined( OSX ) || defined(BSD)
|
||||
#if defined( OSX ) || defined(PLATFORM_BSD)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
@@ -278,7 +279,7 @@ static void posix_signal_handler( int i )
|
||||
#define DO_TRY if ( sigsetjmp( g_mark, 1 ) == 0 )
|
||||
#define DO_CATCH else
|
||||
|
||||
#if defined( OSX ) || defined(BSD)
|
||||
#if defined( OSX ) || defined(PLATFORM_BSD)
|
||||
#define __sighandler_t sig_t
|
||||
#endif
|
||||
|
||||
@@ -537,7 +538,7 @@ public:
|
||||
FreeLibrary( hInst );
|
||||
}
|
||||
|
||||
#elif defined( OSX ) || defined(BSD)
|
||||
#elif defined( OSX ) || defined(PLATFORM_BSD)
|
||||
|
||||
static const struct
|
||||
{
|
||||
@@ -548,7 +549,7 @@ public:
|
||||
#define _XTAG( _x ) { _x, #_x }
|
||||
_XTAG( HW_PHYSMEM ),
|
||||
_XTAG( HW_USERMEM ),
|
||||
#ifdef BSD
|
||||
#ifdef PLATFORM_BSD
|
||||
_XTAG( HW_PHYSMEM ),
|
||||
_XTAG( HW_NCPU ),
|
||||
#else
|
||||
@@ -566,7 +567,7 @@ public:
|
||||
|
||||
if ( sysctl( mib, Q_ARRAYSIZE( mib ), &val, &len, NULL, 0 ) == 0 )
|
||||
{
|
||||
CommentPrintf( " %s: %" PRIu64 "\n", s_ctl_names[ i ].name, val );
|
||||
CommentPrintf( " %s: %d\n", s_ctl_names[ i ].name, val );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#elif defined(_X360)
|
||||
// nothing to include for 360
|
||||
#elif defined(OSX)
|
||||
#elif defined(LINUX) || defined(BSD)
|
||||
#elif defined(LINUX) || defined(PLATFORM_BSD)
|
||||
#include "tier0/dynfunction.h"
|
||||
#elif defined(_WIN32)
|
||||
#include "tier0/dynfunction.h"
|
||||
@@ -833,7 +833,7 @@ LRESULT CGame::WindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
// return 0 if handled message, 1 if not
|
||||
return lRet;
|
||||
}
|
||||
#elif defined(OSX) || defined(LINUX) || defined(_WIN32) || defined(BSD)
|
||||
#elif defined(OSX) || defined(LINUX) || defined(_WIN32) || defined(PLATFORM_BSD)
|
||||
|
||||
#else
|
||||
#error
|
||||
|
||||
+7
-7
@@ -212,12 +212,6 @@ def build(bld):
|
||||
if bld.env.DEST_OS != "darwin":
|
||||
source += ['audio/snd_dev_sdl.cpp']
|
||||
|
||||
if bld.env.DEST_OS == 'darwin':
|
||||
source += [
|
||||
'audio/snd_dev_openal.cpp', # [$OSXALL]
|
||||
'audio/snd_dev_mac_audioqueue.cpp',# [$OSXALL]
|
||||
'audio/voice_record_mac_audioqueue.cpp', #[$OSXALL]
|
||||
]
|
||||
|
||||
if bld.env.DEST_OS == 'win32':
|
||||
source += [
|
||||
@@ -343,6 +337,12 @@ def build(bld):
|
||||
'audio/voice_mixer_controls_openal.cpp', #[$OSXALL||$LINUXALL]
|
||||
'audio/voice_record_openal.cpp' #[$OSXALL||$LINUXALL]
|
||||
]
|
||||
if bld.env.DEST_OS == 'darwin':
|
||||
source += [
|
||||
'audio/snd_dev_openal.cpp', # [$OSXALL]
|
||||
'audio/snd_dev_mac_audioqueue.cpp',# [$OSXALL]
|
||||
'audio/voice_record_mac_audioqueue.cpp', #[$OSXALL]
|
||||
]
|
||||
|
||||
includes = [
|
||||
'.',
|
||||
@@ -363,7 +363,7 @@ def build(bld):
|
||||
libs += ['SSL', 'CRYPTO'] # android curl was built with openssl
|
||||
elif bld.env.DEST_OS == 'win32':
|
||||
libs += ['USER32', 'WINMM', 'WININET', 'DSOUND', 'DXGUID', 'GDI32', 'bzip2']
|
||||
elif bld.env.DEST_OS == 'darwin':
|
||||
elif bld.env.DEST_OS == 'darwin' and not bld.env.DEDICATED:
|
||||
libs += ['APPKIT', 'COREAUDIO', 'AUDIOTOOLBOX', 'SYSTEMCONFIGURATION']
|
||||
|
||||
install_path = bld.env.LIBDIR
|
||||
|
||||
Reference in New Issue
Block a user