Port simple C++ build scripts to AMBuild 2 (bug 5997 part 1, r=ds).
1.1 --- a/AMBuildScript Sat Dec 28 08:42:50 2013 -0500
1.2 +++ b/AMBuildScript Mon Dec 30 17:50:56 2013 -0500
1.3 @@ -1,529 +1,415 @@
1.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
1.5 -import os
1.6 -import sys
1.7 -from ambuild.command import Command
1.8 -from ambuild.command import ShellCommand
1.9 -from ambuild.command import SymlinkCommand
1.10 -
1.11 -class ExtractDebugInfoCommand(Command):
1.12 - def __init__(self, binary, outfile):
1.13 - Command.__init__(self)
1.14 - self.binary = binary
1.15 - self.outfile = outfile
1.16 -
1.17 - def run(self, runner, job):
1.18 - if AMBuild.cache['debug']:
1.19 - return
1.20 -
1.21 - if not self.binary.NeedsRelink(self.outfile):
1.22 - return
1.23 -
1.24 - if AMBuild.target['platform'] == 'linux':
1.25 - job.AddCommand(ShellCommand('objcopy --only-keep-debug ' + self.outfile + ' ' + self.outfile + '.dbg'))
1.26 - job.AddCommand(ShellCommand('objcopy --strip-debug ' + self.outfile))
1.27 - job.AddCommand(ShellCommand('objcopy --add-gnu-debuglink=' + os.path.basename(self.outfile) + '.dbg ' + self.outfile))
1.28 - elif AMBuild.target['platform'] == 'darwin':
1.29 - job.AddCommand(ShellCommand('dsymutil ' + self.outfile))
1.30 - job.AddCommand(ShellCommand('strip -S ' + self.outfile))
1.31 -
1.32 -class SM:
1.33 - def __init__(self):
1.34 - self.compiler = Cpp.Compiler()
1.35 -
1.36 - #Build SDK info
1.37 - self.possibleSdks = { }
1.38 - self.possibleSdks['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
1.39 - 'name': 'EPISODEONE', 'platform': ['windows', 'linux'],
1.40 - 'dir': 'hl2sdk'}
1.41 - self.possibleSdks['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
1.42 - 'name': 'ORANGEBOX', 'platform': ['windows', 'linux'],
1.43 - 'dir': 'hl2sdk-ob'}
1.44 - self.possibleSdks['css'] = {'sdk': 'HL2SDKCSS', 'ext': '2.css', 'def': '6',
1.45 - 'name': 'CSS', 'platform': ['windows', 'linux', 'darwin'],
1.46 - 'dir': 'hl2sdk-css'}
1.47 - self.possibleSdks['hl2dm'] = {'sdk': 'HL2SDKHL2DM', 'ext': '2.hl2dm', 'def': '7',
1.48 - 'name': 'HL2DM', 'platform': ['windows', 'linux', 'darwin'],
1.49 - 'dir': 'hl2sdk-hl2dm'}
1.50 - self.possibleSdks['dods'] = {'sdk': 'HL2SDKDODS', 'ext': '2.dods', 'def': '8',
1.51 - 'name': 'DODS', 'platform': ['windows', 'linux', 'darwin'],
1.52 - 'dir': 'hl2sdk-dods'}
1.53 - self.possibleSdks['sdk2013'] = {'sdk': 'HL2SDK2013', 'ext': '2.sdk2013', 'def': '9',
1.54 - 'name': 'SDK2013', 'platform': ['windows', 'linux', 'darwin'],
1.55 - 'dir': 'hl2sdk-2013'}
1.56 - self.possibleSdks['tf2'] = {'sdk': 'HL2SDKTF2', 'ext': '2.tf2', 'def': '10',
1.57 - 'name': 'TF2', 'platform': ['windows', 'linux', 'darwin'],
1.58 - 'dir': 'hl2sdk-tf2'}
1.59 - self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '11',
1.60 - 'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin'],
1.61 - 'dir': 'hl2sdk-l4d'}
1.62 - self.possibleSdks['nd'] = {'sdk': 'HL2SDKND', 'ext': '2.nd', 'def': '12',
1.63 - 'name': 'NUCLEARDAWN', 'platform': ['windows', 'linux', 'darwin'],
1.64 - 'dir': 'hl2sdk-nd'}
1.65 - self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '13',
1.66 - 'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin'],
1.67 - 'dir': 'hl2sdk-l4d2'}
1.68 - self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
1.69 - 'name': 'DARKMESSIAH', 'platform': ['windows'],
1.70 - 'dir': 'hl2sdk-darkm'}
1.71 - self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '14',
1.72 - 'name': 'ALIENSWARM', 'platform': ['windows'],
1.73 - 'dir': 'hl2sdk-swarm'}
1.74 - self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
1.75 - 'name': 'BLOODYGOODTIME', 'platform': ['windows'],
1.76 - 'dir': 'hl2sdk-bgt'}
1.77 - self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
1.78 - 'name': 'EYE', 'platform': ['windows'],
1.79 - 'dir': 'hl2sdk-eye'}
1.80 - self.possibleSdks['csgo'] = {'sdk': 'HL2SDKCSGO', 'ext': '2.csgo', 'def': '18',
1.81 - 'name': 'CSGO', 'platform': ['windows', 'linux', 'darwin'],
1.82 - 'dir': 'hl2sdk-csgo'}
1.83 - self.possibleSdks['dota'] = {'sdk': 'HL2SDKDOTA', 'ext': '2.dota', 'def': '19',
1.84 - 'name': 'DOTA', 'platform': ['windows'],
1.85 - 'dir': 'hl2sdk-dota'}
1.86 - self.possibleSdks['portal2'] = {'sdk': 'HL2SDKPORTAL2','ext': '2.portal2', 'def': '15',
1.87 - 'name': 'PORTAL2', 'platform': [],
1.88 - 'dir': 'hl2sdk-portal2'}
1.89 - self.possibleSdks['blade'] = {'sdk': 'HL2SDKBLADE', 'ext': '2.blade', 'def': '16',
1.90 - 'name': 'BLADE', 'platform': ['windows', 'linux'],
1.91 - 'dir': 'hl2sdk-blade'}
1.92 - self.possibleSdks['insurgency'] = {'sdk': 'HL2SDKINSURGENCY', 'ext': '2.insurgency', 'def': '17',
1.93 - 'name': 'INSURGENCY', 'platform': ['windows', 'linux', 'darwin'],
1.94 - 'dir': 'hl2sdk-insurgency'}
1.95 -
1.96 - self.sdkInfo = { }
1.97 -
1.98 - if AMBuild.mode == 'config':
1.99 - #Detect compilers
1.100 - self.compiler.DetectAll(AMBuild)
1.101 -
1.102 - self.hasMySql = AMBuild.options.hasMySql
1.103 - AMBuild.cache.CacheVariable('hasMySql', self.hasMySql)
1.104 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
1.105 +import os, sys
1.106
1.107 - AMBuild.cache.CacheVariable('debug', AMBuild.options.debug)
1.108 -
1.109 - #Environment variable paths to external headers
1.110 - envvars = { 'MMSOURCE110': 'mmsource-1.10', 'MYSQL5': 'mysql-5.0' }
1.111 -
1.112 - #Look for Metamod:Source and MySQL if not disabled
1.113 - for env in envvars:
1.114 - if not self.hasMySql and env == 'MYSQL5':
1.115 - continue
1.116 - path = self.ResolveEnvPath(env, envvars[env])
1.117 - if path == None:
1.118 - raise Exception('Could not find a valid path for {0}'.format(env))
1.119 - AMBuild.cache.CacheVariable(env, path)
1.120 -
1.121 - #Look for SDK directories
1.122 - for sdk in self.possibleSdks:
1.123 - #Get list of SDKs to build against or 'all' or 'present'
1.124 - sdkList = AMBuild.options.sdks.split(',')
1.125 - #Build against all supported SDKs?
1.126 - useAll = sdkList[0] == 'all'
1.127 - #Build against supported SDKs that exist?
1.128 - usePresent = sdkList[0] == 'present'
1.129 -
1.130 - info = self.possibleSdks[sdk]
1.131 - if AMBuild.target['platform'] in info['platform']:
1.132 - env = info['sdk']
1.133 - dir = info['dir']
1.134 - sdkPath = self.ResolveEnvPath(env, dir)
1.135 - if sdkPath == None:
1.136 - if useAll or sdk in sdkList:
1.137 - raise Exception('Could not find a valid path for {0}'.format(env))
1.138 - else:
1.139 - continue
1.140 - if useAll or usePresent or sdk in sdkList:
1.141 - self.sdkInfo[sdk] = info
1.142 - AMBuild.cache.CacheVariable(env, sdkPath)
1.143 -
1.144 - if len(self.sdkInfo) < 1:
1.145 - raise Exception('At least one SDK must be available.')
1.146 -
1.147 - AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
1.148 -
1.149 - #Set up defines
1.150 - cxx = self.compiler.cxx
1.151 - if isinstance(cxx, Cpp.CompatGCC):
1.152 - if isinstance(cxx, Cpp.GCC):
1.153 - self.vendor = 'gcc'
1.154 - elif isinstance(cxx, Cpp.Clang):
1.155 - self.vendor = 'clang'
1.156 - self.compiler.AddToListVar('CDEFINES', 'stricmp=strcasecmp')
1.157 - self.compiler.AddToListVar('CDEFINES', '_stricmp=strcasecmp')
1.158 - self.compiler.AddToListVar('CDEFINES', '_snprintf=snprintf')
1.159 - self.compiler.AddToListVar('CDEFINES', '_vsnprintf=vsnprintf')
1.160 - self.compiler.AddToListVar('CFLAGS', '-pipe')
1.161 - self.compiler.AddToListVar('CFLAGS', '-fno-strict-aliasing')
1.162 - if (self.vendor == 'gcc' and cxx.majorVersion >= 4) or self.vendor == 'clang':
1.163 - self.compiler.AddToListVar('CFLAGS', '-fvisibility=hidden')
1.164 - self.compiler.AddToListVar('CXXFLAGS', '-fvisibility-inlines-hidden')
1.165 - self.compiler.AddToListVar('CFLAGS', '-Wall')
1.166 - self.compiler.AddToListVar('CFLAGS', '-Werror')
1.167 - if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 6) or self.vendor == 'clang':
1.168 - self.compiler.AddToListVar('CFLAGS', '-Wno-narrowing')
1.169 - self.compiler.AddToListVar('CFLAGS', '-Wno-uninitialized')
1.170 - self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
1.171 - self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
1.172 - self.compiler.AddToListVar('CFLAGS', '-msse')
1.173 - self.compiler.AddToListVar('CFLAGS', '-g3')
1.174 - self.compiler.AddToListVar('CFLAGS', '-m32')
1.175 - self.compiler.AddToListVar('POSTLINKFLAGS', '-m32')
1.176 - self.compiler.AddToListVar('CXXFLAGS', '-fno-exceptions')
1.177 - self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics')
1.178 - self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor')
1.179 - self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual')
1.180 - if (self.vendor == 'gcc' and cxx.majorVersion >= 4 and cxx.minorVersion >= 7) or \
1.181 - (self.vendor == 'clang' and cxx.majorVersion >= 3):
1.182 - self.compiler.AddToListVar('CXXFLAGS', '-Wno-delete-non-virtual-dtor')
1.183 - self.compiler.AddToListVar('CDEFINES', 'HAVE_STDINT_H')
1.184 - self.compiler.AddToListVar('CDEFINES', 'GNUC')
1.185 - if self.vendor == 'gcc':
1.186 - self.compiler.AddToListVar('CFLAGS', '-mfpmath=sse')
1.187 - elif isinstance(cxx, Cpp.MSVC):
1.188 - self.vendor = 'msvc'
1.189 - if AMBuild.options.debug == '1':
1.190 - self.compiler.AddToListVar('CFLAGS', '/MTd')
1.191 - self.compiler.AddToListVar('POSTLINKFLAGS', '/NODEFAULTLIB:libcmt')
1.192 - else:
1.193 - self.compiler.AddToListVar('CFLAGS', '/MT')
1.194 - self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_DEPRECATE')
1.195 - self.compiler.AddToListVar('CDEFINES', '_CRT_SECURE_NO_WARNINGS')
1.196 - self.compiler.AddToListVar('CDEFINES', '_CRT_NONSTDC_NO_DEPRECATE')
1.197 - self.compiler.AddToListVar('CDEFINES', '_ITERATOR_DEBUG_LEVEL=0')
1.198 - self.compiler.AddToListVar('CXXFLAGS', '/EHsc')
1.199 - self.compiler.AddToListVar('CXXFLAGS', '/GR-')
1.200 - self.compiler.AddToListVar('CFLAGS', '/W3')
1.201 - self.compiler.AddToListVar('CFLAGS', '/nologo')
1.202 - self.compiler.AddToListVar('CFLAGS', '/Zi')
1.203 - self.compiler.AddToListVar('CXXFLAGS', '/TP')
1.204 - self.compiler.AddToListVar('POSTLINKFLAGS', '/DEBUG')
1.205 - self.compiler.AddToListVar('POSTLINKFLAGS', '/MACHINE:X86')
1.206 - self.compiler.AddToListVar('POSTLINKFLAGS', '/SUBSYSTEM:WINDOWS')
1.207 - self.compiler.AddToListVar('POSTLINKFLAGS', 'kernel32.lib')
1.208 - self.compiler.AddToListVar('POSTLINKFLAGS', 'user32.lib')
1.209 - self.compiler.AddToListVar('POSTLINKFLAGS', 'gdi32.lib')
1.210 - self.compiler.AddToListVar('POSTLINKFLAGS', 'winspool.lib')
1.211 - self.compiler.AddToListVar('POSTLINKFLAGS', 'comdlg32.lib')
1.212 - self.compiler.AddToListVar('POSTLINKFLAGS', 'advapi32.lib')
1.213 - self.compiler.AddToListVar('POSTLINKFLAGS', 'shell32.lib')
1.214 - self.compiler.AddToListVar('POSTLINKFLAGS', 'ole32.lib')
1.215 - self.compiler.AddToListVar('POSTLINKFLAGS', 'oleaut32.lib')
1.216 - self.compiler.AddToListVar('POSTLINKFLAGS', 'uuid.lib')
1.217 - self.compiler.AddToListVar('POSTLINKFLAGS', 'odbc32.lib')
1.218 - self.compiler.AddToListVar('POSTLINKFLAGS', 'odbccp32.lib')
1.219 -
1.220 - #Optimization
1.221 - if AMBuild.options.opt == '1':
1.222 - self.compiler.AddToListVar('CDEFINES', 'NDEBUG')
1.223 - if self.vendor == 'gcc' or self.vendor == 'clang':
1.224 - self.compiler.AddToListVar('CFLAGS', '-O3')
1.225 - elif self.vendor == 'msvc':
1.226 - self.compiler.AddToListVar('CFLAGS', '/Ox')
1.227 - self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:ICF')
1.228 - self.compiler.AddToListVar('POSTLINKFLAGS', '/OPT:REF')
1.229 -
1.230 - #Debugging
1.231 - if AMBuild.options.debug == '1':
1.232 - self.compiler.AddToListVar('CDEFINES', 'DEBUG')
1.233 - self.compiler.AddToListVar('CDEFINES', '_DEBUG')
1.234 - if self.vendor == 'msvc':
1.235 - self.compiler.AddToListVar('CFLAGS', '/Od')
1.236 - self.compiler.AddToListVar('CFLAGS', '/RTC1')
1.237 -
1.238 - #This needs to be after our optimization flags which could otherwise disable it.
1.239 - if self.vendor == 'msvc':
1.240 - # Don't omit frame pointer
1.241 - self.compiler.AddToListVar('CFLAGS', '/Oy-')
1.242 +class SDK(object):
1.243 + def __init__(self, sdk, ext, aDef, name, platform, dir):
1.244 + if dir == 'ep1':
1.245 + folder = 'hl2sdk'
1.246 + else:
1.247 + folder = 'hl2sdk-' + dir
1.248 + self.envvar = sdk
1.249 + self.ext = ext
1.250 + self.code = aDef
1.251 + self.define = name
1.252 + self.platform = platform
1.253 + self.folder = folder # Default folder name.
1.254 + self.name = dir
1.255 + self.path = None # Actual path
1.256
1.257 - #Platform-specifics
1.258 - if AMBuild.target['platform'] == 'linux':
1.259 - self.compiler.AddToListVar('CDEFINES', '_LINUX')
1.260 - self.compiler.AddToListVar('CDEFINES', 'POSIX')
1.261 - if self.vendor == 'gcc':
1.262 - self.compiler.AddToListVar('POSTLINKFLAGS', '-static-libgcc')
1.263 - if self.vendor == 'clang':
1.264 - self.compiler.AddToListVar('POSTLINKFLAGS', '-lgcc_eh')
1.265 - elif AMBuild.target['platform'] == 'darwin':
1.266 - self.compiler.AddToListVar('CDEFINES', 'OSX')
1.267 - self.compiler.AddToListVar('CDEFINES', '_OSX')
1.268 - self.compiler.AddToListVar('CDEFINES', 'POSIX')
1.269 - self.compiler.AddToListVar('POSTLINKFLAGS', '-mmacosx-version-min=10.5')
1.270 - self.compiler.AddToListVar('POSTLINKFLAGS', ['-arch', 'i386'])
1.271 - self.compiler.AddToListVar('POSTLINKFLAGS', '-lstdc++')
1.272 -
1.273 - # For OS X dylib versioning
1.274 - import re
1.275 - productFile = open(os.path.join(AMBuild.sourceFolder, 'product.version'), 'r')
1.276 - productContents = productFile.read()
1.277 - productFile.close()
1.278 - m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
1.279 - if m == None:
1.280 - self.version = '1.0.0'
1.281 - else:
1.282 - major, minor, release = m.groups()
1.283 - self.version = '{0}.{1}.{2}'.format(major, minor, release)
1.284 - AMBuild.cache.CacheVariable('version', self.version)
1.285 - elif AMBuild.target['platform'] == 'windows':
1.286 - self.compiler.AddToListVar('CDEFINES', 'WIN32')
1.287 - self.compiler.AddToListVar('CDEFINES', '_WINDOWS')
1.288 -
1.289 - #Finish up
1.290 - self.compiler.AddToListVar('CDEFINES', 'SOURCEMOD_BUILD')
1.291 - self.compiler.AddToListVar('CDEFINES', 'SM_GENERATED_BUILD')
1.292 - self.compiler.AddToListVar('CINCLUDES',
1.293 - os.path.join(AMBuild.outputFolder, 'includes'))
1.294 - self.compiler.ToConfig(AMBuild, 'compiler')
1.295 - AMBuild.cache.CacheVariable('vendor', self.vendor)
1.296 - self.targetMap = { }
1.297 - AMBuild.cache.CacheVariable('targetMap', self.targetMap)
1.298 - else:
1.299 - self.sdkInfo = AMBuild.cache['sdkInfo']
1.300 - self.compiler.FromConfig(AMBuild, 'compiler')
1.301 - self.targetMap = AMBuild.cache['targetMap']
1.302 - self.hasMySql = AMBuild.cache['hasMySql']
1.303 -
1.304 - if AMBuild.target['platform'] == 'windows':
1.305 - self.compiler.AddToListVar('RCINCLUDES', os.path.join(AMBuild.sourceFolder, 'public'))
1.306 - self.compiler.AddToListVar('RCINCLUDES',
1.307 - os.path.join(AMBuild.outputFolder, 'includes'))
1.308 - self.mmsPath = AMBuild.cache['MMSOURCE110']
1.309 -
1.310 - def DefaultCompiler(self):
1.311 - return self.compiler.Clone()
1.312 -
1.313 - def JobMatters(self, jobname):
1.314 - file = sys._getframe().f_code.co_filename
1.315 - if AMBuild.mode == 'config':
1.316 - self.targetMap[jobname] = file
1.317 - return True
1.318 - if len(AMBuild.args) == 0:
1.319 - return True
1.320 - if not jobname in AMBuild.args:
1.321 - return False
1.322 -
1.323 - def DefaultExtCompiler(self, path):
1.324 - compiler = self.DefaultCompiler()
1.325 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path))
1.326 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, path, 'sdk'))
1.327 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
1.328 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'extensions'))
1.329 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
1.330 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'amtl'))
1.331 - return compiler
1.332 -
1.333 - def AutoVersion(self, folder, binary):
1.334 - if AMBuild.target['platform'] == 'windows':
1.335 - env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
1.336 - binary.AddResourceFile(os.path.join(folder, 'version.rc' ), env)
1.337 - elif AMBuild.target['platform'] == 'darwin' and isinstance(binary, Cpp.LibraryBuilder):
1.338 - binary.compiler['POSTLINKFLAGS'].extend(['-compatibility_version', '1.0.0'])
1.339 - binary.compiler['POSTLINKFLAGS'].extend(['-current_version', AMBuild.cache['version']])
1.340 - else:
1.341 - return
1.342 -
1.343 - def ExtractDebugInfo(self, job, binary):
1.344 - src = os.path.join('..', AMBuild.outputFolder, job.workFolder, binary.binaryFile)
1.345 - job.AddCommand(ExtractDebugInfoCommand(binary, src))
1.346 +WinOnly = ['windows']
1.347 +WinLinux = ['windows', 'linux']
1.348 +WinLinuxMac = ['windows', 'linux', 'mac']
1.349
1.350 - def PreSetupHL2Job(self, job, builder, sdk):
1.351 - info = self.sdkInfo[sdk]
1.352 - sdkPath = AMBuild.cache[info['sdk']]
1.353 - if AMBuild.target['platform'] == 'linux':
1.354 - if sdk == 'ep1':
1.355 - staticLibs = os.path.join(sdkPath, 'linux_sdk')
1.356 - elif sdk == 'sdk2013':
1.357 - staticLibs = os.path.join(sdkPath, 'lib', 'public', 'linux32')
1.358 - else:
1.359 - staticLibs = os.path.join(sdkPath, 'lib', 'linux')
1.360 - workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
1.361 - libs = []
1.362 - if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'l4d2']:
1.363 - libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
1.364 - elif sdk in ['l4d', 'nd', 'blade', 'insurgency', 'csgo']:
1.365 - libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.so', 'libtier0.so']
1.366 - if sdk in ['blade', 'insurgency', 'csgo']:
1.367 - libs.append('interfaces_i486.a')
1.368 - elif sdk == 'sdk2013':
1.369 - libs = ['tier1.a', 'mathlib.a', 'libvstdlib_srv.so', 'libtier0_srv.so']
1.370 - else:
1.371 - libs = ['tier1_i486.a', 'mathlib_i486.a', 'vstdlib_i486.so', 'tier0_i486.so']
1.372 -
1.373 - for lib in libs:
1.374 - link = os.path.join(workFolder, lib)
1.375 - target = os.path.join(staticLibs, lib)
1.376 - try:
1.377 - os.lstat(link)
1.378 - except:
1.379 - job.AddCommand(SymlinkCommand(link, target))
1.380 - elif AMBuild.target['platform'] == 'darwin':
1.381 - if sdk == 'sdk2013':
1.382 - staticLibs = os.path.join(sdkPath, 'lib', 'public', 'osx32')
1.383 - libs = ['tier1.a', 'mathlib.a', 'libvstdlib.dylib', 'libtier0.dylib']
1.384 - else:
1.385 - staticLibs = os.path.join(sdkPath, 'lib', 'mac')
1.386 - libs = ['tier1_i486.a', 'mathlib_i486.a', 'libvstdlib.dylib', 'libtier0.dylib']
1.387 - workFolder = os.path.join(AMBuild.outputFolder, job.workFolder)
1.388 - if sdk in ['insurgency', 'csgo']:
1.389 - libs.append('interfaces_i486.a')
1.390 - for lib in libs:
1.391 - link = os.path.join(workFolder, lib)
1.392 - target = os.path.join(staticLibs, lib)
1.393 - try:
1.394 - os.lstat(link)
1.395 - except:
1.396 - job.AddCommand(SymlinkCommand(link, target))
1.397 - elif AMBuild.target['platform'] == 'windows':
1.398 - libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
1.399 - if sdk in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
1.400 - libs.append('interfaces')
1.401 - for lib in libs:
1.402 - libPath = os.path.join(sdkPath, 'lib', 'public', lib) + '.lib'
1.403 - builder.RebuildIfNewer(libPath)
1.404 - builder['POSTLINKFLAGS'].append(libPath)
1.405 -
1.406 - def PostSetupHL2Job(self, job, builder, sdk):
1.407 - if AMBuild.target['platform'] in ['linux', 'darwin']:
1.408 - if sdk == 'sdk2013':
1.409 - builder.AddObjectFiles(['tier1.a', 'mathlib.a'])
1.410 - else:
1.411 - builder.AddObjectFiles(['tier1_i486.a', 'mathlib_i486.a'])
1.412 -
1.413 - if sdk in ['blade', 'insurgency', 'csgo']:
1.414 - builder.AddObjectFiles(['interfaces_i486.a'])
1.415 -
1.416 - def DefaultHL2Compiler(self, path, sdk, noLink = False, oldMms = '-legacy'):
1.417 - compiler = self.DefaultExtCompiler(path)
1.418 -
1.419 - mms = 'core'
1.420 - if sdk == 'ep1':
1.421 - mms += oldMms
1.422 -
1.423 - compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
1.424 - compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
1.425 -
1.426 - info = self.possibleSdks
1.427 - compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
1.428 -
1.429 - paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
1.430 - ['public', 'tier0'], ['public', 'tier1']]
1.431 - if sdk == 'ep1' or sdk == 'darkm':
1.432 - paths.append(['public', 'dlls'])
1.433 - paths.append(['game_shared'])
1.434 - else:
1.435 - paths.append(['public', 'game', 'server'])
1.436 - paths.append(['public', 'toolframework'])
1.437 - paths.append(['game', 'shared'])
1.438 - paths.append(['common'])
1.439 -
1.440 - info = self.sdkInfo[sdk]
1.441 - sdkPath = AMBuild.cache[info['sdk']]
1.442 -
1.443 - compiler['CDEFINES'].append('SOURCE_ENGINE=' + info['def'])
1.444 -
1.445 - if sdk == 'sdk2013' and isinstance(compiler.cxx, Cpp.CompatGCC):
1.446 - # The 2013 SDK already has these in public/tier0/basetypes.h
1.447 - compiler['CDEFINES'].remove('stricmp=strcasecmp')
1.448 - compiler['CDEFINES'].remove('_stricmp=strcasecmp')
1.449 - compiler['CDEFINES'].remove('_snprintf=snprintf')
1.450 - compiler['CDEFINES'].remove('_vsnprintf=vsnprintf')
1.451 -
1.452 - if sdk in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
1.453 - if AMBuild.target['platform'] == 'windows':
1.454 - compiler['CDEFINES'].extend(['COMPILER_MSVC', 'COMPILER_MSVC32'])
1.455 - else:
1.456 - compiler['CDEFINES'].extend(['COMPILER_GCC'])
1.457 -
1.458 - if sdk == 'sdk2013' and AMBuild.target['platform'] == 'darwin':
1.459 - compiler['POSTLINKFLAGS'].append('-liconv')
1.460 -
1.461 - if sdk in ['css','hl2dm','dods','sdk2013','tf2','l4d2']:
1.462 - if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
1.463 - compiler['CDEFINES'].append('NO_MALLOC_OVERRIDE')
1.464 -
1.465 - if AMBuild.target['platform'] == 'linux':
1.466 - if sdk == 'ep1':
1.467 - staticLibs = os.path.join(sdkPath, 'linux_sdk')
1.468 - elif sdk == 'sdk2013':
1.469 - staticLibs = os.path.join(sdkPath, 'lib', 'public', 'linux32')
1.470 - else:
1.471 - staticLibs = os.path.join(sdkPath, 'lib', 'linux')
1.472 - elif AMBuild.target['platform'] == 'darwin':
1.473 - if sdk == 'sdk2013':
1.474 - staticLibs = os.path.join(sdkPath, 'lib', 'public', 'osx32')
1.475 - else:
1.476 - staticLibs = os.path.join(sdkPath, 'lib', 'mac')
1.477 -
1.478 - for i in paths:
1.479 - compiler['CXXINCLUDES'].append(os.path.join(sdkPath, *i))
1.480 -
1.481 - if not noLink:
1.482 - if AMBuild.target['platform'] == 'linux':
1.483 - compiler['POSTLINKFLAGS'][0:0] = ['-lm']
1.484 - if sdk in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'l4d2']:
1.485 - compiler['POSTLINKFLAGS'][0:0] = ['libtier0_srv.so']
1.486 - compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib_srv.so']
1.487 - elif sdk in ['l4d', 'nd', 'blade', 'insurgency', 'csgo']:
1.488 - compiler['POSTLINKFLAGS'][0:0] = ['libtier0.so']
1.489 - compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.so']
1.490 - else:
1.491 - compiler['POSTLINKFLAGS'][0:0] = ['tier0_i486.so']
1.492 - compiler['POSTLINKFLAGS'][0:0] = ['vstdlib_i486.so']
1.493 - elif AMBuild.target['platform'] == 'darwin':
1.494 - compiler['POSTLINKFLAGS'][0:0] = ['libtier0.dylib']
1.495 - compiler['POSTLINKFLAGS'][0:0] = ['libvstdlib.dylib']
1.496 -
1.497 - return compiler
1.498 -
1.499 - def ResolveEnvPath(self, env, defaultDir):
1.500 - if env in os.environ:
1.501 - path = os.environ[env]
1.502 - if os.path.isdir(path):
1.503 - return path
1.504 - else:
1.505 - head = os.getcwd()
1.506 - oldhead = None
1.507 - while head != None and head != oldhead:
1.508 - path = os.path.join(head, defaultDir)
1.509 - if os.path.isdir(path):
1.510 - return path
1.511 - oldhead = head
1.512 - head, tail = os.path.split(head)
1.513 - return None
1.514 -
1.515 -sm = SM()
1.516 -globals = {
1.517 - 'SM': sm
1.518 +PossibleSDKs = {
1.519 + 'ep1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'ep1'),
1.520 + 'ep2': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'ob'),
1.521 + 'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', WinLinuxMac, 'css'),
1.522 + 'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', WinLinuxMac, 'hl2dm'),
1.523 + 'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', WinLinuxMac, 'dods'),
1.524 + 'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, '2013'),
1.525 + 'tf2': SDK('HL2SDKTF2', '2.tf2', '10', 'TF2', WinLinuxMac, 'tf2'),
1.526 + 'l4d': SDK('HL2SDKL4D', '2.l4d', '11', 'LEFT4DEAD', WinLinuxMac, 'l4d'),
1.527 + 'nd': SDK('HL2SDKND', '2.nd', '12', 'NUCLEARDAWN', WinLinuxMac, 'nd'),
1.528 + 'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '13', 'LEFT4DEAD2', WinLinuxMac, 'l4d2'),
1.529 + 'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'),
1.530 + 'swarm': SDK('HL2SDK-SWARM', '2.swarm', '14', 'ALIENSWARM', WinOnly, 'swarm'),
1.531 + 'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
1.532 + 'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
1.533 + 'csgo': SDK('HL2SDKCSGO', '2.csgo', '18', 'CSGO', WinLinuxMac, 'csgo'),
1.534 + 'dota': SDK('HL2SDKDOTA', '2.dota', '19', 'DOTA', WinOnly, 'dota'),
1.535 + 'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '15', 'PORTAL2', [], 'portal2'),
1.536 + 'blade': SDK('HL2SDKBLADE', '2.blade', '16', 'BLADE', WinLinux, 'blade'),
1.537 + 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '17', 'INSURGENCY', WinLinuxMac, 'insurgency'),
1.538 }
1.539
1.540 -AMBuild.Include(os.path.join('tools', 'buildbot', 'Versioning'), globals)
1.541 +def ResolveEnvPath(env, folder):
1.542 + if env in os.environ:
1.543 + path = os.environ[env]
1.544 + if os.path.isdir(path):
1.545 + return path
1.546 + else:
1.547 + head = os.getcwd()
1.548 + oldhead = None
1.549 + while head != None and head != oldhead:
1.550 + path = os.path.join(head, folder)
1.551 + if os.path.isdir(path):
1.552 + return path
1.553 + oldhead = head
1.554 + head, tail = os.path.split(head)
1.555 + return None
1.556 +
1.557 +class SMConfig(object):
1.558 + def __init__(self):
1.559 + self.sdks = {}
1.560 + self.binaries = []
1.561 + self.mms_root = None
1.562 + self.mysql_root = None
1.563 +
1.564 + def detectSDKs(self):
1.565 + sdk_list = builder.options.sdks.split(',')
1.566 + use_all = sdk_list[0] == 'all'
1.567 + use_present = sdk_list[0] == 'present'
1.568 +
1.569 + for sdk_name in PossibleSDKs:
1.570 + sdk = PossibleSDKs[sdk_name]
1.571 + if builder.target_platform in sdk.platform:
1.572 + sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder)
1.573 + if sdk_path is None:
1.574 + if use_all or sdk_name in sdk_list:
1.575 + raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
1.576 + continue
1.577 + if use_all or use_present or sdk_name in sdk_list:
1.578 + sdk.path = sdk_path
1.579 + self.sdks[sdk_name] = sdk
1.580 +
1.581 + if len(self.sdks) < 1:
1.582 + raise Exception('At least one SDK must be available.')
1.583 +
1.584 + self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10')
1.585 + if not self.mms_root:
1.586 + self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central')
1.587 + if not self.mms_root:
1.588 + raise Exception('Could not find a source copy of Metamod:Source')
1.589 +
1.590 + if builder.options.hasMySql:
1.591 + for i in range(7):
1.592 + self.mysql_root = ResolveEnvPath('MYSQL5', 'mysql-5.' + str(i))
1.593 + if self.mysql_root:
1.594 + break
1.595 + if not self.mysql_root:
1.596 + raise Exception('Could not find a path to MySQL!')
1.597 +
1.598 + def configure(self):
1.599 + cfg = builder.DetectCompilers()
1.600 + cxx = cfg.cxx
1.601 +
1.602 + if cxx.behavior is 'gcc':
1.603 + cfg.defines += [
1.604 + 'stricmp=strcasecmp',
1.605 + '_stricmp=strcasecmp',
1.606 + '_snprintf=snprintf',
1.607 + '_vsnprintf=vsnprintf',
1.608 + 'HAVE_STDINT_H',
1.609 + 'GNUC',
1.610 + ]
1.611 + cfg.cflags += [
1.612 + '-pipe',
1.613 + '-fno-strict-aliasing',
1.614 + '-Wall',
1.615 + '-Werror',
1.616 + '-Wno-uninitialized',
1.617 + '-Wno-unused',
1.618 + '-Wno-switch',
1.619 + '-msse',
1.620 + '-m32',
1.621 + '-g3',
1.622 + ]
1.623 +
1.624 + have_gcc = cxx.name is 'gcc'
1.625 + have_clang = cxx.name is 'clang'
1.626 + if have_clang or (have_gcc and cxx.majorVersion >= 4):
1.627 + cfg.cflags += ['-fvisibility=hidden']
1.628 + cfg.cxxflags += ['-fvisibility-inlines-hidden']
1.629 + if have_clang or (have_gcc and cxx.minorVersion >= 6):
1.630 + cfg.cflags += ['-Wno-narrowing']
1.631 + if (have_gcc and cxx.minorVersion >= 7) or (have_clang and cxx.majorVersion >= 4):
1.632 + cfg.cxxflags += ['-Wno-delete-non-virtual-dtor']
1.633 +
1.634 + cfg.linkflags += ['-m32']
1.635 + cfg.cxxflags += [
1.636 + '-fno-exceptions',
1.637 + '-fno-threadsafe-statics',
1.638 + '-Wno-non-virtual-dtor',
1.639 + '-Wno-overloaded-virtual',
1.640 + ]
1.641 +
1.642 + if have_gcc:
1.643 + cfg.cflags += ['-mfpmath=sse']
1.644 + elif cxx.name == 'msvc':
1.645 + if builder.options.debug == '1':
1.646 + cfg.cflags += ['/MTd']
1.647 + cfg.linkflags += ['/NODEFAULTLIB:libcmt']
1.648 + else:
1.649 + cfg.cflags += ['/MT']
1.650 + cfg.defines += [
1.651 + '_CRT_SECURE_NO_DEPRECATE',
1.652 + '_CRT_SECURE_NO_WARNINGS',
1.653 + '_CRT_NONSTDC_NO_DEPRECATE',
1.654 + '_ITERATOR_DEBUG_LEVEL=0',
1.655 + ]
1.656 + cfg.cflags += [
1.657 + '/W3',
1.658 + '/Zi',
1.659 + ]
1.660 + cfg.cxxflags += [
1.661 + '/EHsc',
1.662 + '/GR-',
1.663 + '/TP',
1.664 + ]
1.665 + cfg.linkflags += [
1.666 + '/DEBUG',
1.667 + '/MACHINE:X86',
1.668 + '/SUBSYSTEM:WINDOWS',
1.669 + 'kernel32.lib',
1.670 + 'user32.lib',
1.671 + 'gdi32.lib',
1.672 + 'winspool.lib',
1.673 + 'comdlg32.lib',
1.674 + 'advapi32.lib',
1.675 + 'shell32.lib',
1.676 + 'ole32.lib',
1.677 + 'oleaut32.lib',
1.678 + 'uuid.lib',
1.679 + 'odbc32.lib',
1.680 + 'odbccp32.lib',
1.681 + ]
1.682 +
1.683 + # Optimization
1.684 + if builder.options.opt == '1':
1.685 + cfg.defines += ['NDEBUG']
1.686 + if cxx.behavior == 'gcc':
1.687 + cfg.cflags += ['-O3']
1.688 + elif cxx.behavior == 'msvc':
1.689 + cfg.cflags += ['/Ox']
1.690 + cfg.linkflags += ['/OPT:ICF', '/OPT:REF']
1.691 +
1.692 + # Debugging
1.693 + if builder.options.debug == '1':
1.694 + cfg.defines += ['DEBUG', '_DEBUG']
1.695 + if cxx.behavior == 'gcc':
1.696 + cfg.cflags += ['-g3']
1.697 + elif cxx.behavior == 'msvc':
1.698 + cfg.cflags += ['/Od', '/RTC1']
1.699 +
1.700 + # This needs to be after our optimization flags which could otherwise disable it.
1.701 + if cxx.name == 'msvc':
1.702 + # Don't omit the frame pointer.
1.703 + cfg.cflags += ['/Oy-']
1.704 +
1.705 + # Platform-specifics
1.706 + if builder.target_platform == 'linux':
1.707 + cfg.defines += ['_LINUX', 'POSIX']
1.708 + if cxx.name == 'gcc':
1.709 + cfg.linkflags += ['-static-libgcc']
1.710 + elif cxx.name == 'clang':
1.711 + cfg.linkflags += ['-lgcc_eh']
1.712 + elif builder.target_platform == 'mac':
1.713 + cfg.defines += ['OSX', '_OSX', 'POSIX']
1.714 + cfg.linkflags += [
1.715 + '-mmacosx-version-min=10.5',
1.716 + '-arch', 'i386',
1.717 + '-lstdc++',
1.718 + ]
1.719 + elif builder.target_platform == 'windows':
1.720 + cfg.defines += ['WIN32', '_WINDOWS']
1.721
1.722 -FileList = [
1.723 - ['loader', 'AMBuilder'],
1.724 - ['core', 'AMBuilder'],
1.725 - ['core', 'logic', 'AMBuilder'],
1.726 - ['extensions', 'bintools', 'AMBuilder'],
1.727 - ['extensions', 'clientprefs', 'AMBuilder'],
1.728 - ['extensions', 'cstrike', 'AMBuilder'],
1.729 - ['extensions', 'curl', 'AMBuilder'],
1.730 - ['extensions', 'geoip', 'AMBuilder'],
1.731 - ['extensions', 'mysql', 'AMBuilder'],
1.732 - ['extensions', 'sdkhooks', 'AMBuilder'],
1.733 - ['extensions', 'sdktools', 'AMBuilder'],
1.734 - ['extensions', 'topmenus', 'AMBuilder'],
1.735 - ['extensions', 'updater', 'AMBuilder'],
1.736 - ['extensions', 'sqlite', 'AMBuilder'],
1.737 - ['extensions', 'regex', 'AMBuilder'],
1.738 - ['extensions', 'tf2', 'AMBuilder'],
1.739 - ['sourcepawn', 'jit', 'AMBuilder'],
1.740 - ['sourcepawn', 'compiler', 'AMBuilder'],
1.741 - ['plugins', 'AMBuilder'],
1.742 - ['tools', 'buildbot', 'PackageScript'],
1.743 - ['tools', 'buildbot', 'BreakpadSymbols']
1.744 - ]
1.745 + # Finish up.
1.746 + cfg.defines += [
1.747 + 'SOURCEMOD_BUILD',
1.748 + ]
1.749 + cfg.includes += [os.path.join(builder.buildPath, 'includes')]
1.750 +
1.751 + def LibraryBuilder(self, compiler, name):
1.752 + binary = compiler.Library(name)
1.753 + return binary
1.754 +
1.755 + def ProgramBuilder(self, compiler, name):
1.756 + binary = compiler.Program(name)
1.757 + return binary
1.758 +
1.759 + def Library(self, context, name):
1.760 + compiler = context.compiler.clone()
1.761 + return self.LibraryBuilder(compiler, name)
1.762 +
1.763 + def Program(self, context, name):
1.764 + compiler = context.compiler.clone()
1.765 + return self.ProgramBuilder(compiler, name)
1.766 +
1.767 + def ExtCompiler(self, context):
1.768 + compiler = context.compiler.clone()
1.769 + compiler.cxxincludes += [
1.770 + os.path.join(context.currentSourcePath),
1.771 + os.path.join(context.currentSourcePath, 'sdk'),
1.772 + os.path.join(builder.sourcePath, 'public'),
1.773 + os.path.join(builder.sourcePath, 'public', 'extensions'),
1.774 + os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
1.775 + os.path.join(builder.sourcePath, 'public', 'amtl'),
1.776 + ]
1.777 + return compiler
1.778 +
1.779 + def HL2Compiler(self, context, sdk):
1.780 + compiler = self.ExtCompiler(context)
1.781 +
1.782 + if sdk.name == 'ep1':
1.783 + mms_path = os.path.join(self.mms_root, 'core-legacy')
1.784 + else:
1.785 + mms_path = os.path.join(self.mms_root, 'core')
1.786 +
1.787 + compiler.cxxincludes += [
1.788 + os.path.join(mms_path),
1.789 + os.path.join(mms_path, 'sourcehook'),
1.790 + ]
1.791 +
1.792 + defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
1.793 + compiler.defines += defines
1.794 + paths = [
1.795 + ['public'],
1.796 + ['public', 'engine'],
1.797 + ['public', 'mathlib'],
1.798 + ['public', 'vstdlib'],
1.799 + ['public', 'tier0'],
1.800 + ['public', 'tier1']
1.801 + ]
1.802 + if sdk.name == 'ep1' or sdk.name == 'darkm':
1.803 + paths.append(['public', 'dlls'])
1.804 + paths.append(['game_shared'])
1.805 + else:
1.806 + paths.append(['public', 'game', 'server'])
1.807 + paths.append(['public', 'toolframework'])
1.808 + paths.append(['game', 'shared'])
1.809 + paths.append(['common'])
1.810 +
1.811 + compiler.defines += ['SOURCE_ENGINE=' + sdk.code]
1.812 +
1.813 + if sdk.name == '2013' and compiler.cxx.behavior == 'gcc':
1.814 + # The 2013 SDK already has these in public/tier0/basetypes.h
1.815 + compiler.defines.remove('stricmp=strcasecmp')
1.816 + compiler.defines.remove('_stricmp=strcasecmp')
1.817 + compiler.defines.remove('_snprintf=snprintf')
1.818 + compiler.defines.remove('_vsnprintf=vsnprintf')
1.819 +
1.820 + if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
1.821 + if compiler.cc.behavior == 'msvc':
1.822 + compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32']
1.823 + else:
1.824 + compiler.defines += ['COMPILER_GCC']
1.825 +
1.826 + if sdk.name in ['css', 'hl2dm', 'dods', '2013', 'tf2', 'l4d2']:
1.827 + if builder.target_platform in ['linux', 'mac']:
1.828 + compiler.defines += ['NO_MALLOC_OVERRIDE']
1.829 +
1.830 + for path in paths:
1.831 + compiler.cxxincludes += [os.path.join(sdk.path, *path)]
1.832 +
1.833 + return compiler
1.834 +
1.835 + def ExtLibrary(self, context, name):
1.836 + compiler = self.ExtCompiler(context)
1.837 + return self.LibraryBuilder(compiler, name)
1.838
1.839 -if not sm.hasMySql:
1.840 - FileList.remove(['extensions', 'mysql', 'AMBuilder'])
1.841 + def HL2Library(self, context, name, sdk):
1.842 + compiler = self.HL2Compiler(context, sdk)
1.843 +
1.844 + if builder.target_platform is 'linux':
1.845 + if sdk.name is 'ep1':
1.846 + lib_folder = os.path.join(sdk.path, 'linux_sdk')
1.847 + elif sdk.name is '2013':
1.848 + lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
1.849 + else:
1.850 + lib_folder = os.path.join(sdk.path, 'lib', 'linux')
1.851 + elif builder.target_platform == 'mac':
1.852 + if sdk.name is '2013':
1.853 + lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
1.854 + else:
1.855 + lib_folder = os.path.join(sdk.path, 'lib', 'mac')
1.856 +
1.857 + if builder.target_platform in ['linux', 'mac']:
1.858 + if sdk.name is '2013':
1.859 + compiler.postlink += [
1.860 + compiler.Dep(os.path.join(lib_folder, 'tier1.a')),
1.861 + compiler.Dep(os.path.join(lib_folder, 'mathlib.a'))
1.862 + ]
1.863 + else:
1.864 + compiler.postlink += [
1.865 + compiler.Dep(os.path.join(lib_folder, 'tier1_i486.a')),
1.866 + compiler.Dep(os.path.join(lib_folder, 'mathlib_i486.a'))
1.867 + ]
1.868 +
1.869 + if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
1.870 + compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
1.871 +
1.872 + binary = self.LibraryBuilder(compiler, name)
1.873
1.874 -for parts in FileList:
1.875 - AMBuild.Include(os.path.join(*parts), globals)
1.876 + dynamic_libs = []
1.877 + if builder.target_platform == 'linux':
1.878 + compiler.linkflags[0:0] = ['-lm']
1.879 + if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', '2013', 'l4d2']:
1.880 + dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
1.881 + elif sdk.name in ['l4d', 'nd', 'blade', 'insurgency', 'csgo']:
1.882 + dynamic_libs = ['libtier0.so', 'libvstdlib.so']
1.883 + else:
1.884 + dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
1.885 + elif builder.target_platform == 'mac':
1.886 + binary.compiler.linkflags.append('-liconv')
1.887 + dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
1.888 + elif builder.target_platform == 'windows':
1.889 + libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
1.890 + if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
1.891 + libs.append('interfaces')
1.892 + for lib in libs:
1.893 + lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
1.894 + binary.compiler.linkflags.append(binary.Dep(lib_path))
1.895 +
1.896 + for library in dynamic_libs:
1.897 + source_path = os.path.join(lib_folder, library)
1.898 + output_path = os.path.join(binary.localFolder, library)
1.899 +
1.900 + def make_linker(source_path, output_path):
1.901 + def link(context, binary):
1.902 + cmd_node, (output,) = context.AddSymlink(source_path, output_path)
1.903 + return output
1.904 + return link
1.905
1.906 + linker = make_linker(source_path, output_path)
1.907 + binary.compiler.linkflags[0:0] = [binary.Dep(library, linker)]
1.908 +
1.909 + return binary
1.910 +
1.911 +SM = SMConfig()
1.912 +SM.detectSDKs()
1.913 +SM.configure()
1.914 +
1.915 +builder.RunBuildScripts(
1.916 + [
1.917 + 'loader/AMBuilder',
1.918 + 'core/AMBuilder',
1.919 + 'core/logic/AMBuilder',
1.920 + 'extensions/bintools/AMBuilder',
1.921 + 'extensions/clientprefs/AMBuilder',
1.922 + 'extensions/cstrike/AMBuilder',
1.923 + 'extensions/geoip/AMBuilder',
1.924 + 'extensions/mysql/AMBuilder',
1.925 + 'extensions/regex/AMBuilder',
1.926 + 'extensions/sdkhooks/AMBuilder',
1.927 + 'extensions/sdktools/AMBuilder',
1.928 + 'extensions/sqlite/AMBuilder',
1.929 + 'extensions/tf2/AMBuilder',
1.930 + 'extensions/topmenus/AMBuilder',
1.931 + 'extensions/updater/AMBuilder',
1.932 + 'sourcepawn/compiler/AMBuilder',
1.933 + 'sourcepawn/jit/AMBuilder',
1.934 + ],
1.935 + {
1.936 + 'SM': SM
1.937 + }
1.938 +)
2.1 --- a/configure.py Sat Dec 28 08:42:50 2013 -0500
2.2 +++ b/configure.py Mon Dec 30 17:50:56 2013 -0500
2.3 @@ -1,8 +1,19 @@
2.4 # vim: set ts=2 sw=2 tw=99 noet:
2.5 import sys
2.6 -import ambuild.runner as runner
2.7 +try:
2.8 + from ambuild2 import run
2.9 +except:
2.10 + try:
2.11 + import ambuild
2.12 + sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
2.13 + sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
2.14 + except:
2.15 + sys.stderr.write('AMBuild must be installed to build this project.\n')
2.16 + sys.stderr.write('http://www.alliedmods.net/ambuild\n')
2.17 + sys.exit(1)
2.18
2.19 -run = runner.Runner()
2.20 +run = run.PrepareBuild(sourcePath=sys.path[0])
2.21 +run.default_build_folder = 'obj-' + run.target_platform
2.22 run.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
2.23 help='Enable debugging symbols')
2.24 run.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
2.25 @@ -12,4 +23,4 @@
2.26 run.options.add_option('-s', '--sdks', default='all', dest='sdks',
2.27 help='Build against specified SDKs; valid args are "all", "present", or '
2.28 'comma-delimited list of engine names (default: %default)')
2.29 -run.Configure(sys.path[0])
2.30 +run.Configure()
3.1 --- a/core/AMBuilder Sat Dec 28 08:42:50 2013 -0500
3.2 +++ b/core/AMBuilder Mon Dec 30 17:50:56 2013 -0500
3.3 @@ -1,137 +1,110 @@
3.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
3.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
3.6 import os
3.7 -from ambuild.command import SymlinkCommand
3.8 -
3.9 -for i in SM.sdkInfo:
3.10 - sdk = SM.sdkInfo[i]
3.11 - if AMBuild.target['platform'] not in sdk['platform']:
3.12 - continue
3.13 -
3.14 - name = 'sourcemod.' + sdk['ext']
3.15 -
3.16 - compiler = SM.DefaultHL2Compiler('core', i)
3.17
3.18 - if i == 'csgo':
3.19 - # Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
3.20 - if isinstance(compiler.cxx, Cpp.CompatGCC):
3.21 - compiler.AddToListVar('CFLAGS', '-Wno-sign-compare')
3.22 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.3.0', 'src'))
3.23 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
3.24 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'csgo', 'protobuf'))
3.25 - elif i == 'dota':
3.26 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'common', 'protobuf-2.4.1', 'src'))
3.27 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'engine', 'protobuf'))
3.28 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'protobuf'))
3.29 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'public', 'game', 'shared', 'dota', 'protobuf'))
3.30 +for sdk_name in SM.sdks:
3.31 + sdk = SM.sdks[sdk_name]
3.32 + binary_name = 'sourcemod.' + sdk.ext
3.33 +
3.34 + binary = SM.HL2Library(builder, binary_name, sdk)
3.35 + compiler = binary.compiler
3.36
3.37 - extension = AMBuild.AddJob(name)
3.38 - binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
3.39 - SM.PreSetupHL2Job(extension, binary, i)
3.40 -
3.41 - if AMBuild.target['platform'] == 'linux':
3.42 - compiler['POSTLINKFLAGS'].append('-lpthread')
3.43 - compiler['POSTLINKFLAGS'].append('-lrt')
3.44 + if sdk.name is 'csgo':
3.45 + # Protobuf 2.3 headers have some signed/unsigned compares. I believe that it's fixed in later versions, but Valve.
3.46 + if compiler.cxx.behavior is 'gcc':
3.47 + compiler.cflags += ['-Wno-sign-compare']
3.48 + compiler.cxxincludes += [
3.49 + os.path.join(sdk.path, 'common', 'protobuf-2.3.0', 'src'),
3.50 + os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
3.51 + os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf')
3.52 + ]
3.53 + elif sdk.name is 'dota':
3.54 + compiler.cxxincludes += [
3.55 + os.path.join(sdk.path, 'common', 'protobuf-2.4.1', 'src'),
3.56 + os.path.join(sdk.path, 'public', 'engine', 'protobuf'),
3.57 + os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf'),
3.58 + os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf')
3.59 + ]
3.60
3.61 - if i in ['csgo', 'dota']:
3.62 - if AMBuild.target['platform'] == 'linux':
3.63 - link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
3.64 - target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'linux32', 'release'), 'libprotobuf.a')
3.65 - try:
3.66 - os.lstat(link)
3.67 - except:
3.68 - extension.AddCommand(SymlinkCommand(link, target))
3.69 - elif AMBuild.target['platform'] == 'darwin':
3.70 - link = os.path.join(os.path.join(AMBuild.outputFolder, extension.workFolder), 'libprotobuf.a')
3.71 - target = os.path.join(os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'osx32', 'release'), 'libprotobuf.a')
3.72 - try:
3.73 - os.lstat(link)
3.74 - except:
3.75 - extension.AddCommand(SymlinkCommand(link, target))
3.76 - elif AMBuild.target['platform'] == 'windows':
3.77 - if 'DEBUG' in compiler['CDEFINES']:
3.78 - libPath = os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'win32', 'debug', 'vs2010', 'libprotobuf.lib')
3.79 - else:
3.80 - libPath = os.path.join(AMBuild.cache[sdk['sdk']], 'lib', 'win32', 'release', 'vs2010', 'libprotobuf.lib')
3.81 - binary.RebuildIfNewer(libPath)
3.82 - binary['POSTLINKFLAGS'].append(libPath)
3.83 + if builder.target_platform is 'linux':
3.84 + compiler.postlink += ['-lpthread', '-lrt']
3.85 +
3.86 + if sdk.name is 'csgo' or sdk.name is 'dota':
3.87 + if builder.target_platform is 'linux':
3.88 + lib_path = os.path.join(sdk.path, 'lib', 'linux32', 'release', 'libprotobuf.a')
3.89 + elif builder.target_platform is 'mac':
3.90 + lib_path = os.path.join(sdk.path, 'lib', 'osx32', 'release', 'libprotobuf.a')
3.91 + elif builder.target_platform is 'windows':
3.92 + if 'DEBUG' in compiler.defines:
3.93 + lib_path = os.path.join(sdk.path, 'lib', 'win32', 'debug', 'vs2010', 'libprotobuf.lib')
3.94 + else:
3.95 + lib_path = os.path.join(sdk.path, 'lib', 'win32', 'release', 'vs2010', 'libprotobuf.lib')
3.96 + compiler.linkflags.insert(0, binary.Dep(lib_path))
3.97
3.98 - files = [
3.99 - 'AdminCache.cpp',
3.100 - 'MenuStyle_Valve.cpp',
3.101 - 'logic_bridge.cpp',
3.102 - 'smn_entities.cpp',
3.103 - 'sm_stringutil.cpp',
3.104 - 'MenuVoting.cpp',
3.105 - 'smn_events.cpp',
3.106 - 'smn_menus.cpp',
3.107 - 'sm_trie.cpp',
3.108 - 'CDataPack.cpp',
3.109 - 'frame_hooks.cpp',
3.110 - 'smn_nextmap.cpp',
3.111 - 'sourcemm_api.cpp',
3.112 - 'ChatTriggers.cpp',
3.113 - 'smn_player.cpp',
3.114 - 'sourcemod.cpp',
3.115 - 'concmd_cleaner.cpp',
3.116 - 'HalfLife2.cpp',
3.117 - 'NextMap.cpp',
3.118 - 'ConCmdManager.cpp',
3.119 - 'ConVarManager.cpp',
3.120 - 'LibrarySys.cpp',
3.121 - 'PlayerManager.cpp',
3.122 - 'TimerSys.cpp',
3.123 - 'CoreConfig.cpp',
3.124 - 'Logger.cpp',
3.125 - 'smn_halflife.cpp',
3.126 - 'smn_console.cpp',
3.127 - 'UserMessages.cpp',
3.128 - 'MenuManager.cpp',
3.129 - 'smn_core.cpp',
3.130 - 'smn_hudtext.cpp',
3.131 - 'smn_usermsgs.cpp',
3.132 - 'MenuStyle_Base.cpp',
3.133 - 'smn_keyvalues.cpp',
3.134 - 'smn_vector.cpp',
3.135 - 'EventManager.cpp',
3.136 - 'MenuStyle_Radio.cpp',
3.137 - 'sm_autonatives.cpp',
3.138 - 'sm_srvcmds.cpp',
3.139 - 'ConsoleDetours.cpp'
3.140 - ]
3.141 -
3.142 - if i in ['csgo', 'dota']:
3.143 - files.append('smn_protobuf.cpp')
3.144 - else:
3.145 - files.append('smn_bitbuffer.cpp')
3.146 + binary.sources += [
3.147 + 'AdminCache.cpp',
3.148 + 'MenuStyle_Valve.cpp',
3.149 + 'logic_bridge.cpp',
3.150 + 'smn_entities.cpp',
3.151 + 'sm_stringutil.cpp',
3.152 + 'MenuVoting.cpp',
3.153 + 'smn_events.cpp',
3.154 + 'smn_menus.cpp',
3.155 + 'sm_trie.cpp',
3.156 + 'CDataPack.cpp',
3.157 + 'frame_hooks.cpp',
3.158 + 'smn_nextmap.cpp',
3.159 + 'sourcemm_api.cpp',
3.160 + 'ChatTriggers.cpp',
3.161 + 'smn_player.cpp',
3.162 + 'sourcemod.cpp',
3.163 + 'concmd_cleaner.cpp',
3.164 + 'HalfLife2.cpp',
3.165 + 'NextMap.cpp',
3.166 + 'ConCmdManager.cpp',
3.167 + 'ConVarManager.cpp',
3.168 + 'LibrarySys.cpp',
3.169 + 'PlayerManager.cpp',
3.170 + 'TimerSys.cpp',
3.171 + 'CoreConfig.cpp',
3.172 + 'Logger.cpp',
3.173 + 'smn_halflife.cpp',
3.174 + 'smn_console.cpp',
3.175 + 'UserMessages.cpp',
3.176 + 'MenuManager.cpp',
3.177 + 'smn_core.cpp',
3.178 + 'smn_hudtext.cpp',
3.179 + 'smn_usermsgs.cpp',
3.180 + 'MenuStyle_Base.cpp',
3.181 + 'smn_keyvalues.cpp',
3.182 + 'smn_vector.cpp',
3.183 + 'EventManager.cpp',
3.184 + 'MenuStyle_Radio.cpp',
3.185 + 'sm_autonatives.cpp',
3.186 + 'sm_srvcmds.cpp',
3.187 + 'ConsoleDetours.cpp'
3.188 + ]
3.189 +
3.190 + if sdk.name in ['csgo', 'dota']:
3.191 + binary.sources += ['smn_protobuf.cpp']
3.192 + else:
3.193 + binary.sources += ['smn_bitbuffer.cpp']
3.194
3.195 - binary.AddSourceFiles('core', files)
3.196 + if sdk.name is 'csgo':
3.197 + binary.sources += [
3.198 + os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
3.199 + os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
3.200 + os.path.join(sdk.path, 'public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
3.201 + ]
3.202 + elif sdk.name is 'dota':
3.203 + binary.sources += [
3.204 + os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
3.205 + os.path.join(sdk.path, 'public', 'engine', 'protobuf', 'netmessages.pb.cc'),
3.206 + os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
3.207 + os.path.join(sdk.path, 'public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
3.208 + os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
3.209 + os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
3.210 + os.path.join(sdk.path, 'public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
3.211 + ]
3.212
3.213 - if i == 'csgo':
3.214 - files = [
3.215 - os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
3.216 - os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessages.pb.cc'),
3.217 - os.path.join('public', 'game', 'shared', 'csgo', 'protobuf', 'cstrike15_usermessage_helpers.cpp'),
3.218 - ]
3.219 - binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
3.220 - elif i == 'dota':
3.221 - files = [
3.222 - os.path.join('public', 'engine', 'protobuf', 'networkbasetypes.pb.cc'),
3.223 - os.path.join('public', 'engine', 'protobuf', 'netmessages.pb.cc'),
3.224 - os.path.join('public', 'game', 'shared', 'protobuf', 'ai_activity.pb.cc'),
3.225 - os.path.join('public', 'game', 'shared', 'protobuf', 'usermessages.pb.cc'),
3.226 - os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_commonmessages.pb.cc'),
3.227 - os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessages.pb.cc'),
3.228 - os.path.join('public', 'game', 'shared', 'dota', 'protobuf', 'dota_usermessage_helpers.cpp'),
3.229 - ]
3.230 - binary.AddSourceFiles(AMBuild.cache[sdk['sdk']], files)
3.231 + SM.binaries += [builder.Add(binary)]
3.232
3.233 - SM.PostSetupHL2Job(extension, binary, i)
3.234 -
3.235 - if i in ['csgo', 'dota']:
3.236 - if AMBuild.target['platform'] in ['linux', 'darwin']:
3.237 - binary.AddObjectFiles(['libprotobuf.a'])
3.238 -
3.239 - SM.AutoVersion('core', binary)
3.240 - SM.ExtractDebugInfo(extension, binary)
3.241 - binary.SendToJob()
3.242 -
4.1 --- a/core/logic/AMBuilder Sat Dec 28 08:42:50 2013 -0500
4.2 +++ b/core/logic/AMBuilder Mon Dec 30 17:50:56 2013 -0500
4.3 @@ -1,76 +1,72 @@
4.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
4.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
4.6 import os
4.7
4.8 -compiler = SM.DefaultCompiler()
4.9 -base = AMBuild.sourceFolder
4.10 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
4.11 -compiler['CXXINCLUDES'].append(os.path.join(base, 'core', 'logic'))
4.12 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
4.13 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
4.14 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'amtl'))
4.15 -compiler['CDEFINES'].append('SM_DEFAULT_THREADER')
4.16 -compiler['CDEFINES'].append('SM_LOGIC')
4.17 -
4.18 -if AMBuild.target['platform'] == 'linux':
4.19 - compiler['POSTLINKFLAGS'].append('-lpthread')
4.20 - compiler['POSTLINKFLAGS'].append('-lrt')
4.21 -if AMBuild.target['platform'] == 'darwin':
4.22 - compiler['CFLAGS'].extend(['-Wno-deprecated-declarations'])
4.23 - compiler['POSTLINKFLAGS'].extend(['-framework', 'CoreServices'])
4.24 +binary = SM.Library(builder, 'sourcemod.logic')
4.25 +binary.compiler.cxxincludes += [
4.26 + os.path.join(builder.sourcePath, 'core', 'logic'),
4.27 + os.path.join(builder.sourcePath, 'public'),
4.28 + os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
4.29 + os.path.join(builder.sourcePath, 'public', 'amtl'),
4.30 + os.path.join(SM.mms_root, 'core', 'sourcehook')
4.31 +]
4.32 +binary.compiler.defines += [
4.33 + 'SM_DEFAULT_THREADER',
4.34 + 'SM_LOGIC'
4.35 +]
4.36 +
4.37 +if builder.target_platform is 'linux':
4.38 + binary.compiler.postlink += ['-lpthread', '-lrt']
4.39 +elif builder.target_platform is 'mac':
4.40 + binary.compiler.cflags += ['-Wno-deprecated-declarations']
4.41 + binary.compiler.postlink += ['-framework', 'CoreServices']
4.42 +binary.sources += [
4.43 + 'common_logic.cpp',
4.44 + 'smn_adt_array.cpp',
4.45 + 'smn_sorting.cpp',
4.46 + 'smn_maplists.cpp',
4.47 + 'ADTFactory.cpp',
4.48 + 'smn_adt_stack.cpp',
4.49 + 'thread/ThreadWorker.cpp',
4.50 + 'thread/BaseWorker.cpp',
4.51 + 'ThreadSupport.cpp',
4.52 + 'smn_float.cpp',
4.53 + 'TextParsers.cpp',
4.54 + 'smn_textparse.cpp',
4.55 + 'smn_adt_trie.cpp',
4.56 + 'Profiler.cpp',
4.57 + 'smn_functions.cpp',
4.58 + 'smn_timers.cpp',
4.59 + 'smn_players.cpp',
4.60 + 'MemoryUtils.cpp',
4.61 + 'smn_admin.cpp',
4.62 + 'smn_banning.cpp',
4.63 + 'smn_filesystem.cpp',
4.64 + 'stringutil.cpp',
4.65 + 'Translator.cpp',
4.66 + 'PhraseCollection.cpp',
4.67 + 'smn_lang.cpp',
4.68 + 'smn_string.cpp',
4.69 + 'smn_handles.cpp',
4.70 + 'smn_datapacks.cpp',
4.71 + 'smn_gameconfigs.cpp',
4.72 + 'smn_fakenatives.cpp',
4.73 + 'GameConfigs.cpp',
4.74 + 'sm_crc32.cpp',
4.75 + 'smn_profiler.cpp',
4.76 + 'ShareSys.cpp',
4.77 + 'PluginSys.cpp',
4.78 + 'HandleSys.cpp',
4.79 + 'NativeOwner.cpp',
4.80 + 'NativeInvoker.cpp',
4.81 + 'ExtensionSys.cpp',
4.82 + 'DebugReporter.cpp',
4.83 + 'Database.cpp',
4.84 + 'smn_database.cpp',
4.85 + 'ForwardSys.cpp',
4.86 +]
4.87 +if builder.target_platform is 'windows':
4.88 + binary.sources += ['thread/WinThreads.cpp']
4.89 +else:
4.90 + binary.sources += ['thread/PosixThreads.cpp']
4.91
4.92 -extension = AMBuild.AddJob('sourcemod.logic')
4.93 -binary = Cpp.LibraryBuilder('sourcemod.logic', AMBuild, extension, compiler)
4.94 -files = [
4.95 - 'common_logic.cpp',
4.96 - 'smn_adt_array.cpp',
4.97 - 'smn_sorting.cpp',
4.98 - 'smn_maplists.cpp',
4.99 - 'ADTFactory.cpp',
4.100 - 'smn_adt_stack.cpp',
4.101 - 'thread/ThreadWorker.cpp',
4.102 - 'thread/BaseWorker.cpp',
4.103 - 'ThreadSupport.cpp',
4.104 - 'smn_float.cpp',
4.105 - 'TextParsers.cpp',
4.106 - 'smn_textparse.cpp',
4.107 - 'smn_adt_trie.cpp',
4.108 - 'Profiler.cpp',
4.109 - 'smn_functions.cpp',
4.110 - 'smn_timers.cpp',
4.111 - 'smn_players.cpp',
4.112 - 'MemoryUtils.cpp',
4.113 - 'smn_admin.cpp',
4.114 - 'smn_banning.cpp',
4.115 - 'smn_filesystem.cpp',
4.116 - 'stringutil.cpp',
4.117 - 'Translator.cpp',
4.118 - 'PhraseCollection.cpp',
4.119 - 'smn_lang.cpp',
4.120 - 'smn_string.cpp',
4.121 - 'smn_handles.cpp',
4.122 - 'smn_datapacks.cpp',
4.123 - 'smn_gameconfigs.cpp',
4.124 - 'smn_fakenatives.cpp',
4.125 - 'GameConfigs.cpp',
4.126 - 'sm_crc32.cpp',
4.127 - 'smn_profiler.cpp',
4.128 - 'ShareSys.cpp',
4.129 - 'PluginSys.cpp',
4.130 - 'HandleSys.cpp',
4.131 - 'NativeOwner.cpp',
4.132 - 'NativeInvoker.cpp',
4.133 - 'ExtensionSys.cpp',
4.134 - 'DebugReporter.cpp',
4.135 - 'Database.cpp',
4.136 - 'smn_database.cpp',
4.137 - 'ForwardSys.cpp',
4.138 - ]
4.139 -if AMBuild.target['platform'] == 'windows':
4.140 - files.append('thread/WinThreads.cpp')
4.141 -else:
4.142 - files.append('thread/PosixThreads.cpp')
4.143 -binary.AddSourceFiles('core/logic', files)
4.144 -SM.AutoVersion('core/logic', binary)
4.145 -SM.ExtractDebugInfo(extension, binary)
4.146 -binary.SendToJob()
4.147 -
4.148 +SM.binaries += [builder.Add(binary)]
5.1 --- a/extensions/bintools/AMBuilder Sat Dec 28 08:42:50 2013 -0500
5.2 +++ b/extensions/bintools/AMBuilder Mon Dec 30 17:50:56 2013 -0500
5.3 @@ -1,25 +1,23 @@
5.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
5.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
5.6 import os
5.7
5.8 -compiler = SM.DefaultExtCompiler('extensions/bintools')
5.9 -compiler['CDEFINES'].append('HOOKING_ENABLED')
5.10 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
5.11 -compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
5.12 -compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
5.13 +binary = SM.ExtLibrary(builder, 'bintools.ext')
5.14 +binary.compiler.defines += ['HOOKING_ENABLED']
5.15 +binary.compiler.cxxincludes += [
5.16 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
5.17 + os.path.join(builder.sourcePath, 'public', 'jit'),
5.18 + os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
5.19 +]
5.20
5.21 -extension = AMBuild.AddJob('bintools.ext')
5.22 -binary = Cpp.LibraryBuilder('bintools.ext', AMBuild, extension, compiler)
5.23 -binary.AddSourceFiles('extensions/bintools', [
5.24 - 'extension.cpp',
5.25 - 'CallMaker.cpp',
5.26 - 'CallWrapper.cpp',
5.27 - 'HookWrapper.cpp',
5.28 - 'jit_call.cpp',
5.29 - 'jit_hook.cpp',
5.30 - 'sdk/smsdk_ext.cpp'
5.31 - ])
5.32 -SM.AutoVersion('extensions/bintools', binary)
5.33 -SM.ExtractDebugInfo(extension, binary)
5.34 -binary.SendToJob()
5.35 +binary.sources += [
5.36 + 'extension.cpp',
5.37 + 'CallMaker.cpp',
5.38 + 'CallWrapper.cpp',
5.39 + 'HookWrapper.cpp',
5.40 + 'jit_call.cpp',
5.41 + 'jit_hook.cpp',
5.42 + 'sdk/smsdk_ext.cpp'
5.43 +]
5.44
5.45 +SM.binaries += [builder.Add(binary)]
5.46
6.1 --- a/extensions/clientprefs/AMBuilder Sat Dec 28 08:42:50 2013 -0500
6.2 +++ b/extensions/clientprefs/AMBuilder Mon Dec 30 17:50:56 2013 -0500
6.3 @@ -1,20 +1,19 @@
6.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
6.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
6.6 import os
6.7
6.8 -compiler = SM.DefaultExtCompiler('extensions/clientprefs')
6.9 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
6.10 +binary = SM.ExtLibrary(builder, 'clientprefs.ext')
6.11 +binary.compiler.cxxincludes += [
6.12 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
6.13 +]
6.14
6.15 -extension = AMBuild.AddJob('clientprefs.ext')
6.16 -binary = Cpp.LibraryBuilder('clientprefs.ext', AMBuild, extension, compiler)
6.17 -binary.AddSourceFiles('extensions/clientprefs', [
6.18 - 'extension.cpp',
6.19 - 'cookie.cpp',
6.20 - 'menus.cpp',
6.21 - 'natives.cpp',
6.22 - 'query.cpp',
6.23 - 'sdk/smsdk_ext.cpp'
6.24 - ])
6.25 -SM.AutoVersion('extensions/clientprefs', binary)
6.26 -SM.ExtractDebugInfo(extension, binary)
6.27 -binary.SendToJob()
6.28 +binary.sources += [
6.29 + 'extension.cpp',
6.30 + 'cookie.cpp',
6.31 + 'menus.cpp',
6.32 + 'natives.cpp',
6.33 + 'query.cpp',
6.34 + 'sdk/smsdk_ext.cpp'
6.35 +]
6.36
6.37 +SM.binaries += [builder.Add(binary)]
6.38 +
7.1 --- a/extensions/cstrike/AMBuilder Sat Dec 28 08:42:50 2013 -0500
7.2 +++ b/extensions/cstrike/AMBuilder Mon Dec 30 17:50:56 2013 -0500
7.3 @@ -1,33 +1,21 @@
7.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
7.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
7.6 import os
7.7
7.8 -for i in SM.sdkInfo:
7.9 - if i != 'css' and i != 'csgo':
7.10 - continue
7.11 -
7.12 - sdk = SM.sdkInfo[i]
7.13 -
7.14 - if AMBuild.target['platform'] not in sdk['platform']:
7.15 - continue
7.16 -
7.17 - compiler = SM.DefaultHL2Compiler('extensions/cstrike', i)
7.18 -
7.19 - name = 'game.cstrike.ext.' + sdk['ext']
7.20 - extension = AMBuild.AddJob(name)
7.21 - binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
7.22 - SM.PreSetupHL2Job(extension, binary, i)
7.23 - binary.AddSourceFiles('extensions/cstrike', [
7.24 - 'extension.cpp',
7.25 - 'natives.cpp',
7.26 - 'RegNatives.cpp',
7.27 - 'timeleft.cpp',
7.28 - 'forwards.cpp',
7.29 - 'util_cstrike.cpp',
7.30 - 'sdk/smsdk_ext.cpp',
7.31 - 'CDetour/detours.cpp',
7.32 - 'asm/asm.c'
7.33 - ])
7.34 - SM.PostSetupHL2Job(extension, binary, i)
7.35 - SM.AutoVersion('extensions/cstrike', binary)
7.36 - SM.ExtractDebugInfo(extension, binary)
7.37 - binary.SendToJob()
7.38 \ No newline at end of file
7.39 +for sdk_name in ['css', 'csgo']:
7.40 + if sdk_name not in SM.sdks:
7.41 + continue
7.42 + sdk = SM.sdks[sdk_name]
7.43 +
7.44 + binary = SM.HL2Library(builder, 'game.cstrike.ext.' + sdk.ext, sdk)
7.45 + binary.sources += [
7.46 + 'extension.cpp',
7.47 + 'natives.cpp',
7.48 + 'RegNatives.cpp',
7.49 + 'timeleft.cpp',
7.50 + 'forwards.cpp',
7.51 + 'util_cstrike.cpp',
7.52 + 'sdk/smsdk_ext.cpp',
7.53 + 'CDetour/detours.cpp',
7.54 + 'asm/asm.c'
7.55 + ]
7.56 + SM.binaries += [builder.Add(binary)]
8.1 --- a/extensions/geoip/AMBuilder Sat Dec 28 08:42:50 2013 -0500
8.2 +++ b/extensions/geoip/AMBuilder Mon Dec 30 17:50:56 2013 -0500
8.3 @@ -1,16 +1,15 @@
8.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
8.5 -compiler = SM.DefaultExtCompiler('extensions/geoip')
8.6 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
8.7 +import os
8.8 +
8.9 +binary = SM.ExtLibrary(builder, 'geoip.ext')
8.10 +if builder.target_platform is 'windows':
8.11 + binary.compiler.postlink += ['wsock32.lib']
8.12
8.13 -extension = AMBuild.AddJob('geoip.ext')
8.14 -binary = Cpp.LibraryBuilder('geoip.ext', AMBuild, extension, compiler)
8.15 -binary.AddSourceFiles('extensions/geoip', [
8.16 - 'extension.cpp',
8.17 - 'GeoIP.c',
8.18 - 'sdk/smsdk_ext.cpp'
8.19 - ])
8.20 -if AMBuild.target['platform'] == 'windows':
8.21 - binary['POSTLINKFLAGS'].append('wsock32.lib')
8.22 -SM.AutoVersion('extensions/geoip', binary)
8.23 -SM.ExtractDebugInfo(extension, binary)
8.24 -binary.SendToJob()
8.25 +binary.sources += [
8.26 + 'extension.cpp',
8.27 + 'GeoIP.c',
8.28 + 'sdk/smsdk_ext.cpp'
8.29 +]
8.30
8.31 +SM.binaries += [builder.Add(binary)]
8.32 +
9.1 --- a/extensions/mysql/AMBuilder Sat Dec 28 08:42:50 2013 -0500
9.2 +++ b/extensions/mysql/AMBuilder Mon Dec 30 17:50:56 2013 -0500
9.3 @@ -1,39 +1,35 @@
9.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
9.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
9.6 import os
9.7
9.8 -compiler = SM.DefaultExtCompiler('extensions/mysql')
9.9 -compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['MYSQL5'], 'include'))
9.10 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
9.11 -
9.12 -extension = AMBuild.AddJob('dbi.mysql.ext')
9.13 -binary = Cpp.LibraryBuilder('dbi.mysql.ext', AMBuild, extension, compiler)
9.14 +if SM.mysql_root:
9.15 + binary = SM.ExtLibrary(builder, 'dbi.mysql.ext')
9.16 + binary.compiler.cxxincludes += [
9.17 + os.path.join(SM.mysql_root, 'include'),
9.18 + os.path.join(SM.mms_root, 'core', 'sourcehook')
9.19 + ]
9.20
9.21 -if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
9.22 - lib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'libmysqlclient_r.a')
9.23 - link = [lib,
9.24 - '-lz',
9.25 - '-lpthread',
9.26 - '-lm']
9.27 - binary.RelinkIfNewer(lib)
9.28 - binary['POSTLINKFLAGS'].extend(link)
9.29 -elif AMBuild.target['platform'] == 'windows':
9.30 - mylib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'opt', 'mysqlclient.lib')
9.31 - zlib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'opt', 'zlib.lib')
9.32 - binary.RelinkIfNewer(mylib)
9.33 - binary.RelinkIfNewer(zlib)
9.34 - binary['POSTLINKFLAGS'].extend([mylib, zlib, 'wsock32.lib'])
9.35 + if builder.target_platform is 'linux' or builder.target_platform is 'darwin':
9.36 + binary.compiler.postlink += [
9.37 + os.path.join(SM.mysql_root, 'lib', 'libmysqlclient_r.a'),
9.38 + '-lz',
9.39 + '-lpthread',
9.40 + '-lm'
9.41 + ]
9.42 + elif builder.target_platform is 'windows':
9.43 + binary.compiler.postlink += [
9.44 + os.path.join(SM.mysql_root, 'lib', 'opt', 'mysqlclient.lib'),
9.45 + os.path.join(SM.mysql_root, 'lib', 'opt', 'zlib.lib'),
9.46 + 'wsock32.lib'
9.47 + ]
9.48
9.49 + binary.sources += [
9.50 + 'sdk/smsdk_ext.cpp',
9.51 + 'mysql/MyBasicResults.cpp',
9.52 + 'mysql/MyBoundResults.cpp',
9.53 + 'mysql/MyDatabase.cpp',
9.54 + 'mysql/MyDriver.cpp',
9.55 + 'mysql/MyStatement.cpp',
9.56 + 'extension.cpp'
9.57 + ]
9.58 + SM.binaries += [builder.Add(binary)]
9.59
9.60 -binary.AddSourceFiles('extensions/mysql', [
9.61 - 'sdk/smsdk_ext.cpp',
9.62 - 'mysql/MyBasicResults.cpp',
9.63 - 'mysql/MyBoundResults.cpp',
9.64 - 'mysql/MyDatabase.cpp',
9.65 - 'mysql/MyDriver.cpp',
9.66 - 'mysql/MyStatement.cpp',
9.67 - 'extension.cpp'
9.68 - ])
9.69 -SM.AutoVersion('extensions/mysql', binary)
9.70 -SM.ExtractDebugInfo(extension, binary)
9.71 -binary.SendToJob()
9.72 -
10.1 --- a/extensions/regex/AMBuilder Sat Dec 28 08:42:50 2013 -0500
10.2 +++ b/extensions/regex/AMBuilder Mon Dec 30 17:50:56 2013 -0500
10.3 @@ -1,28 +1,24 @@
10.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
10.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
10.6 import os
10.7
10.8 -compiler = SM.DefaultExtCompiler('extensions/regex')
10.9 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
10.10 -
10.11 -extension = AMBuild.AddJob('regex.ext')
10.12 -binary = Cpp.LibraryBuilder('regex.ext', AMBuild, extension, compiler)
10.13 -
10.14 -if AMBuild.target['platform'] == 'linux':
10.15 - path = os.path.join(AMBuild.sourceFolder, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
10.16 -elif AMBuild.target['platform'] == 'windows':
10.17 - path = os.path.join(AMBuild.sourceFolder, 'extensions', 'regex', 'lib_win', 'pcre.lib')
10.18 -elif AMBuild.target['platform'] == 'darwin':
10.19 - path = os.path.join(AMBuild.sourceFolder, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
10.20 +binary = SM.ExtLibrary(builder, 'regex.ext')
10.21 +binary.compiler.cxxincludes += [
10.22 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
10.23 +]
10.24
10.25 -binary.RelinkIfNewer(path)
10.26 -binary['POSTLINKFLAGS'].append(path)
10.27 +if builder.target_platform is 'linux':
10.28 + path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
10.29 +elif builder.target_platform is 'windows':
10.30 + path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win', 'pcre.lib')
10.31 +elif builder.target_platform is 'mac':
10.32 + path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
10.33 +binary.compiler.postlink += [binary.Dep(path)]
10.34
10.35 -binary.AddSourceFiles('extensions/regex', [
10.36 - 'extension.cpp',
10.37 - 'CRegEx.cpp',
10.38 - 'sdk/smsdk_ext.cpp',
10.39 - ])
10.40 -SM.AutoVersion('extensions/regex', binary)
10.41 -SM.ExtractDebugInfo(extension, binary)
10.42 -binary.SendToJob()
10.43 +binary.sources += [
10.44 + 'extension.cpp',
10.45 + 'CRegEx.cpp',
10.46 + 'sdk/smsdk_ext.cpp',
10.47 +]
10.48
10.49 +SM.binaries += [builder.Add(binary)]
10.50 +
11.1 --- a/extensions/sdkhooks/AMBuilder Sat Dec 28 08:42:50 2013 -0500
11.2 +++ b/extensions/sdkhooks/AMBuilder Mon Dec 30 17:50:56 2013 -0500
11.3 @@ -1,30 +1,21 @@
11.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
11.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
11.6 import os
11.7
11.8 -for i in SM.sdkInfo:
11.9 - sdk = SM.sdkInfo[i]
11.10 - if AMBuild.target['platform'] not in sdk['platform']:
11.11 - continue
11.12 -
11.13 - compiler = SM.DefaultHL2Compiler('extensions/sdkhooks', i)
11.14 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'game', 'shared'))
11.15 -
11.16 - if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
11.17 - compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
11.18 +for sdk_name in SM.sdks:
11.19 + sdk = SM.sdks[sdk_name]
11.20 +
11.21 + binary = SM.HL2Library(builder, 'sdkhooks.ext.' + sdk.ext, sdk)
11.22 + binary.compiler.cxxincludes += [
11.23 + os.path.join(sdk.path, 'game', 'shared')
11.24 + ]
11.25 + if binary.compiler.cxx.behavior is 'gcc':
11.26 + binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
11.27
11.28 - name = 'sdkhooks.ext.' + sdk['ext']
11.29 - extension = AMBuild.AddJob(name)
11.30 - binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
11.31 - SM.PreSetupHL2Job(extension, binary, i)
11.32 - binary.AddSourceFiles('extensions/sdkhooks', [
11.33 - 'extension.cpp',
11.34 - 'natives.cpp',
11.35 - 'takedamageinfohack.cpp',
11.36 - 'util.cpp',
11.37 - 'sdk/smsdk_ext.cpp',
11.38 - ])
11.39 - SM.PostSetupHL2Job(extension, binary, i)
11.40 - SM.AutoVersion('extensions/sdkhooks', binary)
11.41 - SM.ExtractDebugInfo(extension, binary)
11.42 - binary.SendToJob()
11.43 -
11.44 + binary.sources += [
11.45 + 'extension.cpp',
11.46 + 'natives.cpp',
11.47 + 'takedamageinfohack.cpp',
11.48 + 'util.cpp',
11.49 + 'sdk/smsdk_ext.cpp',
11.50 + ]
11.51 + SM.binaries += [builder.Add(binary)]
12.1 --- a/extensions/sdktools/AMBuilder Sat Dec 28 08:42:50 2013 -0500
12.2 +++ b/extensions/sdktools/AMBuilder Mon Dec 30 17:50:56 2013 -0500
12.3 @@ -1,52 +1,45 @@
12.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
12.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
12.6 import os
12.7
12.8 -for i in SM.sdkInfo:
12.9 - sdk = SM.sdkInfo[i]
12.10 - if AMBuild.target['platform'] not in sdk['platform']:
12.11 - continue
12.12 +for sdk_name in SM.sdks:
12.13 + sdk = SM.sdks[sdk_name]
12.14
12.15 - compiler = SM.DefaultHL2Compiler('extensions/sdktools', i)
12.16 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
12.17 - compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
12.18 + binary = SM.HL2Library(builder, 'sdktools.ext.' + sdk.ext, sdk)
12.19 + binary.compiler.cxxincludes += [
12.20 + os.path.join(sdk.path, 'game', 'shared'),
12.21 + os.path.join(builder.sourcePath, 'public', 'jit'),
12.22 + os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
12.23 + ]
12.24
12.25 - if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
12.26 - compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
12.27 + if sdk.name != 'ep1':
12.28 + binary.compiler.defines += ['HOOKING_ENABLED']
12.29
12.30 - if i != 'ep1':
12.31 - compiler['CDEFINES'].append('HOOKING_ENABLED')
12.32 + if binary.compiler.cxx.behavior is 'gcc':
12.33 + binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
12.34
12.35 - name = 'sdktools.ext.' + sdk['ext']
12.36 - extension = AMBuild.AddJob(name)
12.37 - binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
12.38 - SM.PreSetupHL2Job(extension, binary, i)
12.39 - binary.AddSourceFiles('extensions/sdktools', [
12.40 - 'extension.cpp',
12.41 - 'inputnatives.cpp',
12.42 - 'output.cpp',
12.43 - 'outputnatives.cpp',
12.44 - 'tempents.cpp',
12.45 - 'tenatives.cpp',
12.46 - 'teamnatives.cpp',
12.47 - 'trnatives.cpp',
12.48 - 'vcaller.cpp',
12.49 - 'vcallbuilder.cpp',
12.50 - 'vdecoder.cpp',
12.51 - 'vglobals.cpp',
12.52 - 'vhelpers.cpp',
12.53 - 'vnatives.cpp',
12.54 - 'voice.cpp',
12.55 - 'vsound.cpp',
12.56 - 'clientnatives.cpp',
12.57 - 'hooks.cpp',
12.58 - 'gamerulesnatives.cpp',
12.59 - 'vstringtable.cpp',
12.60 - 'CDetour/detours.cpp',
12.61 - 'sdk/smsdk_ext.cpp',
12.62 - 'asm/asm.c'
12.63 - ])
12.64 - SM.PostSetupHL2Job(extension, binary, i)
12.65 - SM.AutoVersion('extensions/sdktools', binary)
12.66 - SM.ExtractDebugInfo(extension, binary)
12.67 - binary.SendToJob()
12.68 -
12.69 + binary.sources += [
12.70 + 'extension.cpp',
12.71 + 'inputnatives.cpp',
12.72 + 'output.cpp',
12.73 + 'outputnatives.cpp',
12.74 + 'tempents.cpp',
12.75 + 'tenatives.cpp',
12.76 + 'teamnatives.cpp',
12.77 + 'trnatives.cpp',
12.78 + 'vcaller.cpp',
12.79 + 'vcallbuilder.cpp',
12.80 + 'vdecoder.cpp',
12.81 + 'vglobals.cpp',
12.82 + 'vhelpers.cpp',
12.83 + 'vnatives.cpp',
12.84 + 'voice.cpp',
12.85 + 'vsound.cpp',
12.86 + 'clientnatives.cpp',
12.87 + 'hooks.cpp',
12.88 + 'gamerulesnatives.cpp',
12.89 + 'vstringtable.cpp',
12.90 + 'CDetour/detours.cpp',
12.91 + 'sdk/smsdk_ext.cpp',
12.92 + 'asm/asm.c'
12.93 + ]
12.94 + SM.binaries += [builder.Add(binary)]
13.1 --- a/extensions/sqlite/AMBuilder Sat Dec 28 08:42:50 2013 -0500
13.2 +++ b/extensions/sqlite/AMBuilder Mon Dec 30 17:50:56 2013 -0500
13.3 @@ -1,22 +1,28 @@
13.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
13.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
13.6 import os
13.7
13.8 -compiler = SM.DefaultExtCompiler('extensions/sqlite')
13.9 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
13.10 +binary = SM.ExtLibrary(builder, 'dbi.sqlite.ext')
13.11 +binary.compiler.cxxincludes += [
13.12 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
13.13 +]
13.14
13.15 -compiler['CDEFINES'].extend(['SQLITE_OMIT_LOAD_EXTENSION', 'SQLITE_THREADSAFE'])
13.16 -if AMBuild.target['platform'] == 'linux':
13.17 - compiler['POSTLINKFLAGS'].extend(['-ldl', '-lpthread'])
13.18 +binary.compiler.defines += [
13.19 + 'SQLITE_OMIT_LOAD_EXTENSION',
13.20 + 'SQLITE_THREADSAFE'
13.21 +]
13.22 +if builder.target_platform is 'linux':
13.23 + binary.compiler.postlink += ['-ldl', '-lpthread']
13.24
13.25 -extension = AMBuild.AddJob('dbi.sqlite.ext')
13.26 -binary = Cpp.LibraryBuilder('dbi.sqlite.ext', AMBuild, extension, compiler)
13.27 -files = [
13.28 - 'sdk/smsdk_ext.cpp', 'sdk/sm_memtable.cpp', 'extension.cpp',
13.29 - 'driver/SqDatabase.cpp', 'driver/SqDriver.cpp', 'driver/SqQuery.cpp',
13.30 - 'driver/SqResults.cpp', 'sqlite-source/sqlite3.c'
13.31 - ]
13.32 -binary.AddSourceFiles('extensions/sqlite', files)
13.33 -SM.AutoVersion('extensions/sqlite', binary)
13.34 -SM.ExtractDebugInfo(extension, binary)
13.35 -binary.SendToJob()
13.36 +binary.sources += [
13.37 + 'sdk/smsdk_ext.cpp',
13.38 + 'sdk/sm_memtable.cpp',
13.39 + 'extension.cpp',
13.40 + 'driver/SqDatabase.cpp',
13.41 + 'driver/SqDriver.cpp',
13.42 + 'driver/SqQuery.cpp',
13.43 + 'driver/SqResults.cpp',
13.44 + 'sqlite-source/sqlite3.c'
13.45 +]
13.46
13.47 +SM.binaries += [builder.Add(binary)]
13.48 +
14.1 --- a/extensions/tf2/AMBuilder Sat Dec 28 08:42:50 2013 -0500
14.2 +++ b/extensions/tf2/AMBuilder Mon Dec 30 17:50:56 2013 -0500
14.3 @@ -1,14 +1,11 @@
14.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
14.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
14.6 import os
14.7 -if 'tf2' in SM.sdkInfo:
14.8 - sdk = SM.sdkInfo['tf2']
14.9 - compiler = SM.DefaultHL2Compiler('extensions/tf2', 'tf2')
14.10
14.11 - name = 'game.tf2.ext.' + sdk['ext']
14.12 - extension = AMBuild.AddJob(name)
14.13 - binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
14.14 - SM.PreSetupHL2Job(extension, binary, 'tf2')
14.15 - binary.AddSourceFiles('extensions/tf2', [
14.16 +if 'tf2' in SM.sdks:
14.17 + sdk = SM.sdks['tf2']
14.18 +
14.19 + binary = SM.HL2Library(builder, 'game.tf2.ext.' + sdk.ext, sdk)
14.20 + binary.sources += [
14.21 'extension.cpp',
14.22 'natives.cpp',
14.23 'RegNatives.cpp',
14.24 @@ -21,9 +18,5 @@
14.25 'CDetour/detours.cpp',
14.26 'sdk/smsdk_ext.cpp',
14.27 'asm/asm.c'
14.28 - ])
14.29 - SM.PostSetupHL2Job(extension, binary, 'tf2')
14.30 - SM.AutoVersion('extensions/tf2', binary)
14.31 - SM.ExtractDebugInfo(extension, binary)
14.32 - binary.SendToJob()
14.33 -
14.34 + ]
14.35 + SM.binaries += [builder.Add(binary)]
15.1 --- a/extensions/topmenus/AMBuilder Sat Dec 28 08:42:50 2013 -0500
15.2 +++ b/extensions/topmenus/AMBuilder Mon Dec 30 17:50:56 2013 -0500
15.3 @@ -1,20 +1,19 @@
15.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
15.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
15.6 import os
15.7
15.8 -compiler = SM.DefaultExtCompiler('extensions/topmenus')
15.9 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
15.10 +binary = SM.ExtLibrary(builder, 'topmenus.ext')
15.11 +binary.compiler.cxxincludes += [
15.12 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
15.13 +]
15.14
15.15 -extension = AMBuild.AddJob('topmenus.ext')
15.16 -binary = Cpp.LibraryBuilder('topmenus.ext', AMBuild, extension, compiler)
15.17 -binary.AddSourceFiles('extensions/topmenus', [
15.18 - 'extension.cpp',
15.19 - 'smn_topmenus.cpp',
15.20 - 'TopMenu.cpp',
15.21 - 'TopMenuManager.cpp',
15.22 - 'sdk/smsdk_ext.cpp',
15.23 - 'sdk/sm_memtable.cpp'
15.24 - ])
15.25 -SM.AutoVersion('extensions/topmenus', binary)
15.26 -SM.ExtractDebugInfo(extension, binary)
15.27 -binary.SendToJob()
15.28 +binary.sources += [
15.29 + 'extension.cpp',
15.30 + 'smn_topmenus.cpp',
15.31 + 'TopMenu.cpp',
15.32 + 'TopMenuManager.cpp',
15.33 + 'sdk/smsdk_ext.cpp',
15.34 + 'sdk/sm_memtable.cpp'
15.35 +]
15.36
15.37 +SM.binaries += [builder.Add(binary)]
15.38 +
16.1 --- a/extensions/updater/AMBuilder Sat Dec 28 08:42:50 2013 -0500
16.2 +++ b/extensions/updater/AMBuilder Mon Dec 30 17:50:56 2013 -0500
16.3 @@ -1,19 +1,19 @@
16.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
16.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
16.6 import os
16.7
16.8 -compiler = SM.DefaultExtCompiler('extensions/updater')
16.9 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
16.10 +binary = SM.ExtLibrary(builder, 'updater.ext')
16.11 +binary.compiler.cxxincludes += [
16.12 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
16.13 +]
16.14
16.15 -extension = AMBuild.AddJob('updater.ext')
16.16 -binary = Cpp.LibraryBuilder('updater.ext', AMBuild, extension, compiler)
16.17 -binary.AddSourceFiles('extensions/updater', [
16.18 - 'extension.cpp',
16.19 - 'MemoryDownloader.cpp',
16.20 - 'Updater.cpp',
16.21 - 'md5.cpp',
16.22 - 'sdk/smsdk_ext.cpp'
16.23 - ])
16.24 -SM.AutoVersion('extensions/updater', binary)
16.25 -SM.ExtractDebugInfo(extension, binary)
16.26 -binary.SendToJob()
16.27 +binary.sources += [
16.28 + 'extension.cpp',
16.29 + 'MemoryDownloader.cpp',
16.30 + 'Updater.cpp',
16.31 + 'md5.cpp',
16.32 + 'sdk/smsdk_ext.cpp'
16.33 +]
16.34
16.35 +SM.binaries += [builder.Add(binary)]
16.36 +
16.37 +
17.1 --- a/loader/AMBuilder Sat Dec 28 08:42:50 2013 -0500
17.2 +++ b/loader/AMBuilder Mon Dec 30 17:50:56 2013 -0500
17.3 @@ -1,22 +1,22 @@
17.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
17.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
17.6 import os.path
17.7
17.8 -compiler = SM.DefaultCompiler()
17.9 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core'))
17.10 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
17.11 -
17.12 -if AMBuild.target['platform'] == 'windows' or AMBuild.target['platform'] == 'darwin':
17.13 - name = 'sourcemod_mm'
17.14 -elif AMBuild.target['platform'] == 'linux':
17.15 - name = 'sourcemod_mm_i486'
17.16 - compiler['POSTLINKFLAGS'].extend(['-ldl'])
17.17 +if builder.target_platform in ['windows', 'mac']:
17.18 + name = 'sourcemod_mm'
17.19 + extra_ldflags = []
17.20 +elif builder.target_platform is 'linux':
17.21 + name = 'sourcemod_mm_i486'
17.22 + extra_ldflags = ['-ldl']
17.23
17.24 -loader = AMBuild.AddJob('loader')
17.25 -binary = Cpp.LibraryBuilder(name, AMBuild, loader, compiler)
17.26 -binary.AddSourceFiles('loader', [
17.27 - 'loader.cpp'
17.28 - ])
17.29 -SM.AutoVersion('loader', binary)
17.30 -SM.ExtractDebugInfo(loader, binary)
17.31 -binary.SendToJob()
17.32 +binary = SM.Library(builder, name)
17.33 +binary.compiler.cxxincludes += [
17.34 + os.path.join(SM.mms_root, 'core'),
17.35 + os.path.join(SM.mms_root, 'sourcehook')
17.36 +]
17.37 +binary.compiler.linkflags += extra_ldflags
17.38 +binary.sources = [
17.39 + 'loader.cpp'
17.40 +]
17.41
17.42 +nodes = builder.Add(binary)
17.43 +SM.binaries += [nodes]
18.1 --- a/sourcepawn/compiler/AMBuilder Sat Dec 28 08:42:50 2013 -0500
18.2 +++ b/sourcepawn/compiler/AMBuilder Mon Dec 30 17:50:56 2013 -0500
18.3 @@ -1,72 +1,75 @@
18.4 # vim: set ts=2 sw=2 tw=99 noet ft=python:
18.5 import os
18.6
18.7 -compiler = SM.DefaultCompiler()
18.8 -compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
18.9 -compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
18.10 -compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'compiler'))
18.11 -compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes'))
18.12 -
18.13 -if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
18.14 - compiler['CFLAGS'].append('-Wno-format')
18.15 - if AMBuild.target['platform'] == 'linux':
18.16 - compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm'])
18.17 -elif compiler.cc.name == 'msvc':
18.18 - compiler['POSTLINKFLAGS'].remove('/SUBSYSTEM:WINDOWS')
18.19 - compiler['POSTLINKFLAGS'].append('/SUBSYSTEM:CONSOLE')
18.20 -
18.21 -if AMBuild.target['platform'] == 'linux':
18.22 - compiler['CDEFINES'].extend(['LINUX', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC', '_GNU_SOURCE'])
18.23 -elif AMBuild.target['platform'] == 'darwin':
18.24 - compiler['CDEFINES'].extend(['DARWIN', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC', 'HAVE_SAFESTR'])
18.25 -
18.26 -extension = AMBuild.AddJob('spcomp')
18.27 -binary = Cpp.ExecutableBuilder('spcomp', AMBuild, extension, compiler)
18.28 -files = [
18.29 - 'libpawnc.c',
18.30 - 'lstring.c',
18.31 - 'memfile.c',
18.32 - 'pawncc.c',
18.33 - 'sc1.c',
18.34 - 'sc2.c',
18.35 - 'sc3.c',
18.36 - 'sc4.c',
18.37 - 'sc5.c',
18.38 - 'sc6.c',
18.39 - 'sc7.c',
18.40 - 'scexpand.c',
18.41 - 'sci18n.c',
18.42 - 'sclist.c',
18.43 - 'scmemfil.c',
18.44 - 'scstate.c',
18.45 - 'sctracker.c',
18.46 - 'scvars.c',
18.47 - 'sp_file.c',
18.48 - 'zlib/adler32.c',
18.49 - 'zlib/compress.c',
18.50 - 'zlib/crc32.c',
18.51 - 'zlib/deflate.c',
18.52 - 'zlib/gzio.c',
18.53 - 'zlib/infback.c',
18.54 - 'zlib/inffast.c',
18.55 - 'zlib/inflate.c',
18.56 - 'zlib/inftrees.c',
18.57 - 'zlib/trees.c',
18.58 - 'zlib/uncompr.c',
18.59 - 'zlib/zutil.c',
18.60 - 'sp_symhash.c'
18.61 - ]
18.62 -if AMBuild.target['platform'] == 'linux':
18.63 - files.append('binreloc.c')
18.64 -binary.AddSourceFiles('sourcepawn/compiler', files)
18.65 -
18.66 -if AMBuild.target['platform'] == 'windows':
18.67 - env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
18.68 - binary.AddResourceFile('sourcepawn/compiler/libpawnc.rc', env)
18.69 -elif AMBuild.target['platform'] == 'darwin' and isinstance(binary, Cpp.LibraryBuilder):
18.70 - binary.compiler['POSTLINKFLAGS'].extend(['-compatibility_version', '1.0.0'])
18.71 - binary.compiler['POSTLINKFLAGS'].extend(['-current_version', AMBuild.cache['version']])
18.72 -
18.73 -SM.ExtractDebugInfo(extension, binary)
18.74 -binary.SendToJob()
18.75 -
18.76 +binary = SM.Program(builder, 'spcomp')
18.77 +compiler = binary.compiler
18.78 +compiler.includes += [
18.79 + os.path.join(builder.sourcePath, 'public'),
18.80 + os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
18.81 + os.path.join(builder.sourcePath, 'sourcepawn', 'compiler'),
18.82 + os.path.join(builder.buildPath, 'includes'),
18.83 +]
18.84 +
18.85 +if compiler.cc.behavior is 'gcc':
18.86 + compiler.cflags += ['-Wno-format']
18.87 + if builder.target_platform is 'linux':
18.88 + compiler.postlink += ['-lgcc', '-lm']
18.89 +elif compiler.cc.behavior is 'msvc':
18.90 + compiler.linkflags.remove('/SUBSYSTEM:WINDOWS')
18.91 + compiler.linkflags.append('/SUBSYSTEM:CONSOLE')
18.92 +
18.93 +if builder.target_platform is 'linux':
18.94 + compiler.defines += [
18.95 + 'LINUX',
18.96 + 'HAVE_STDINT_H',
18.97 + 'AMX_ANSIONLY',
18.98 + 'ENABLE_BINRELOC',
18.99 + '_GNU_SOURCE'
18.100 + ]
18.101 +elif builder.target_platform is 'mac':
18.102 + compiler.defines += [
18.103 + 'DARWIN',
18.104 + 'HAVE_STDINT_H',
18.105 + 'AMX_ANSIONLY',
18.106 + 'ENABLE_BINRELOC',
18.107 + 'HAVE_SAFESTR'
18.108 + ]
18.109 +
18.110 +binary.sources += [
18.111 + 'libpawnc.c',
18.112 + 'lstring.c',
18.113 + 'memfile.c',
18.114 + 'pawncc.c',
18.115 + 'sc1.c',
18.116 + 'sc2.c',
18.117 + 'sc3.c',
18.118 + 'sc4.c',
18.119 + 'sc5.c',
18.120 + 'sc6.c',
18.121 + 'sc7.c',
18.122 + 'scexpand.c',
18.123 + 'sci18n.c',
18.124 + 'sclist.c',
18.125 + 'scmemfil.c',
18.126 + 'scstate.c',
18.127 + 'sctracker.c',
18.128 + 'scvars.c',
18.129 + 'sp_file.c',
18.130 + 'zlib/adler32.c',
18.131 + 'zlib/compress.c',
18.132 + 'zlib/crc32.c',
18.133 + 'zlib/deflate.c',
18.134 + 'zlib/gzio.c',
18.135 + 'zlib/infback.c',
18.136 + 'zlib/inffast.c',
18.137 + 'zlib/inflate.c',
18.138 + 'zlib/inftrees.c',
18.139 + 'zlib/trees.c',
18.140 + 'zlib/uncompr.c',
18.141 + 'zlib/zutil.c',
18.142 + 'sp_symhash.c'
18.143 +]
18.144 +if builder.target_platform is 'linux':
18.145 + binary.sources.append('binreloc.c')
18.146 +
18.147 +SM.binaries += [builder.Add(binary)]
19.1 --- a/sourcepawn/jit/AMBuilder Sat Dec 28 08:42:50 2013 -0500
19.2 +++ b/sourcepawn/jit/AMBuilder Mon Dec 30 17:50:56 2013 -0500
19.3 @@ -1,56 +1,50 @@
19.4 -# vim: set ts=2 sw=2 tw=99 noet ft=python:
19.5 +# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
19.6 import os
19.7
19.8 -compiler = SM.DefaultCompiler()
19.9 -base = AMBuild.sourceFolder
19.10 -compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
19.11 -compiler['CXXINCLUDES'].append(os.path.join(base, 'sourcepawn', 'jit'))
19.12 -compiler['CXXINCLUDES'].append(os.path.join(base, 'sourcepawn', 'jit', 'x86'))
19.13 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
19.14 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
19.15 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'amtl'))
19.16 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'jit'))
19.17 -compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'jit', 'x86'))
19.18 -compiler['CXXINCLUDES'].append(os.path.join(base, 'knight', 'shared'))
19.19 +binary = SM.Library(builder, 'sourcepawn.jit.x86')
19.20 +binary.compiler.includes += [
19.21 + os.path.join(SM.mms_root, 'core', 'sourcehook'),
19.22 + os.path.join(builder.sourcePath, 'sourcepawn', 'jit'),
19.23 + os.path.join(builder.sourcePath, 'sourcepawn', 'jit', 'x86'),
19.24 + os.path.join(builder.sourcePath, 'public'),
19.25 + os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
19.26 + os.path.join(builder.sourcePath, 'public', 'amtl'),
19.27 + os.path.join(builder.sourcePath, 'public', 'jit'),
19.28 + os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
19.29 + os.path.join(builder.sourcePath, 'knight', 'shared'),
19.30 +]
19.31
19.32 -if AMBuild.target['platform'] == 'linux':
19.33 - compiler['POSTLINKFLAGS'].append('-lpthread')
19.34 - compiler['POSTLINKFLAGS'].append('-lrt')
19.35 -if AMBuild.target['platform'] == 'darwin':
19.36 - compiler['POSTLINKFLAGS'].append('-lpthread')
19.37 - compiler['POSTLINKFLAGS'].append('-ldl')
19.38 +if builder.target_platform is 'linux':
19.39 + binary.compiler.postlink += ['-lpthread', '-lrt']
19.40 +elif builder.target_platform is 'darwin':
19.41 + binary.compiler.postlink += ['-lpthread', '-ldl']
19.42
19.43 -extension = AMBuild.AddJob('sourcepawn.jit.x86')
19.44 -binary = Cpp.LibraryBuilder('sourcepawn.jit.x86', AMBuild, extension, compiler)
19.45 -binary.AddSourceFiles('sourcepawn/jit', [
19.46 - 'BaseRuntime.cpp',
19.47 - 'engine2.cpp',
19.48 - 'dll_exports.cpp',
19.49 - 'jit_function.cpp',
19.50 - 'sp_vm_basecontext.cpp',
19.51 - 'sp_vm_engine.cpp',
19.52 - 'sp_vm_function.cpp',
19.53 - 'opcodes.cpp',
19.54 - 'interpreter.cpp',
19.55 - 'watchdog_timer.cpp',
19.56 - 'x86/jit_x86.cpp',
19.57 - 'zlib/adler32.c',
19.58 - 'zlib/compress.c',
19.59 - 'zlib/crc32.c',
19.60 - 'zlib/deflate.c',
19.61 - 'zlib/gzio.c',
19.62 - 'zlib/infback.c',
19.63 - 'zlib/inffast.c',
19.64 - 'zlib/inflate.c',
19.65 - 'zlib/inftrees.c',
19.66 - 'zlib/trees.c',
19.67 - 'zlib/uncompr.c',
19.68 - 'zlib/zutil.c',
19.69 - 'md5/md5.cpp',
19.70 - '../../knight/shared/KeCodeAllocator.cpp',
19.71 - '../../public/jit/x86/assembler-x86.cpp'
19.72 - ])
19.73 -SM.AutoVersion('sourcepawn/jit', binary)
19.74 -SM.ExtractDebugInfo(extension, binary)
19.75 -binary.SendToJob()
19.76 -
19.77 +binary.sources += [
19.78 + 'BaseRuntime.cpp',
19.79 + 'engine2.cpp',
19.80 + 'dll_exports.cpp',
19.81 + 'jit_function.cpp',
19.82 + 'sp_vm_basecontext.cpp',
19.83 + 'sp_vm_engine.cpp',
19.84 + 'sp_vm_function.cpp',
19.85 + 'opcodes.cpp',
19.86 + 'interpreter.cpp',
19.87 + 'watchdog_timer.cpp',
19.88 + 'x86/jit_x86.cpp',
19.89 + 'zlib/adler32.c',
19.90 + 'zlib/compress.c',
19.91 + 'zlib/crc32.c',
19.92 + 'zlib/deflate.c',
19.93 + 'zlib/gzio.c',
19.94 + 'zlib/infback.c',
19.95 + 'zlib/inffast.c',
19.96 + 'zlib/inflate.c',
19.97 + 'zlib/inftrees.c',
19.98 + 'zlib/trees.c',
19.99 + 'zlib/uncompr.c',
19.100 + 'zlib/zutil.c',
19.101 + 'md5/md5.cpp',
19.102 + '../../knight/shared/KeCodeAllocator.cpp',
19.103 + '../../public/jit/x86/assembler-x86.cpp',
19.104 +]
19.105 +SM.binaries += [builder.Add(binary)]