Browse Source

Fix macOS build (#146)

* Fix macOS build
* Fix *BSD build
* Add missing *BSD include
pull/153/head
exstrim401 2 years ago committed by GitHub
parent
commit
2fb712af66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      appframework/sdlmgr.cpp
  2. 3
      appframework/wscript
  3. 2
      common/freetype/config/ftconfig.h
  4. 4
      dedicated/filesystem.cpp
  5. 4
      dedicated/sys_linux.cpp
  6. 4
      dedicated_main/main.cpp
  7. 10
      engine/bugreporter.cpp
  8. 2
      engine/sv_main.cpp
  9. 4
      engine/sv_uploadgamestats.cpp
  10. 6
      engine/sys_dll.cpp
  11. 11
      engine/sys_dll2.cpp
  12. 4
      engine/sys_mainwind.cpp
  13. 14
      engine/wscript
  14. 2
      filesystem/basefilesystem.cpp
  15. 2
      filesystem/filesystem_async.cpp
  16. 6
      filesystem/filesystem_stdio.cpp
  17. 2
      gameui/BasePanel.cpp
  18. 2
      ivp
  19. 12
      launcher/launcher.cpp
  20. 2
      launcher/wscript
  21. 2
      mathlib/mathlib_base.cpp
  22. 2
      public/appframework/AppFramework.h
  23. 2
      public/appframework/ilaunchermgr.h
  24. 2
      public/libpng/pngconf.h
  25. 10
      public/tier0/platform.h
  26. 4
      public/tier0/threadtools.h
  27. 2
      public/tier1/interface.h
  28. 2
      serverbrowser/ServerBrowserDialog.cpp
  29. 12
      tier0/cpu.cpp
  30. 4
      tier0/cpu_posix.cpp
  31. 16
      tier0/platform_posix.cpp
  32. 4
      tier0/threadtools.cpp
  33. 2
      tier1/strtools.cpp
  34. 2
      togl/linuxwin/dxabstract.cpp
  35. 4
      togl/linuxwin/glentrypoints.cpp
  36. 2
      togles/linuxwin/dxabstract.cpp
  37. 2
      togles/linuxwin/glentrypoints.cpp
  38. 6
      vgui2/src/system_posix.cpp
  39. 4
      vgui2/vgui_surfacelib/FontManager.cpp
  40. 2
      vguimatsurface/FontTextureCache.cpp
  41. 8
      vguimatsurface/MatSystemSurface.cpp
  42. 2
      vguimatsurface/MatSystemSurface.h
  43. 6
      video/videoservices.cpp
  44. 1
      vstdlib/wscript
  45. 2
      wscript

4
appframework/sdlmgr.cpp

@ -270,7 +270,7 @@ public: @@ -270,7 +270,7 @@ public:
// Get the next N events. The function returns the number of events that were filled into your array.
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false );
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent = false );
#endif
@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug @@ -1004,7 +1004,7 @@ int CSDLMgr::GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debug
return nToWrite;
}
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
int CSDLMgr::PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvent )
{

3
appframework/wscript

@ -51,6 +51,9 @@ def build(bld): @@ -51,6 +51,9 @@ def build(bld):
libs = []
if bld.env.DEST_OS == 'darwin':
libs += ['FOUNDATION', 'APPKIT', 'IOKIT']
bld.stlib(
source = source,
target = PROJECT_NAME,

2
common/freetype/config/ftconfig.h

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
#ifdef ANDROID
#include <sys/cdefs.h>
#elif defined(OSX) || defined(BSD)
#elif defined(OSX) || defined(PLATFORM_BSD)
#include <stdint.h>
#else
#include <bits/wordsize.h>

4
dedicated/filesystem.cpp

@ -13,7 +13,11 @@ @@ -13,7 +13,11 @@
#include <stdlib.h>
#include "interface.h"
#include <string.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include "tier1/strtools.h"
#include "tier0/icommandline.h"
#include "tier0/dbg.h"

4
dedicated/sys_linux.cpp

@ -12,7 +12,11 @@ @@ -12,7 +12,11 @@
#include <stdarg.h>
#include <sys/types.h>
#include <sys/time.h>
#ifdef OSX
#include <malloc/malloc.h>
#else
#include <malloc.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

4
dedicated_main/main.cpp

@ -206,11 +206,11 @@ int main( int argc, char *argv[] ) @@ -206,11 +206,11 @@ int main( int argc, char *argv[] )
void *tier0 = dlopen( "libtier0" DLL_EXT_STRING, RTLD_NOW );
void *vstdlib = dlopen( "libvstdlib" DLL_EXT_STRING, RTLD_NOW );
const char *pBinaryName = "dedicated" DLL_EXT_STRING;
const char *pBinaryName = "bin/dedicated" DLL_EXT_STRING;
void *dedicated = dlopen( pBinaryName, RTLD_NOW );
if ( !dedicated )
dedicated = dlopen( "libdedicated" DLL_EXT_STRING, RTLD_NOW );
dedicated = dlopen( "bin/libdedicated" DLL_EXT_STRING, RTLD_NOW );
if ( !dedicated )
{

10
engine/bugreporter.cpp

@ -20,7 +20,7 @@ @@ -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 @@ @@ -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() @@ -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 ) @@ -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) @@ -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 )

2
engine/sv_main.cpp

@ -2714,7 +2714,7 @@ bool CGameServer::SpawnServer( const char *szMapName, const char *szMapFile, con @@ -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"

4
engine/sv_uploadgamestats.cpp

@ -23,7 +23,7 @@ @@ -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: @@ -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

6
engine/sys_dll.cpp

@ -12,7 +12,7 @@ @@ -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 ) @@ -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" ) @@ -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;

11
engine/sys_dll2.cpp

@ -15,7 +15,8 @@ @@ -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 ) @@ -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: @@ -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: @@ -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: @@ -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 );
}
}

4
engine/sys_mainwind.cpp

@ -25,7 +25,7 @@ @@ -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) @@ -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

14
engine/wscript

@ -212,12 +212,6 @@ def build(bld): @@ -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): @@ -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): @@ -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

2
filesystem/basefilesystem.cpp

@ -2841,7 +2841,7 @@ time_t CBaseFileSystem::FastFileTime( const CSearchPath *path, const char *pFile @@ -2841,7 +2841,7 @@ time_t CBaseFileSystem::FastFileTime( const CSearchPath *path, const char *pFile
{
return buf.st_mtime;
}
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
char caseFixedName[ MAX_PATH ];
bool found = findFileInDirCaseInsensitive_safe( pTmpFileName, caseFixedName );
if ( found && FS_stat( caseFixedName, &buf ) != -1 )

2
filesystem/filesystem_async.cpp

@ -1527,7 +1527,7 @@ void CBaseFileSystem::DoAsyncCallback( const FileAsyncRequest_t &request, void * @@ -1527,7 +1527,7 @@ void CBaseFileSystem::DoAsyncCallback( const FileAsyncRequest_t &request, void *
if ( pDataToFree )
{
Assert( !request.pfnAlloc );
#if defined( OSX ) || defined( LINUX ) || defined(BSD)
#if defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
// The ugly delete[] (void*) method generates a compile warning on osx, as it should.
free( pDataToFree );
#else

6
filesystem/filesystem_stdio.cpp

@ -579,7 +579,7 @@ int CFileSystem_Stdio::FS_chmod( const char *pathT, int pmode ) @@ -579,7 +579,7 @@ int CFileSystem_Stdio::FS_chmod( const char *pathT, int pmode )
CBaseFileSystem::FixUpPath ( pathT, path, sizeof( path ) );
int rt = _chmod( path, pmode );
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
if (rt==-1)
{
char caseFixedName[ MAX_PATH ];
@ -707,7 +707,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo @@ -707,7 +707,7 @@ int CFileSystem_Stdio::FS_stat( const char *pathT, struct _stat *buf, bool *pbLo
}
#endif // defined(_WIN32) && defined(FILESYSTEM_MSVC2015_STAT_BUG_WORKAROUND)
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
if ( rt == -1 )
{
char caseFixedName[ MAX_PATH ];
@ -866,7 +866,7 @@ CStdioFile *CStdioFile::FS_fopen( const char *filenameT, const char *options, in @@ -866,7 +866,7 @@ CStdioFile *CStdioFile::FS_fopen( const char *filenameT, const char *options, in
}
}
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
if(!pFile && !strchr(options,'w') && !strchr(options,'+') ) // try opening the lower cased version
{
char caseFixedName[ MAX_PATH ];

2
gameui/BasePanel.cpp

@ -2220,7 +2220,7 @@ void CBasePanel::RunMenuCommand(const char *command) @@ -2220,7 +2220,7 @@ void CBasePanel::RunMenuCommand(const char *command)
RegCloseKey(hKey);
}
#elif defined( OSX ) || defined( LINUX ) || defined(BSD)
#elif defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
FILE *fp = fopen( "/tmp/hl2_relaunch", "w+" );
if ( fp )
{

2
ivp

@ -1 +1 @@ @@ -1 +1 @@
Subproject commit 2306a2531691b46f739cb0b587c1f3527c7b1c11
Subproject commit 0fcf14dafb1249bfed8fc951c81e3f77bf4e97fd

12
launcher/launcher.cpp

@ -205,7 +205,7 @@ class CVCRHelpers : public IVCRHelpers @@ -205,7 +205,7 @@ class CVCRHelpers : public IVCRHelpers
public:
virtual void ErrorMessage( const char *pMsg )
{
#if defined( WIN32 ) || defined( LINUX ) || defined(BSD)
#if defined( WIN32 ) || defined( LINUX ) || defined(PLATFORM_BSD)
NOVCR( ::MessageBox( NULL, pMsg, "VCR Error", MB_OK ) );
#endif
}
@ -950,7 +950,7 @@ bool GrabSourceMutex() @@ -950,7 +950,7 @@ bool GrabSourceMutex()
#ifdef ANDROID
return true;
#elif defined (LINUX) || defined(BSD)
#elif defined (LINUX) || defined(PLATFORM_BSD)
/*
* Linux
*/
@ -1198,7 +1198,7 @@ DLL_EXPORT int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR @@ -1198,7 +1198,7 @@ DLL_EXPORT int LauncherMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
DLL_EXPORT int LauncherMain( int argc, char **argv )
#endif
{
#if (defined(LINUX) || defined(BSD)) && !defined ANDROID
#if (defined(LINUX) || defined(PLATFORM_BSD)) && !defined ANDROID
// Temporary fix to stop us from crashing in printf/sscanf functions that don't expect
// localization to mess with your "." and "," float seperators. Mac OSX also sets LANG
// to en_US.UTF-8 before starting up (in info.plist I believe).
@ -1225,7 +1225,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv ) @@ -1225,7 +1225,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
Msg("SDL version: %d.%d.%d rev: %s\n", (int)ver.major, (int)ver.minor, (int)ver.patch, SDL_GetRevision());
#endif
#if (defined LINUX || defined BSD) && defined USE_SDL && defined TOGLES && !defined ANDROID
#if (defined LINUX || defined PLATFORM_BSD) && defined USE_SDL && defined TOGLES && !defined ANDROID
SDL_SetHint(SDL_HINT_VIDEO_X11_FORCE_EGL, "1");
#endif
@ -1553,7 +1553,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv ) @@ -1553,7 +1553,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
RegCloseKey(hKey);
}
#elif defined( OSX ) || defined( LINUX ) || defined(BSD)
#elif defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
struct stat st;
if ( stat( RELAUNCH_FILE, &st ) == 0 )
{
@ -1570,7 +1570,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv ) @@ -1570,7 +1570,7 @@ DLL_EXPORT int LauncherMain( int argc, char **argv )
}
szCmd[nChars] = 0;
char szOpenLine[ MAX_PATH ];
#if defined( LINUX ) || defined(BSD)
#if defined( LINUX ) || defined(PLATFORM_BSD)
Q_snprintf( szOpenLine, sizeof(szOpenLine), "xdg-open \"%s\"", szCmd );
#else
Q_snprintf( szOpenLine, sizeof(szOpenLine), "open \"%s\"", szCmd );

2
launcher/wscript

@ -45,8 +45,6 @@ def build(bld): @@ -45,8 +45,6 @@ def build(bld):
if bld.env.DEST_OS == 'win32':
libs += ['USER32', 'OLE32', 'SHELL32']
elif bld.env.DEST_OS == 'darwin':
libs += ['FOUNDATION', 'APPKIT', 'IOKIT']
install_path = bld.env.LIBDIR

2
mathlib/mathlib_base.cpp

@ -3343,7 +3343,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright @@ -3343,7 +3343,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
// SSE Generally performs better than 3DNow when present, so this is placed
// first to allow SSE to override these settings.
#if !defined( OSX ) && !defined( PLATFORM_WINDOWS_PC64 ) && !defined(LINUX) && !defined(BSD)
#if !defined( OSX ) && !defined( PLATFORM_WINDOWS_PC64 ) && !defined(LINUX) && !defined(PLATFORM_BSD)
if ( bAllow3DNow && pi.m_b3DNow )
{
s_b3DNowEnabled = true;

2
public/appframework/AppFramework.h

@ -61,7 +61,7 @@ void AppShutdown( CAppSystemGroup *pAppSystemGroup ); @@ -61,7 +61,7 @@ void AppShutdown( CAppSystemGroup *pAppSystemGroup );
extern int ValveCocoaMain( int argc, char **argv, CAppSystemGroup *pAppSystemGroup ); \
return ValveCocoaMain( argc, argv, &_globalVarName ); \
}
#elif defined( LINUX ) || defined(BSD)
#elif defined( LINUX ) || defined(PLATFORM_BSD)
#define DEFINE_WINDOWED_APPLICATION_OBJECT_GLOBALVAR( _globalVarName ) \
int main( int argc, char **argv ) \
{ \

2
public/appframework/ilaunchermgr.h

@ -52,7 +52,7 @@ public: @@ -52,7 +52,7 @@ public:
// Get the next N events. The function returns the number of events that were filled into your array.
virtual int GetEvents( CCocoaEvent *pEvents, int nMaxEventsToReturn, bool debugEvents = false ) = 0;
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
virtual int PeekAndRemoveKeyboardEvents( bool *pbEsc, bool *pbReturn, bool *pbSpace, bool debugEvents = false ) = 0;
#endif

2
public/libpng/pngconf.h

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
* because this file defines png_memcpy and so on the base APIs must
* be defined here.
*/
# ifdef BSD
# ifdef PLATFORM_BSD
# include <strings.h>
# else
# include <string.h>

10
public/tier0/platform.h

@ -64,7 +64,7 @@ @@ -64,7 +64,7 @@
#ifdef POSIX
// need this for _alloca
# ifdef BSD
# ifdef PLATFORM_BSD
# define va_list __va_list
# else
# include <alloca.h>
@ -162,7 +162,7 @@ @@ -162,7 +162,7 @@
#define IsOSX() false
#endif
#ifdef BSD
#ifdef PLATFORM_BSD
#define IsBSD() true
#else
#define IsBSD() false
@ -450,7 +450,7 @@ typedef void * HINSTANCE; @@ -450,7 +450,7 @@ typedef void * HINSTANCE;
#else
// On OSX, SIGTRAP doesn't really stop the thread cold when debugging.
// So if being debugged, use INT3 which is precise.
#if defined(OSX) || defined(BSD)
#if defined(OSX) || defined(PLATFORM_BSD)
# if defined(__arm__) || defined(__aarch64__)
# ifdef __clang__
# define DebuggerBreak() do { if ( Plat_IsInDebugSession() ) { __builtin_debugtrap(); } else { raise(SIGTRAP); } } while(0)
@ -561,7 +561,7 @@ typedef void * HINSTANCE; @@ -561,7 +561,7 @@ typedef void * HINSTANCE;
//-----------------------------------------------------------------------------
#if defined( GNUC )
#define stackalloc( _size ) alloca( ALIGN_VALUE( _size, 16 ) )
#if defined(_LINUX) || defined(BSD)
#if defined(_LINUX) || defined(PLATFORM_BSD)
#define mallocsize( _p ) ( malloc_usable_size( _p ) )
#elif defined(OSX)
#define mallocsize( _p ) ( malloc_size( _p ) )
@ -1388,7 +1388,7 @@ PLATFORM_INTERFACE void* Plat_SimpleLog( const tchar* file, int line ); @@ -1388,7 +1388,7 @@ PLATFORM_INTERFACE void* Plat_SimpleLog( const tchar* file, int line );
//-----------------------------------------------------------------------------
// Returns true if debugger attached, false otherwise
//-----------------------------------------------------------------------------
#if defined(_WIN32) || defined(LINUX) || defined(OSX) || defined(BSD)
#if defined(_WIN32) || defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
PLATFORM_INTERFACE bool Plat_IsInDebugSession();
PLATFORM_INTERFACE void Plat_DebugString( const char * );
#else

4
public/tier0/threadtools.h

@ -285,7 +285,7 @@ PLATFORM_INTERFACE void ThreadSetAffinity( ThreadHandle_t hThread, int nAffinity @@ -285,7 +285,7 @@ PLATFORM_INTERFACE void ThreadSetAffinity( ThreadHandle_t hThread, int nAffinity
#error Every platform needs to define ThreadMemoryBarrier to at least prevent compiler reordering
#endif
#if defined( _LINUX ) || defined( _OSX ) || defined(BSD)
#if defined( _LINUX ) || defined( _OSX ) || defined(PLATFORM_BSD)
#define USE_INTRINSIC_INTERLOCKED
// linux implementation
inline int32 ThreadInterlockedIncrement( int32 volatile *p )
@ -486,7 +486,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p); @@ -486,7 +486,7 @@ PLATFORM_INTERFACE void ThreadNotifySyncReleasing(void *p);
#ifndef NO_THREAD_LOCAL
#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) ) || defined(BSD)
#if defined(WIN32) || defined(OSX) || defined( _PS3 ) || ( defined (_LINUX) ) || defined(PLATFORM_BSD)
#ifndef __AFXTLS_H__ // not compatible with some Windows headers
#if defined(_PS3)

2
public/tier1/interface.h

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
#pragma once
#endif
#if defined(_LINUX) || defined(BSD)
#if defined(_LINUX) || defined(PLATFORM_BSD)
#include <dlfcn.h> // dlopen,dlclose, et al
#include <unistd.h>

2
serverbrowser/ServerBrowserDialog.cpp

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
#define WIN32_LEAN_AND_MEAN
#include <winsock.h>
#endif
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
#include <arpa/inet.h>
#endif

12
tier0/cpu.cpp

@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
#include <windows.h>
#elif defined(_LINUX)
#include <stdlib.h>
#elif defined(OSX) || defined(BSD)
#elif defined(OSX) || defined(PLATFORM_BSD)
#include <sys/sysctl.h>
#endif
@ -273,7 +273,7 @@ bool CheckSSE4aTechnology( void ) @@ -273,7 +273,7 @@ bool CheckSSE4aTechnology( void )
static bool Check3DNowTechnology(void)
{
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__) || (defined(BSD) && defined(COMPILER_CLANG))
#if defined( _X360 ) || defined( _PS3 ) || defined (__arm__) || defined(__SANITIZE_ADDRESS__) || (defined(PLATFORM_BSD) && defined(COMPILER_CLANG))
return false;
#else
uint32 eax, unused;
@ -479,14 +479,14 @@ static int64 CalculateClockSpeed() @@ -479,14 +479,14 @@ static int64 CalculateClockSpeed()
}
return freq;
#endif
#elif defined(BSD)
#elif defined(PLATFORM_BSD)
return CalculateCPUFreq() * 1000000.0f;
#elif defined(POSIX)
int64 freq =(int64)CalculateCPUFreq();
if ( freq == 0 ) // couldn't calculate clock speed
/*if ( freq == 0 ) // couldn't calculate clock speed
{
Warning( "Unable to determine CPU Frequency\n" );
}
}*/
return freq;
#endif
}
@ -584,7 +584,7 @@ const CPUInformation* GetCPUInformation() @@ -584,7 +584,7 @@ const CPUInformation* GetCPUInformation()
pi.m_nLogicalProcessors = 1;
Assert( !"couldn't read cpu information from /proc/cpuinfo" );
}
#elif defined(OSX) || defined(BSD)
#elif defined(OSX) || defined(PLATFORM_BSD)
int mib[2], num_cpu = 1;
size_t len;
mib[0] = CTL_HW;

4
tier0/cpu_posix.cpp

@ -51,7 +51,7 @@ static inline uint64 diff(uint64 v1, uint64 v2) @@ -51,7 +51,7 @@ static inline uint64 diff(uint64 v1, uint64 v2)
return -d;
}
#if defined(OSX) || defined(BSD)
#if defined(OSX) || defined(PLATFORM_BSD)
// Mac or BSD
uint64 GetCPUFreqFromPROC()
@ -101,7 +101,7 @@ uint64 GetCPUFreqFromPROC() @@ -101,7 +101,7 @@ uint64 GetCPUFreqFromPROC()
uint64 CalculateCPUFreq()
{
#if defined(__APPLE__) || defined(BSD)
#if defined(__APPLE__) || defined(PLATFORM_BSD)
return GetCPUFreqFromPROC();
#else
// Try to open cpuinfo_max_freq. If the kernel was built with cpu scaling support disabled, this will fail.

16
tier0/platform_posix.cpp

@ -16,8 +16,8 @@ @@ -16,8 +16,8 @@
#include <sys/resource.h>
#include <unistd.h>
#if defined(OSX) || defined(BSD)
# ifdef BSD
#if defined(OSX) || defined(PLATFORM_BSD)
# ifdef PLATFORM_BSD
# include <sys/proc.h>
# include <sys/user.h>
# else
@ -441,7 +441,7 @@ PLATFORM_INTERFACE void Plat_SetAllocErrorFn( Plat_AllocErrorFn fn ) @@ -441,7 +441,7 @@ PLATFORM_INTERFACE void Plat_SetAllocErrorFn( Plat_AllocErrorFn fn )
#endif // !NO_HOOK_MALLOC
#if defined( OSX ) || defined(BSD)
#if defined( OSX ) || defined(PLATFORM_BSD)
// From the Apple tech note: http://developer.apple.com/library/mac/#qa/qa1361/_index.html
bool Plat_IsInDebugSession()
@ -451,7 +451,7 @@ bool Plat_IsInDebugSession() @@ -451,7 +451,7 @@ bool Plat_IsInDebugSession()
struct kinfo_proc info;
size_t size;
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()};
#ifndef BSD
#ifndef PLATFORM_BSD
info.kp_proc.p_flag = 0;
#endif
@ -459,7 +459,7 @@ bool Plat_IsInDebugSession() @@ -459,7 +459,7 @@ bool Plat_IsInDebugSession()
junk = sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, NULL, 0);
// We're being debugged if the P_TRACED flag is set.
#ifdef BSD
#ifdef PLATFORM_BSD
s_IsInDebugSession = info.ki_flag & P_TRACED;
#else
s_IsInDebugSession = info.kp_proc.p_flag & P_TRACED;
@ -559,7 +559,7 @@ PLATFORM_INTERFACE const char *Plat_GetCommandLineA() @@ -559,7 +559,7 @@ PLATFORM_INTERFACE const char *Plat_GetCommandLineA()
PLATFORM_INTERFACE bool GetMemoryInformation( MemoryInformation *pOutMemoryInfo )
{
#if defined( LINUX ) || defined( OSX ) || defined(BSD)
#if defined( LINUX ) || defined( OSX ) || defined(PLATFORM_BSD)
return false;
#else
#error "Need to fill out GetMemoryInformation or at least return false for this platform"
@ -571,7 +571,7 @@ PLATFORM_INTERFACE bool Is64BitOS() @@ -571,7 +571,7 @@ PLATFORM_INTERFACE bool Is64BitOS()
{
#if defined OSX
return true;
#elif defined(LINUX) || defined(BSD)
#elif defined(LINUX) || defined(PLATFORM_BSD)
FILE *pp = popen( "uname -m", "r" );
if ( pp != NULL )
{
@ -781,7 +781,7 @@ static void InstallHooks( void ) @@ -781,7 +781,7 @@ static void InstallHooks( void )
__realloc_hook = ReallocHook;
}
#elif OSX || BSD
#elif OSX || PLATFORM_BSD
static void RemoveHooks( void )

4
tier0/threadtools.cpp

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
#define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x )
#endif // !OSX
#ifdef BSD
#ifdef PLATFORM_BSD
# undef OS_TO_PTRHEAD
# define OS_TO_PTHREAD(x) (pthread_t)(x)
#endif
@ -1685,7 +1685,7 @@ bool CThreadFullMutex::Release() @@ -1685,7 +1685,7 @@ bool CThreadFullMutex::Release()
//
//-----------------------------------------------------------------------------
#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || defined (_LINUX) || defined(BSD)
#if defined( WIN32 ) || defined( _PS3 ) || defined( _OSX ) || defined (_LINUX) || defined(PLATFORM_BSD)
#if !defined(_PS3)
namespace GenericThreadLocals
{

2
tier1/strtools.cpp

@ -2953,7 +2953,7 @@ extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(v @@ -2953,7 +2953,7 @@ extern "C" void qsort_s( void *base, size_t num, size_t width, int (*compare )(v
void V_qsort_s( void *base, size_t num, size_t width, int ( __cdecl *compare )(void *, const void *, const void *), void * context )
{
#if defined(OSX) || defined(BSD)
#if defined(OSX) || defined(PLATFORM_BSD)
// the arguments are swapped 'round on the mac - awesome, huh?
return qsort_r( base, num, width, context, compare );
#else

2
togl/linuxwin/dxabstract.cpp

@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
#include "glmgr_flush.inl"
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(BSD)
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(PLATFORM_BSD)
#include "appframework/ilaunchermgr.h"
extern ILauncherMgr *g_pLauncherMgr;
#endif

4
togl/linuxwin/glentrypoints.cpp

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
#include "tier1.h"
#include "tier2/tier2.h"
#if (defined(_LINUX) || defined(BSD)) && !defined(__ANDROID__)
#if (defined(_LINUX) || defined(PLATFORM_BSD)) && !defined(__ANDROID__)
#include <GL/glx.h>
#endif
@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
#error
#endif
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(BSD)
#if defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION )) || defined(PLATFORM_BSD)
#include "appframework/ilaunchermgr.h"
ILauncherMgr *g_pLauncherMgr = NULL;
#endif

2
togles/linuxwin/dxabstract.cpp

@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
#include "glmgr_flush.inl"
#if defined(BSD) || defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
#if defined(PLATFORM_BSD) || defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
#include "appframework/ilaunchermgr.h"
extern ILauncherMgr *g_pLauncherMgr;
#endif

2
togles/linuxwin/glentrypoints.cpp

@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
#error
#endif
#if defined(BSD) || defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
#if defined(PLATFORM_BSD) || defined(OSX) || defined(LINUX) || (defined (WIN32) && defined( DX_TO_GL_ABSTRACTION ))
#include "appframework/ilaunchermgr.h"
ILauncherMgr *g_pLauncherMgr = NULL;
#endif

6
vgui2/src/system_posix.cpp

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
#include "vgui_key_translation.h"
#include "filesystem.h"
#if defined(OSX) || defined(BSD)
#if defined(OSX) || defined(PLATFORM_BSD)
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(LINUX)
@ -292,7 +292,7 @@ void CSystem::ShellExecute(const char *command, const char *file) @@ -292,7 +292,7 @@ void CSystem::ShellExecute(const char *command, const char *file)
if ( pid == 0 )
{
// Child
#if defined(LINUX) || defined(BSD)
#if defined(LINUX) || defined(PLATFORM_BSD)
// Escape steam runtime if necessary
const char *szSteamRuntime = getenv( "STEAM_RUNTIME" );
if ( szSteamRuntime )
@ -587,7 +587,7 @@ int CSystem::GetAvailableDrives(char *buf, int bufLen) @@ -587,7 +587,7 @@ int CSystem::GetAvailableDrives(char *buf, int bufLen)
//-----------------------------------------------------------------------------
double CSystem::GetFreeDiskSpace(const char *path)
{
#if __DARWIN_ONLY_64_BIT_INO_T || BSD
#if __DARWIN_ONLY_64_BIT_INO_T || PLATFORM_BSD
// MoeMod: newer macOS only support 64bit, so no statfs64 is provided
struct statfs buf;
int ret = statfs( path, &buf );

4
vgui2/vgui_surfacelib/FontManager.cpp

@ -584,7 +584,7 @@ FallbackFont_t g_FallbackFonts[] = @@ -584,7 +584,7 @@ FallbackFont_t g_FallbackFonts[] =
{ NULL, "Monaco" } // every other font falls back to this
};
#elif defined(LINUX) || defined(BSD)
#elif defined(LINUX) || defined(PLATFORM_BSD)
static const char *g_szValidAsianFonts[] = { "Marlett", "WenQuanYi Zen Hei", "unifont", NULL };
// list of how fonts fallback
@ -649,7 +649,7 @@ const char *CFontManager::GetForeignFallbackFontName() @@ -649,7 +649,7 @@ const char *CFontManager::GetForeignFallbackFontName()
return "Tahoma";
#elif defined(OSX)
return "Helvetica";
#elif defined(LINUX) || defined(BSD)
#elif defined(LINUX) || defined(PLATFORM_BSD)
return "WenQuanYi Zen Hei";
#elif defined(_PS3)
return "Tahoma";

2
vguimatsurface/FontTextureCache.cpp

@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
#include <windows.h>
#elif defined( OSX )
#include <Carbon/Carbon.h>
#elif defined( LINUX ) || defined(BSD)
#elif defined( LINUX ) || defined(PLATFORM_BSD)
//#error
#elif defined( _X360 )
#else

8
vguimatsurface/MatSystemSurface.cpp

@ -146,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface; @@ -146,7 +146,7 @@ CMatSystemSurface g_MatSystemSurface;
EXPOSE_SINGLE_INTERFACE_GLOBALVAR( CMatSystemSurface, ISurface,
VGUI_SURFACE_INTERFACE_VERSION, g_MatSystemSurface );
#if defined(LINUX) || defined(OSX) || defined(BSD)
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
CUtlDict< CMatSystemSurface::font_entry, unsigned short > CMatSystemSurface::m_FontData;
#endif
@ -407,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void ) @@ -407,7 +407,7 @@ InitReturnVal_t CMatSystemSurface::Init( void )
FontManager().SetLanguage( "english" );
}
#if defined(LINUX) || defined(OSX) || defined(BSD)
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
FontManager().SetFontDataHelper( &CMatSystemSurface::FontDataHelper );
#endif
@ -1907,7 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon @@ -1907,7 +1907,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
}
Assert( success );
return success;
#elif defined(LINUX) || defined(OSX) || defined(BSD)
#elif defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
int size;
if ( CMatSystemSurface::FontDataHelper( fontName, size, fontFileName ) )
@ -1921,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon @@ -1921,7 +1921,7 @@ bool CMatSystemSurface::AddCustomFontFile( const char *fontName, const char *fon
#endif
}
#if defined(LINUX) || defined(OSX) || defined(BSD)
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
static void RemoveSpaces( CUtlString &str )
{

2
vguimatsurface/MatSystemSurface.h

@ -556,7 +556,7 @@ private: @@ -556,7 +556,7 @@ private:
int m_nFullscreenViewportHeight;
ITexture *m_pFullscreenRenderTarget;
#if defined(LINUX) || defined(OSX) || defined(BSD)
#if defined(LINUX) || defined(OSX) || defined(PLATFORM_BSD)
struct font_entry
{
void *data;

6
video/videoservices.cpp

@ -58,14 +58,14 @@ DEFINE_ENUM_BITWISE_OPERATORS( EPlatform_t ); @@ -58,14 +58,14 @@ DEFINE_ENUM_BITWISE_OPERATORS( EPlatform_t );
const EPlatform_t thisPlatform = PLATFORM_XBOX_360;
#elif defined( _PS3 )
const EPlatform_t thisPlatform = PLATFORM_PS3;
#elif defined ( _LINUX ) || defined(BSD)
#elif defined ( _LINUX ) || defined(PLATFORM_BSD)
const EPlatform_t thisPlatform = PLATFORM_LINUX;
#else
#error "UNABLE TO DETERMINE PLATFORM"
#endif
#if defined( OSX ) || defined( LINUX ) || defined(BSD)
#if defined( OSX ) || defined( LINUX ) || defined(PLATFORM_BSD)
ILauncherMgr *g_pLauncherMgr = NULL;
#endif
@ -1382,7 +1382,7 @@ bool CVideoCommonServices::ProcessFullScreenInput( bool &bAbortEvent, bool &bPau @@ -1382,7 +1382,7 @@ bool CVideoCommonServices::ProcessFullScreenInput( bool &bAbortEvent, bool &bPau
bool bEscPressed = ( m_bScanEsc ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Escape ) : false;
bool bReturnPressed = ( m_bScanReturn ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Return ) : false;
bool bSpacePressed = ( m_bScanSpace ) ? CGEventSourceKeyState( kCGEventSourceStateCombinedSessionState, kVK_Space ) : false;
#elif defined(LINUX) || defined(BSD)
#elif defined(LINUX) || defined(PLATFORM_BSD)
g_pLauncherMgr->PumpWindowsMessageLoop();
// Escape, return, or space stops or pauses the playback

1
vstdlib/wscript

@ -53,7 +53,6 @@ def build(bld): @@ -53,7 +53,6 @@ def build(bld):
if bld.env.DEST_OS == 'android':
libs += ['ANDROID_SUPPORT']
elif bld.env.DEST_OS == 'darwin':
libs += ['ICONV', 'COREFOUNDATION']
linkflags += ['-framework', 'CoreServices']
install_path = bld.env.LIBDIR

2
wscript

@ -225,7 +225,7 @@ def define_platform(conf): @@ -225,7 +225,7 @@ def define_platform(conf):
conf.env.append_unique('DEFINES', [
'POSIX=1', '_POSIX=1', 'PLATFORM_POSIX=1',
'GNUC', # but uses clang
'BSD=1',
'PLATFORM_BSD=1',
'_DLL_EXT=.so'
])

Loading…
Cancel
Save