Port simple C++ build scripts to AMBuild 2 (bug 5997 part 1, r=ds).

This commit is contained in:
David Anderson
2013-12-30 17:50:56 -05:00
parent b749bbf42b
commit e1a820dcf9
19 changed files with 955 additions and 1134 deletions
+18 -20
View File
@@ -1,25 +1,23 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/bintools')
compiler['CDEFINES'].append('HOOKING_ENABLED')
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
binary = SM.ExtLibrary(builder, 'bintools.ext')
binary.compiler.defines += ['HOOKING_ENABLED']
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
os.path.join(builder.sourcePath, 'public', 'jit'),
os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
]
extension = AMBuild.AddJob('bintools.ext')
binary = Cpp.LibraryBuilder('bintools.ext', AMBuild, extension, compiler)
binary.AddSourceFiles('extensions/bintools', [
'extension.cpp',
'CallMaker.cpp',
'CallWrapper.cpp',
'HookWrapper.cpp',
'jit_call.cpp',
'jit_hook.cpp',
'sdk/smsdk_ext.cpp'
])
SM.AutoVersion('extensions/bintools', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary.sources += [
'extension.cpp',
'CallMaker.cpp',
'CallWrapper.cpp',
'HookWrapper.cpp',
'jit_call.cpp',
'jit_hook.cpp',
'sdk/smsdk_ext.cpp'
]
SM.binaries += [builder.Add(binary)]
+15 -16
View File
@@ -1,20 +1,19 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/clientprefs')
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
binary = SM.ExtLibrary(builder, 'clientprefs.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
extension = AMBuild.AddJob('clientprefs.ext')
binary = Cpp.LibraryBuilder('clientprefs.ext', AMBuild, extension, compiler)
binary.AddSourceFiles('extensions/clientprefs', [
'extension.cpp',
'cookie.cpp',
'menus.cpp',
'natives.cpp',
'query.cpp',
'sdk/smsdk_ext.cpp'
])
SM.AutoVersion('extensions/clientprefs', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary.sources += [
'extension.cpp',
'cookie.cpp',
'menus.cpp',
'natives.cpp',
'query.cpp',
'sdk/smsdk_ext.cpp'
]
SM.binaries += [builder.Add(binary)]
+19 -31
View File
@@ -1,33 +1,21 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for i in SM.sdkInfo:
if i != 'css' and i != 'csgo':
continue
sdk = SM.sdkInfo[i]
if AMBuild.target['platform'] not in sdk['platform']:
continue
compiler = SM.DefaultHL2Compiler('extensions/cstrike', i)
name = 'game.cstrike.ext.' + sdk['ext']
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
binary.AddSourceFiles('extensions/cstrike', [
'extension.cpp',
'natives.cpp',
'RegNatives.cpp',
'timeleft.cpp',
'forwards.cpp',
'util_cstrike.cpp',
'sdk/smsdk_ext.cpp',
'CDetour/detours.cpp',
'asm/asm.c'
])
SM.PostSetupHL2Job(extension, binary, i)
SM.AutoVersion('extensions/cstrike', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
for sdk_name in ['css', 'csgo']:
if sdk_name not in SM.sdks:
continue
sdk = SM.sdks[sdk_name]
binary = SM.HL2Library(builder, 'game.cstrike.ext.' + sdk.ext, sdk)
binary.sources += [
'extension.cpp',
'natives.cpp',
'RegNatives.cpp',
'timeleft.cpp',
'forwards.cpp',
'util_cstrike.cpp',
'sdk/smsdk_ext.cpp',
'CDetour/detours.cpp',
'asm/asm.c'
]
SM.binaries += [builder.Add(binary)]
+13 -14
View File
@@ -1,16 +1,15 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
compiler = SM.DefaultExtCompiler('extensions/geoip')
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
extension = AMBuild.AddJob('geoip.ext')
binary = Cpp.LibraryBuilder('geoip.ext', AMBuild, extension, compiler)
binary.AddSourceFiles('extensions/geoip', [
'extension.cpp',
'GeoIP.c',
'sdk/smsdk_ext.cpp'
])
if AMBuild.target['platform'] == 'windows':
binary['POSTLINKFLAGS'].append('wsock32.lib')
SM.AutoVersion('extensions/geoip', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary = SM.ExtLibrary(builder, 'geoip.ext')
if builder.target_platform is 'windows':
binary.compiler.postlink += ['wsock32.lib']
binary.sources += [
'extension.cpp',
'GeoIP.c',
'sdk/smsdk_ext.cpp'
]
SM.binaries += [builder.Add(binary)]
+30 -34
View File
@@ -1,39 +1,35 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/mysql')
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['MYSQL5'], 'include'))
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
if SM.mysql_root:
binary = SM.ExtLibrary(builder, 'dbi.mysql.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mysql_root, 'include'),
os.path.join(SM.mms_root, 'core', 'sourcehook')
]
extension = AMBuild.AddJob('dbi.mysql.ext')
binary = Cpp.LibraryBuilder('dbi.mysql.ext', AMBuild, extension, compiler)
if builder.target_platform is 'linux' or builder.target_platform is 'darwin':
binary.compiler.postlink += [
os.path.join(SM.mysql_root, 'lib', 'libmysqlclient_r.a'),
'-lz',
'-lpthread',
'-lm'
]
elif builder.target_platform is 'windows':
binary.compiler.postlink += [
os.path.join(SM.mysql_root, 'lib', 'opt', 'mysqlclient.lib'),
os.path.join(SM.mysql_root, 'lib', 'opt', 'zlib.lib'),
'wsock32.lib'
]
if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
lib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'libmysqlclient_r.a')
link = [lib,
'-lz',
'-lpthread',
'-lm']
binary.RelinkIfNewer(lib)
binary['POSTLINKFLAGS'].extend(link)
elif AMBuild.target['platform'] == 'windows':
mylib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'opt', 'mysqlclient.lib')
zlib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'opt', 'zlib.lib')
binary.RelinkIfNewer(mylib)
binary.RelinkIfNewer(zlib)
binary['POSTLINKFLAGS'].extend([mylib, zlib, 'wsock32.lib'])
binary.AddSourceFiles('extensions/mysql', [
'sdk/smsdk_ext.cpp',
'mysql/MyBasicResults.cpp',
'mysql/MyBoundResults.cpp',
'mysql/MyDatabase.cpp',
'mysql/MyDriver.cpp',
'mysql/MyStatement.cpp',
'extension.cpp'
])
SM.AutoVersion('extensions/mysql', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary.sources += [
'sdk/smsdk_ext.cpp',
'mysql/MyBasicResults.cpp',
'mysql/MyBoundResults.cpp',
'mysql/MyDatabase.cpp',
'mysql/MyDriver.cpp',
'mysql/MyStatement.cpp',
'extension.cpp'
]
SM.binaries += [builder.Add(binary)]
+18 -22
View File
@@ -1,28 +1,24 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/regex')
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
binary = SM.ExtLibrary(builder, 'regex.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
extension = AMBuild.AddJob('regex.ext')
binary = Cpp.LibraryBuilder('regex.ext', AMBuild, extension, compiler)
if builder.target_platform is 'linux':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
elif builder.target_platform is 'windows':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win', 'pcre.lib')
elif builder.target_platform is 'mac':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
binary.compiler.postlink += [binary.Dep(path)]
if AMBuild.target['platform'] == 'linux':
path = os.path.join(AMBuild.sourceFolder, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
elif AMBuild.target['platform'] == 'windows':
path = os.path.join(AMBuild.sourceFolder, 'extensions', 'regex', 'lib_win', 'pcre.lib')
elif AMBuild.target['platform'] == 'darwin':
path = os.path.join(AMBuild.sourceFolder, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
binary.sources += [
'extension.cpp',
'CRegEx.cpp',
'sdk/smsdk_ext.cpp',
]
binary.RelinkIfNewer(path)
binary['POSTLINKFLAGS'].append(path)
binary.AddSourceFiles('extensions/regex', [
'extension.cpp',
'CRegEx.cpp',
'sdk/smsdk_ext.cpp',
])
SM.AutoVersion('extensions/regex', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
SM.binaries += [builder.Add(binary)]
+18 -27
View File
@@ -1,30 +1,21 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
if AMBuild.target['platform'] not in sdk['platform']:
continue
compiler = SM.DefaultHL2Compiler('extensions/sdkhooks', i)
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache[sdk['sdk']], 'game', 'shared'))
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
name = 'sdkhooks.ext.' + sdk['ext']
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
binary.AddSourceFiles('extensions/sdkhooks', [
'extension.cpp',
'natives.cpp',
'takedamageinfohack.cpp',
'util.cpp',
'sdk/smsdk_ext.cpp',
])
SM.PostSetupHL2Job(extension, binary, i)
SM.AutoVersion('extensions/sdkhooks', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name]
binary = SM.HL2Library(builder, 'sdkhooks.ext.' + sdk.ext, sdk)
binary.compiler.cxxincludes += [
os.path.join(sdk.path, 'game', 'shared')
]
if binary.compiler.cxx.behavior is 'gcc':
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
binary.sources += [
'extension.cpp',
'natives.cpp',
'takedamageinfohack.cpp',
'util.cpp',
'sdk/smsdk_ext.cpp',
]
SM.binaries += [builder.Add(binary)]
+39 -46
View File
@@ -1,52 +1,45 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for i in SM.sdkInfo:
sdk = SM.sdkInfo[i]
if AMBuild.target['platform'] not in sdk['platform']:
continue
for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name]
compiler = SM.DefaultHL2Compiler('extensions/sdktools', i)
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86'))
binary = SM.HL2Library(builder, 'sdktools.ext.' + sdk.ext, sdk)
binary.compiler.cxxincludes += [
os.path.join(sdk.path, 'game', 'shared'),
os.path.join(builder.sourcePath, 'public', 'jit'),
os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
]
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CXXFLAGS'].append('-Wno-invalid-offsetof')
if sdk.name != 'ep1':
binary.compiler.defines += ['HOOKING_ENABLED']
if i != 'ep1':
compiler['CDEFINES'].append('HOOKING_ENABLED')
name = 'sdktools.ext.' + sdk['ext']
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, i)
binary.AddSourceFiles('extensions/sdktools', [
'extension.cpp',
'inputnatives.cpp',
'output.cpp',
'outputnatives.cpp',
'tempents.cpp',
'tenatives.cpp',
'teamnatives.cpp',
'trnatives.cpp',
'vcaller.cpp',
'vcallbuilder.cpp',
'vdecoder.cpp',
'vglobals.cpp',
'vhelpers.cpp',
'vnatives.cpp',
'voice.cpp',
'vsound.cpp',
'clientnatives.cpp',
'hooks.cpp',
'gamerulesnatives.cpp',
'vstringtable.cpp',
'CDetour/detours.cpp',
'sdk/smsdk_ext.cpp',
'asm/asm.c'
])
SM.PostSetupHL2Job(extension, binary, i)
SM.AutoVersion('extensions/sdktools', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
if binary.compiler.cxx.behavior is 'gcc':
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
binary.sources += [
'extension.cpp',
'inputnatives.cpp',
'output.cpp',
'outputnatives.cpp',
'tempents.cpp',
'tenatives.cpp',
'teamnatives.cpp',
'trnatives.cpp',
'vcaller.cpp',
'vcallbuilder.cpp',
'vdecoder.cpp',
'vglobals.cpp',
'vhelpers.cpp',
'vnatives.cpp',
'voice.cpp',
'vsound.cpp',
'clientnatives.cpp',
'hooks.cpp',
'gamerulesnatives.cpp',
'vstringtable.cpp',
'CDetour/detours.cpp',
'sdk/smsdk_ext.cpp',
'asm/asm.c'
]
SM.binaries += [builder.Add(binary)]
+23 -17
View File
@@ -1,22 +1,28 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/sqlite')
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
binary = SM.ExtLibrary(builder, 'dbi.sqlite.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
compiler['CDEFINES'].extend(['SQLITE_OMIT_LOAD_EXTENSION', 'SQLITE_THREADSAFE'])
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'].extend(['-ldl', '-lpthread'])
binary.compiler.defines += [
'SQLITE_OMIT_LOAD_EXTENSION',
'SQLITE_THREADSAFE'
]
if builder.target_platform is 'linux':
binary.compiler.postlink += ['-ldl', '-lpthread']
extension = AMBuild.AddJob('dbi.sqlite.ext')
binary = Cpp.LibraryBuilder('dbi.sqlite.ext', AMBuild, extension, compiler)
files = [
'sdk/smsdk_ext.cpp', 'sdk/sm_memtable.cpp', 'extension.cpp',
'driver/SqDatabase.cpp', 'driver/SqDriver.cpp', 'driver/SqQuery.cpp',
'driver/SqResults.cpp', 'sqlite-source/sqlite3.c'
]
binary.AddSourceFiles('extensions/sqlite', files)
SM.AutoVersion('extensions/sqlite', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary.sources += [
'sdk/smsdk_ext.cpp',
'sdk/sm_memtable.cpp',
'extension.cpp',
'driver/SqDatabase.cpp',
'driver/SqDriver.cpp',
'driver/SqQuery.cpp',
'driver/SqResults.cpp',
'sqlite-source/sqlite3.c'
]
SM.binaries += [builder.Add(binary)]
+8 -15
View File
@@ -1,14 +1,11 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
if 'tf2' in SM.sdkInfo:
sdk = SM.sdkInfo['tf2']
compiler = SM.DefaultHL2Compiler('extensions/tf2', 'tf2')
name = 'game.tf2.ext.' + sdk['ext']
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
SM.PreSetupHL2Job(extension, binary, 'tf2')
binary.AddSourceFiles('extensions/tf2', [
if 'tf2' in SM.sdks:
sdk = SM.sdks['tf2']
binary = SM.HL2Library(builder, 'game.tf2.ext.' + sdk.ext, sdk)
binary.sources += [
'extension.cpp',
'natives.cpp',
'RegNatives.cpp',
@@ -21,9 +18,5 @@ if 'tf2' in SM.sdkInfo:
'CDetour/detours.cpp',
'sdk/smsdk_ext.cpp',
'asm/asm.c'
])
SM.PostSetupHL2Job(extension, binary, 'tf2')
SM.AutoVersion('extensions/tf2', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
]
SM.binaries += [builder.Add(binary)]
+15 -16
View File
@@ -1,20 +1,19 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/topmenus')
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
binary = SM.ExtLibrary(builder, 'topmenus.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
extension = AMBuild.AddJob('topmenus.ext')
binary = Cpp.LibraryBuilder('topmenus.ext', AMBuild, extension, compiler)
binary.AddSourceFiles('extensions/topmenus', [
'extension.cpp',
'smn_topmenus.cpp',
'TopMenu.cpp',
'TopMenuManager.cpp',
'sdk/smsdk_ext.cpp',
'sdk/sm_memtable.cpp'
])
SM.AutoVersion('extensions/topmenus', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary.sources += [
'extension.cpp',
'smn_topmenus.cpp',
'TopMenu.cpp',
'TopMenuManager.cpp',
'sdk/smsdk_ext.cpp',
'sdk/sm_memtable.cpp'
]
SM.binaries += [builder.Add(binary)]
+15 -15
View File
@@ -1,19 +1,19 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultExtCompiler('extensions/updater')
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
binary = SM.ExtLibrary(builder, 'updater.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
binary.sources += [
'extension.cpp',
'MemoryDownloader.cpp',
'Updater.cpp',
'md5.cpp',
'sdk/smsdk_ext.cpp'
]
SM.binaries += [builder.Add(binary)]
extension = AMBuild.AddJob('updater.ext')
binary = Cpp.LibraryBuilder('updater.ext', AMBuild, extension, compiler)
binary.AddSourceFiles('extensions/updater', [
'extension.cpp',
'MemoryDownloader.cpp',
'Updater.cpp',
'md5.cpp',
'sdk/smsdk_ext.cpp'
])
SM.AutoVersion('extensions/updater', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()