Update to AMBuild 2.2.

This is a pretty big diff because SourceMod had lots of multi-arch
workarounds that can now go away. I've also changed 'x64' to 'x86_64' in
many places since this is how AMBuild normalizes it, and it's far too
late to pick the shorter string, so we might as well suck it up.

The --target-archs parameter has been replaced with --targets. It works
the same way.

The default behavior for SDK inclusion is now "present" instead of
"all" since this lowers the burden of storing many SDKs. Official builds
will still be made with --sdks=all.
This commit is contained in:
David Anderson
2020-08-18 23:09:43 -07:00
parent 1b86c8564d
commit 785c6aa1cf
26 changed files with 289 additions and 235 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'bintools.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'bintools.ext')
binary.compiler.defines += ['HOOKING_ENABLED']
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
@@ -21,7 +21,7 @@ for arch in SM.archs:
'../../public/smsdk_ext.cpp'
]
if arch == 'x64':
if binary.compiler.target.arch == 'x86_64':
binary.sources += ['jit_call_x64.cpp']
else:
binary.sources += ['jit_call.cpp']
+2 -2
View File
@@ -1,8 +1,8 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'clientprefs.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'clientprefs.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
+5 -5
View File
@@ -1,7 +1,7 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
project = SM.HL2Project(builder, 'game.cstrike.ext')
project = builder.LibraryProject('game.cstrike.ext')
project.sources += [
'extension.cpp',
'natives.cpp',
@@ -19,16 +19,16 @@ project.sources += [
'../../public/libudis86/syn.c',
'../../public/libudis86/udis86.c',
]
project.compiler.defines += ['HAVE_STRING_H'];
for sdk_name in ['css', 'csgo']:
if sdk_name not in SM.sdks:
continue
sdk = SM.sdks[sdk_name]
for arch in SM.archs:
if not arch in sdk.platformSpec[builder.target.platform]:
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
SM.HL2Config(project, 'game.cstrike.ext.' + sdk.ext, sdk, arch)
cxx.defines += ['HAVE_STRING_H'];
SM.HL2ExtConfig(project, builder, cxx, 'game.cstrike.ext.' + sdk.ext, sdk)
SM.extensions += builder.Add(project)
+5 -5
View File
@@ -2,8 +2,8 @@
import os
libcurl = builder.Build('curl-src/lib/AMBuilder')
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'webternet.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'webternet.ext')
binary.compiler.includes += [
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
]
@@ -12,10 +12,10 @@ for arch in SM.archs:
binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']
binary.compiler.postlink += [libcurl[arch].binary]
if builder.target.platform == 'linux':
binary.compiler.postlink += [libcurl[binary.compiler.target.arch].binary]
if binary.compiler.target.platform == 'linux':
binary.compiler.postlink += ['-lrt']
elif builder.target.platform == 'windows':
elif binary.compiler.target.platform == 'windows':
binary.compiler.postlink += ['ws2_32.lib']
binary.sources += [
+6 -6
View File
@@ -4,25 +4,25 @@ import os, platform
builder.SetBuildFolder('libcurl')
rvalue = {}
for arch in SM.archs:
binary = SM.StaticLibrary(builder, 'curl', arch)
for cxx in builder.targets:
binary = SM.StaticLibrary(builder, cxx, 'curl')
binary.compiler.includes += [
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'lib'),
os.path.join(builder.sourcePath, 'extensions', 'curl', 'curl-src', 'include')
]
if builder.target.platform == 'mac':
if binary.compiler.target.platform == 'mac':
mac_version, ignore, ignore = platform.mac_ver()
mac_tuple = mac_version.split('.')
if int(mac_tuple[0]) >= 10 and int(mac_tuple[1]) >= 9:
binary.compiler.defines += ['BUILTIN_STRLCAT']
elif builder.target.platform == 'windows':
elif binary.compiler.target.platform == 'windows':
binary.compiler.defines += [
'BUILDING_LIBCURL',
'CURL_STATICLIB',
'CURL_DISABLE_LDAP',
]
elif builder.target.platform == 'linux':
elif binary.compiler.target.platform == 'linux':
binary.compiler.defines += ['_GNU_SOURCE']
if binary.compiler.family == 'clang':
@@ -96,5 +96,5 @@ for arch in SM.archs:
'url.c',
'version.c'
]
rvalue[arch] = builder.Add(binary)
rvalue[binary.compiler.target.arch] = builder.Add(binary)
+3 -3
View File
@@ -1,13 +1,13 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'geoip.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'geoip.ext')
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
binary.compiler.cxxflags += ['-fno-rtti']
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']
if builder.target.platform == 'windows':
if binary.compiler.target.platform == 'windows':
binary.compiler.postlink += ['wsock32.lib']
binary.sources += [
+6 -5
View File
@@ -2,8 +2,9 @@
import os
if SM.mysql_root:
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'dbi.mysql.ext', arch)
for cxx in builder.targets:
arch = cxx.target.arch
binary = SM.ExtLibrary(builder, cxx, 'dbi.mysql.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mysql_root[arch], 'include'),
os.path.join(SM.mms_root, 'core', 'sourcehook')
@@ -13,16 +14,16 @@ if SM.mysql_root:
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']
if builder.target.platform == 'linux' or builder.target.platform == 'mac':
if binary.compiler.target.platform == 'linux' or binary.compiler.target.platform == 'mac':
binary.compiler.postlink += [
os.path.join(SM.mysql_root[arch], 'lib', 'libmysqlclient_r.a'),
'-lz',
'-lpthread',
'-lm',
]
if builder.target.platform == 'linux':
if binary.compiler.target.platform == 'linux':
binary.compiler.postlink += ['-lrt']
elif builder.target.platform == 'windows':
elif binary.compiler.target.platform == 'windows':
binary.compiler.defines += ['WIN32_LEAN_AND_MEAN']
binary.compiler.postlink += [
os.path.join(SM.mysql_root[arch], 'lib', 'mysqlclient.lib'),
+9 -8
View File
@@ -1,8 +1,8 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'regex.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'regex.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
@@ -11,20 +11,21 @@ for arch in SM.archs:
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/GR-']
if builder.target.platform == 'linux':
arch = binary.compiler.target.arch
if binary.compiler.target.platform == 'linux':
if arch == 'x86':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux', 'libpcre.a')
elif arch == 'x64':
elif arch == 'x86_64':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_linux64', 'libpcre.a')
elif builder.target.platform == 'windows':
elif binary.compiler.target.platform == 'windows':
if arch == 'x86':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win', 'pcre.lib')
elif arch == 'x64':
elif arch == 'x86_64':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_win64', 'pcre.lib')
elif builder.target.platform == 'mac':
elif binary.compiler.target.platform == 'mac':
if arch == 'x86':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin', 'libpcre.a')
elif arch == 'x64':
elif arch == 'x86_64':
path = os.path.join(builder.sourcePath, 'extensions', 'regex', 'lib_darwin64', 'libpcre.a')
binary.compiler.postlink += [binary.Dep(path)]
+4 -4
View File
@@ -1,7 +1,7 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
project = SM.HL2Project(builder, 'sdkhooks.ext')
project = builder.LibraryProject('sdkhooks.ext')
project.sources += [
'extension.cpp',
'natives.cpp',
@@ -13,11 +13,11 @@ project.sources += [
for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name]
for arch in SM.archs:
if not arch in sdk.platformSpec[builder.target.platform]:
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
binary = SM.HL2Config(project, 'sdkhooks.ext.' + sdk.ext, sdk, arch)
binary = SM.HL2ExtConfig(project, builder, cxx, 'sdkhooks.ext.' + sdk.ext, sdk)
binary.compiler.cxxincludes += [
os.path.join(sdk.path, 'game', 'shared')
]
+5 -5
View File
@@ -1,7 +1,7 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
project = SM.HL2Project(builder, 'sdktools.ext')
project = builder.LibraryProject('sdktools.ext')
project.sources += [
'extension.cpp',
'variant-t.cpp',
@@ -34,21 +34,21 @@ project.sources += [
'../../public/libudis86/syn.c',
'../../public/libudis86/udis86.c',
]
project.compiler.defines += ['HAVE_STRING_H'];
for sdk_name in SM.sdks:
sdk = SM.sdks[sdk_name]
for arch in SM.archs:
if not arch in sdk.platformSpec[builder.target.platform]:
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
binary = SM.HL2Config(project, 'sdktools.ext.' + sdk.ext, sdk, arch)
binary = SM.HL2ExtConfig(project, builder, cxx, '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'),
]
binary.compiler.defines += ['HAVE_STRING_H'];
if sdk.name != 'episode1':
binary.compiler.defines += ['HOOKING_ENABLED']
+3 -3
View File
@@ -1,8 +1,8 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'dbi.sqlite.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'dbi.sqlite.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
@@ -17,7 +17,7 @@ for arch in SM.archs:
'SQLITE_USE_URI',
'SQLITE_ALLOW_URI_AUTHORITY',
]
if builder.target.platform == 'linux':
if binary.compiler.target.platform == 'linux':
binary.compiler.postlink += ['-ldl', '-lpthread']
binary.sources += [
+3 -3
View File
@@ -4,10 +4,10 @@ import os
if 'tf2' in SM.sdks:
sdk = SM.sdks['tf2']
for arch in SM.archs:
if not arch in sdk.platformSpec[builder.target.platform]:
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
binary = SM.HL2Library(builder, 'game.tf2.ext.' + sdk.ext, sdk, arch)
binary = SM.HL2Library(builder, cxx, 'game.tf2.ext.' + sdk.ext, sdk)
binary.sources += [
'extension.cpp',
'natives.cpp',
+2 -2
View File
@@ -1,8 +1,8 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'topmenus.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'topmenus.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]
+2 -2
View File
@@ -1,8 +1,8 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in SM.archs:
binary = SM.ExtLibrary(builder, 'updater.ext', arch)
for cxx in builder.targets:
binary = SM.ExtLibrary(builder, cxx, 'updater.ext')
binary.compiler.cxxincludes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
]