Compile and link fixes for Mac OS X (bug 4392, r=dvander).
This commit is contained in:
parent
5ef40e15c4
commit
95de453677
@ -147,6 +147,7 @@ class SM:
|
||||
'/Developer/SDKs/MacOSX10.5.sdk'])
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
|
||||
self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
self.compiler.AddToListVar('CDEFINES', 'WIN32')
|
||||
self.compiler.AddToListVar('CDEFINES', '_WINDOWS')
|
||||
@ -223,6 +224,16 @@ class SM:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
|
||||
workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
|
||||
for i in ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']:
|
||||
link = os.path.join(workFolder, i)
|
||||
target = os.path.join(staticLibs, i)
|
||||
try:
|
||||
os.lstat(link)
|
||||
except:
|
||||
job.AddCommand(SymlinkCommand(link, target))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
for lib in ['tier0', 'tier1', 'vstdlib', 'mathlib']:
|
||||
libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
|
||||
@ -230,7 +241,7 @@ class SM:
|
||||
builder['POSTLINKFLAGS'].append(libPath)
|
||||
|
||||
def PostSetupHL2Job(self, job, builder, sdk):
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
if AMBuild.target['platform'] in ['linux', 'darwin']:
|
||||
builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
|
||||
|
||||
def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
|
||||
@ -267,6 +278,8 @@ class SM:
|
||||
else:
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'linux')
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
staticLibs = os.path.join(sdkPath, 'lib', 'mac')
|
||||
|
||||
for i in paths:
|
||||
compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
|
||||
@ -279,7 +292,10 @@ class SM:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
|
||||
else:
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib']
|
||||
compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib']
|
||||
|
||||
return compiler
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#define FORCEINLINE_CVAR FORCEINLINE
|
||||
#elif _LINUX
|
||||
#elif defined _LINUX || defined __APPLE__
|
||||
#define FORCEINLINE_CVAR inline
|
||||
#else
|
||||
#error "implement me"
|
||||
|
@ -50,7 +50,7 @@ inline void Write_Function_Prologue(JitWriter *jit, bool RetInMemory)
|
||||
#if defined PLATFORM_WINDOWS
|
||||
//mov ebx, ecx
|
||||
IA32_Mov_Reg_Rm(jit, REG_EBX, REG_ECX, MOD_REG);
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
//mov ebx, [ebp+12+(RetInMemory)?4:0]
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, REG_EBX, REG_EBP, 12+((RetInMemory)?4:0));
|
||||
#endif
|
||||
@ -125,7 +125,7 @@ inline void Write_Copy_Params(JitWriter *jit, bool RetInMemory, jit_uint32_t ret
|
||||
}
|
||||
offs = 12 + ((RetInMemory) ? sizeof(void *) : 0);
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
offs += 4;
|
||||
#endif
|
||||
|
||||
@ -403,7 +403,7 @@ jit_rewind:
|
||||
Write_Function_Epilogue(jit,
|
||||
#if defined PLATFORM_WINDOWS
|
||||
ParamSize + ((RetInMemory) ? sizeof(void *) : 0)
|
||||
#elif defined PLATFORM_LINUX
|
||||
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
(RetInMemory) ? sizeof(void *) : 0
|
||||
#endif
|
||||
);
|
||||
|
@ -32,7 +32,7 @@
|
||||
#ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||
#define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
|
||||
|
||||
#if defined PLATFORM_LINUX
|
||||
#if defined PLATFORM_LINUX || defined PLATFORM_APPLE
|
||||
#include <sys/mman.h>
|
||||
#define PAGE_SIZE 4096
|
||||
#define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
|
||||
|
@ -191,6 +191,8 @@ def AddNormalLibrary(name, dest):
|
||||
def AddHL2Library(name, dest):
|
||||
for i in SM.sdkInfo:
|
||||
sdk = SM.sdkInfo[i]
|
||||
if AMBuild.target['platform'] not in sdk['platform']:
|
||||
continue
|
||||
AddNormalLibrary(name + '.' + sdk['ext'], dest)
|
||||
|
||||
pdb_list = []
|
||||
@ -198,6 +200,9 @@ pdb_list = []
|
||||
if AMBuild.target['platform'] == 'linux':
|
||||
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm_i486.so'),
|
||||
os.path.join('addons', 'sourcemod', 'bin')))
|
||||
elif AMBuild.target['platform'] == 'darwin':
|
||||
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dylib'),
|
||||
os.path.join('addons', 'sourcemod', 'bin')))
|
||||
elif AMBuild.target['platform'] == 'windows':
|
||||
bincopies.append(CopyFile(os.path.join('..', 'loader', 'sourcemod_mm.dll'),
|
||||
os.path.join('addons', 'sourcemod', 'bin')))
|
||||
@ -209,7 +214,8 @@ AddNormalLibrary('sourcepawn.jit.x86', 'bin')
|
||||
AddNormalLibrary('geoip.ext', 'extensions')
|
||||
AddNormalLibrary('dbi.mysql.ext', 'extensions')
|
||||
AddNormalLibrary('dbi.sqlite.ext', 'extensions')
|
||||
AddNormalLibrary('game.cstrike.ext.1.ep1', 'extensions')
|
||||
if AMBuild.target['platform'] != 'darwin':
|
||||
AddNormalLibrary('game.cstrike.ext.1.ep1', 'extensions')
|
||||
AddNormalLibrary('game.tf2.ext.2.ep2v', 'extensions')
|
||||
AddNormalLibrary('topmenus.ext', 'extensions')
|
||||
AddNormalLibrary('regex.ext', 'extensions')
|
||||
|
Loading…
Reference in New Issue
Block a user