mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 01:39:36 +00:00
Fix macOS build (#146)
* Fix macOS build * Fix *BSD build * Add missing *BSD include
This commit is contained in:
+6
-6
@@ -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 )
|
||||
|
||||
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()
|
||||
}
|
||||
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()
|
||||
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;
|
||||
|
||||
+2
-2
@@ -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()
|
||||
|
||||
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,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 )
|
||||
|
||||
#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()
|
||||
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()
|
||||
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()
|
||||
|
||||
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()
|
||||
{
|
||||
#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 )
|
||||
__realloc_hook = ReallocHook;
|
||||
|
||||
}
|
||||
#elif OSX || BSD
|
||||
#elif OSX || PLATFORM_BSD
|
||||
|
||||
|
||||
static void RemoveHooks( void )
|
||||
|
||||
@@ -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()
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user