feat: update sdks, builders, ci, proper secure data (#10)
This commit is contained in:
+173
-114
@@ -1,6 +1,5 @@
|
||||
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
||||
import os, sys
|
||||
import traceback
|
||||
import os, sys, shutil
|
||||
|
||||
class SDK(object):
|
||||
def __init__(self, sdk, ext, aDef, name, platform, dir):
|
||||
@@ -27,13 +26,49 @@ class SDK(object):
|
||||
return True
|
||||
return False
|
||||
|
||||
WinOnly = ['windows']
|
||||
WinLinux = ['windows', 'linux']
|
||||
WinLinuxMac = ['windows', 'linux', 'mac']
|
||||
CSS = {
|
||||
'windows': ['x86', 'x86_64'],
|
||||
'linux': ['x86', 'x86_64']
|
||||
}
|
||||
HL2DM = {
|
||||
'windows': ['x86', 'x86_64'],
|
||||
'linux': ['x86', 'x86_64']
|
||||
}
|
||||
DODS = {
|
||||
'windows': ['x86', 'x86_64'],
|
||||
'linux': ['x86', 'x86_64']
|
||||
}
|
||||
TF2 = {
|
||||
'windows': ['x86', 'x86_64'],
|
||||
'linux': ['x86', 'x86_64']
|
||||
}
|
||||
CSGO = {
|
||||
'windows': ['x86'],
|
||||
'linux': ['x86', 'x86_64']
|
||||
}
|
||||
|
||||
PossibleSDKs = {
|
||||
'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, 'sdk2013'),
|
||||
'csgo': SDK('HL2SDKCSGO', '2.csgo', '21', 'CSGO', WinLinuxMac, 'csgo'),
|
||||
# 'episode1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'),
|
||||
# 'darkm': SDK('HL2SDK-DARKM', '2.darkm', '2', 'DARKMESSIAH', WinOnly, 'darkm'),
|
||||
# 'orangebox': SDK('HL2SDKOB', '2.ep2', '3', 'ORANGEBOX', WinLinux, 'orangebox'),
|
||||
# 'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
|
||||
# 'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
|
||||
'css': SDK('HL2SDKCSS', '2.css', '6', 'CSS', CSS, 'css'),
|
||||
# 'hl2dm': SDK('HL2SDKHL2DM', '2.hl2dm', '7', 'HL2DM', HL2DM, 'hl2dm'),
|
||||
# 'dods': SDK('HL2SDKDODS', '2.dods', '8', 'DODS', DODS, 'dods'),
|
||||
# 'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinux, 'sdk2013'),
|
||||
# 'bms': SDK('HL2SDKBMS', '2.bms', '11', 'BMS', WinLinux, 'bms'),
|
||||
# 'tf2': SDK('HL2SDKTF2', '2.tf2', '12', 'TF2', TF2, 'tf2'),
|
||||
# 'l4d': SDK('HL2SDKL4D', '2.l4d', '13', 'LEFT4DEAD', WinLinux, 'l4d'),
|
||||
# 'nucleardawn': SDK('HL2SDKND', '2.nd', '14', 'NUCLEARDAWN', WinLinuxMac, 'nucleardawn'),
|
||||
# 'contagion': SDK('HL2SDKCONTAGION', '2.contagion', '15', 'CONTAGION', WinOnly, 'contagion'),
|
||||
# 'l4d2': SDK('HL2SDKL4D2', '2.l4d2', '16', 'LEFT4DEAD2', WinLinux, 'l4d2'),
|
||||
# 'swarm': SDK('HL2SDK-SWARM', '2.swarm', '17', 'ALIENSWARM', WinOnly, 'swarm'),
|
||||
# 'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '18', 'PORTAL2', [], 'portal2'),
|
||||
# 'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'),
|
||||
# 'blade': SDK('HL2SDKBLADE', '2.blade', '21', 'BLADE', WinLinux, 'blade'),
|
||||
'csgo': SDK('HL2SDKCSGO', '2.csgo', '23', 'CSGO', CSGO, 'csgo'),
|
||||
}
|
||||
|
||||
def ResolveEnvPath(env, folder):
|
||||
@@ -56,7 +91,7 @@ def ResolveEnvPath(env, folder):
|
||||
|
||||
def Normalize(path):
|
||||
return os.path.abspath(os.path.normpath(path))
|
||||
|
||||
|
||||
def SetArchFlags(compiler):
|
||||
if compiler.behavior == 'gcc':
|
||||
if compiler.target.arch == 'x86_64':
|
||||
@@ -69,19 +104,13 @@ class ExtensionConfig(object):
|
||||
def __init__(self):
|
||||
self.sdks = {}
|
||||
self.binaries = []
|
||||
self.spvm = []
|
||||
self.extensions = []
|
||||
self.generated_headers = None
|
||||
self.sm_root = None
|
||||
self.mms_root = None
|
||||
self.mysql_root = {}
|
||||
self.spcomp = None
|
||||
self.spcomp_bins = None
|
||||
self.smx_files = {}
|
||||
self.versionlib = None
|
||||
self.sm_root = None
|
||||
self.all_targets = []
|
||||
self.target_archs = set()
|
||||
|
||||
self.libsafetyhook = {}
|
||||
|
||||
if builder.options.targets:
|
||||
target_archs = builder.options.targets.split(',')
|
||||
@@ -105,6 +134,26 @@ class ExtensionConfig(object):
|
||||
if not self.all_targets:
|
||||
raise Exception('No suitable C/C++ compiler was found.')
|
||||
|
||||
def use_auto_versioning(self):
|
||||
return not getattr(builder.options, 'disable_auto_versioning', True)
|
||||
|
||||
def AddVersioning(self, binary):
|
||||
if binary.compiler.target.platform == 'windows':
|
||||
binary.sources += ['version.rc']
|
||||
binary.compiler.rcdefines += [
|
||||
'BINARY_NAME="{0}"'.format(binary.outputFile),
|
||||
'RC_COMPILE',
|
||||
]
|
||||
elif binary.compiler.target.platform == 'mac':
|
||||
if binary.type == 'library':
|
||||
binary.compiler.postlink += [
|
||||
'-compatibility_version', '1.0.0',
|
||||
'-current_version', self.productVersion
|
||||
]
|
||||
if self.use_auto_versioning():
|
||||
binary.compiler.sourcedeps += self.generated_headers
|
||||
return binary
|
||||
|
||||
@property
|
||||
def tag(self):
|
||||
if builder.options.debug == '1':
|
||||
@@ -118,7 +167,7 @@ class ExtensionConfig(object):
|
||||
import re
|
||||
with open(os.path.join(builder.sourcePath, 'product.version'), 'r') as fp:
|
||||
productContents = fp.read()
|
||||
m = re.match('(\d+)\.(\d+)\.(\d+).*', productContents)
|
||||
m = re.match('(\\d+)\.(\\d+)\.(\\d+).*', productContents)
|
||||
if m == None:
|
||||
self.productVersion = '1.0.0'
|
||||
else:
|
||||
@@ -126,7 +175,7 @@ class ExtensionConfig(object):
|
||||
self.productVersion = '{0}.{1}.{2}'.format(major, minor, release)
|
||||
|
||||
def detectSDKs(self):
|
||||
sdk_list = builder.options.sdks.split(',')
|
||||
sdk_list = builder.options.sdks.split(' ')
|
||||
use_none = sdk_list[0] == 'none'
|
||||
use_all = sdk_list[0] == 'all'
|
||||
use_present = sdk_list[0] == 'present'
|
||||
@@ -152,28 +201,24 @@ class ExtensionConfig(object):
|
||||
if builder.options.sm_path:
|
||||
self.sm_root = builder.options.sm_path
|
||||
else:
|
||||
self.sm_root = ResolveEnvPath('SOURCEMOD18', 'sourcemod-1.10')
|
||||
if not self.sm_root:
|
||||
self.sm_root = ResolveEnvPath('SOURCEMOD', 'sourcemod-source')
|
||||
if not self.sm_root:
|
||||
self.sm_root = ResolveEnvPath('SOURCEMOD_DEV', 'sourcemod-central')
|
||||
self.sm_root = ResolveEnvPath('SOURCEMOD112', 'sourcemod-1.12')
|
||||
if not self.sm_root:
|
||||
self.sm_root = ResolveEnvPath('SOURCEMOD', 'sourcemod')
|
||||
if not self.sm_root:
|
||||
self.sm_root = ResolveEnvPath('SOURCEMOD_DEV', 'sourcemod-central')
|
||||
|
||||
if not self.sm_root or not os.path.isdir(self.sm_root):
|
||||
raise Exception('Could not find a source copy of Sourcemod')
|
||||
raise Exception('Could not find a source copy of SourceMod')
|
||||
self.sm_root = Normalize(self.sm_root)
|
||||
|
||||
if builder.options.mms_path:
|
||||
self.mms_root = builder.options.mms_path
|
||||
else:
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE110', 'mmsource-1.10')
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE112', 'mmsource-1.12')
|
||||
if not self.mms_root:
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'metamod-source')
|
||||
if not self.mms_root:
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'mmsource-central')
|
||||
if not self.mms_root:
|
||||
self.mms_root = ResolveEnvPath('MMSOURCE_DEV', 'metamod')
|
||||
|
||||
if not self.mms_root or not os.path.isdir(self.mms_root):
|
||||
raise Exception('Could not find a source copy of Metamod:Source')
|
||||
@@ -188,14 +233,14 @@ class ExtensionConfig(object):
|
||||
|
||||
def configure_cxx(self, cxx):
|
||||
if cxx.family == 'msvc':
|
||||
if cxx.version < 1900:
|
||||
raise Exception('Only MSVC 2015 and later are supported, c++14 support is required.')
|
||||
if cxx.family == 'gcc':
|
||||
if cxx.version < 'gcc-4.9':
|
||||
raise Exception('Only GCC versions 4.9 or greater are supported, c++14 support is required.')
|
||||
if cxx.family == 'clang':
|
||||
if cxx.version < 'clang-3.4':
|
||||
raise Exception('Only clang versions 3.4 or greater are supported, c++14 support is required.')
|
||||
if cxx.version < 1914 and builder.options.generator != 'vs':
|
||||
raise Exception(f'Only MSVC 2017 15.7 and later are supported, full C++17 support is required. ({str(cxx.version)} < 1914)')
|
||||
elif cxx.family == 'gcc':
|
||||
if cxx.version < 'gcc-9':
|
||||
raise Exception('Only GCC versions 9 or later are supported, full C++17 support is required.')
|
||||
elif cxx.family == 'clang':
|
||||
if cxx.version < 'clang-5':
|
||||
raise Exception('Only clang versions 5 or later are supported, full C++17 support is required.')
|
||||
|
||||
if cxx.like('gcc'):
|
||||
self.configure_gcc(cxx)
|
||||
@@ -223,6 +268,12 @@ class ExtensionConfig(object):
|
||||
os.path.join(self.sm_root, 'public'),
|
||||
]
|
||||
|
||||
if self.use_auto_versioning():
|
||||
cxx.defines += ['SM_GENERATED_BUILD']
|
||||
cxx.includes += [
|
||||
os.path.join(builder.buildPath, 'includes')
|
||||
]
|
||||
|
||||
def configure_gcc(self, cxx):
|
||||
cxx.defines += [
|
||||
'stricmp=strcasecmp',
|
||||
@@ -240,19 +291,19 @@ class ExtensionConfig(object):
|
||||
'-Wno-unused',
|
||||
'-Wno-switch',
|
||||
'-Wno-array-bounds',
|
||||
'-msse',
|
||||
'-Wno-unknown-pragmas',
|
||||
'-Wno-dangling-else',
|
||||
'-fvisibility=hidden',
|
||||
]
|
||||
|
||||
if cxx.version == 'apple-clang-6.0' or cxx.version == 'clang-3.4':
|
||||
cxx.cxxflags += ['-std=c++1y']
|
||||
else:
|
||||
cxx.cxxflags += ['-std=c++14']
|
||||
if cxx.target.arch in ['x86', 'x86_64']:
|
||||
cxx.cflags += ['-msse']
|
||||
|
||||
cxx.cxxflags += [
|
||||
'-std=c++17',
|
||||
'-fno-threadsafe-statics',
|
||||
'-Wno-non-virtual-dtor',
|
||||
'-Wno-overloaded-virtual',
|
||||
'-Wno-register',
|
||||
'-fvisibility-inlines-hidden',
|
||||
]
|
||||
|
||||
@@ -283,26 +334,18 @@ class ExtensionConfig(object):
|
||||
cxx.cflags += ['-Wno-sometimes-uninitialized']
|
||||
|
||||
# Work around SDK warnings.
|
||||
if cxx.version >= 'clang-10.0':
|
||||
cxx.cflags += [
|
||||
'-Wno-implicit-int-float-conversion',
|
||||
'-Wno-tautological-overlap-compare',
|
||||
]
|
||||
if cxx.version >= 'clang-10.0' or cxx.version >= 'apple-clang-12.0':
|
||||
cxx.cflags += [
|
||||
'-Wno-implicit-int-float-conversion',
|
||||
'-Wno-tautological-overlap-compare',
|
||||
]
|
||||
|
||||
if have_gcc:
|
||||
cxx.cflags += ['-mfpmath=sse']
|
||||
cxx.cflags += ['-Wno-maybe-uninitialized']
|
||||
|
||||
if builder.options.opt == '1':
|
||||
cxx.cflags += [
|
||||
'-O3',
|
||||
'-fexperimental-new-pass-manager',
|
||||
'-mllvm',
|
||||
'-inline-threshold=1000',
|
||||
'-mllvm',
|
||||
'-vectorize-loops',
|
||||
'-ftree-vectorize',
|
||||
]
|
||||
cxx.cflags += ['-O3']
|
||||
|
||||
# Don't omit the frame pointer.
|
||||
cxx.cflags += ['-fno-omit-frame-pointer']
|
||||
@@ -326,6 +369,7 @@ class ExtensionConfig(object):
|
||||
'/EHsc',
|
||||
'/GR-',
|
||||
'/TP',
|
||||
'/std:c++17',
|
||||
]
|
||||
cxx.linkflags += [
|
||||
'kernel32.lib',
|
||||
@@ -354,13 +398,12 @@ class ExtensionConfig(object):
|
||||
cxx.cflags += ['/Oy-']
|
||||
|
||||
def configure_linux(self, cxx):
|
||||
cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
|
||||
cxx.defines += ['LINUX', '_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
|
||||
cxx.linkflags += ['-lm']
|
||||
if cxx.family == 'gcc':
|
||||
cxx.linkflags += ['-static-libgcc']
|
||||
elif cxx.family == 'clang':
|
||||
cxx.linkflags += ['-lgcc_eh']
|
||||
cxx.linkflags += ['-static-libstdc++']
|
||||
|
||||
def configure_mac(self, cxx):
|
||||
cxx.defines += ['OSX', '_OSX', 'POSIX', 'KE_ABSOLUTELY_NO_STL']
|
||||
@@ -373,43 +416,16 @@ class ExtensionConfig(object):
|
||||
cxx.cxxflags += ['-stdlib=libc++']
|
||||
|
||||
def configure_windows(self, cxx):
|
||||
cxx.defines += ['WIN32', '_WINDOWS']
|
||||
|
||||
def add_libamtl(self):
|
||||
# Add libamtl.
|
||||
self.libamtl = {}
|
||||
for cxx in self.all_targets:
|
||||
def get_configure_fn(cxx):
|
||||
return lambda builder, name: self.StaticLibrary(builder, cxx, name)
|
||||
extra_vars = {'Configure': get_configure_fn(cxx)}
|
||||
libamtl = builder.Build('public/amtl/amtl/AMBuilder', extra_vars)
|
||||
self.libamtl[cxx.target.arch] = libamtl.binary
|
||||
|
||||
def AddVersioning(self, binary):
|
||||
if binary.compiler.target.platform == 'windows':
|
||||
binary.sources += ['version.rc']
|
||||
binary.compiler.rcdefines += [
|
||||
'BINARY_NAME="{0}"'.format(binary.outputFile),
|
||||
'RC_COMPILE',
|
||||
]
|
||||
elif binary.compiler.target.platform == 'mac':
|
||||
if binary.type == 'library':
|
||||
binary.compiler.postlink += [
|
||||
'-compatibility_version', '1.0.0',
|
||||
'-current_version', self.productVersion
|
||||
]
|
||||
return binary
|
||||
cxx.defines += ['WIN32', '_WINDOWS', 'PLATFORM_WINDOWS_PC']
|
||||
|
||||
def LibraryBuilder(self, compiler, name):
|
||||
binary = compiler.Library(name)
|
||||
self.AddVersioning(binary)
|
||||
if binary.compiler.like('msvc'):
|
||||
binary.compiler.linkflags += ['/SUBSYSTEM:WINDOWS']
|
||||
return binary
|
||||
|
||||
def ProgramBuilder(self, compiler, name):
|
||||
binary = compiler.Program(name)
|
||||
self.AddVersioning(binary)
|
||||
if '-static-libgcc' in binary.compiler.linkflags:
|
||||
binary.compiler.linkflags.remove('-static-libgcc')
|
||||
if '-lgcc_eh' in binary.compiler.linkflags:
|
||||
@@ -444,10 +460,10 @@ class ExtensionConfig(object):
|
||||
os.path.join(context.currentSourcePath, 'sdk'),
|
||||
os.path.join(self.sm_root, 'public'),
|
||||
os.path.join(self.sm_root, 'public', 'extensions'),
|
||||
os.path.join(self.sm_root, 'sourcepawn', 'include'),
|
||||
os.path.join(self.sm_root, 'public', 'amtl', 'amtl'),
|
||||
os.path.join(self.sm_root, 'public', 'amtl'),
|
||||
os.path.join(self.sm_root, 'extensions', 'sm-ext-common', 'include'),
|
||||
os.path.join(self.sm_root, 'sourcepawn', 'include'),
|
||||
os.path.join(self.sm_root, 'public', 'sm-ext-common', 'include'),
|
||||
]
|
||||
return compiler
|
||||
|
||||
@@ -466,7 +482,8 @@ class ExtensionConfig(object):
|
||||
os.path.join(self.mms_root, 'core', 'sourcehook'),
|
||||
]
|
||||
|
||||
defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
|
||||
defines = ['RAD_TELEMETRY_DISABLED']
|
||||
defines += ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
|
||||
compiler.defines += defines
|
||||
|
||||
paths = [
|
||||
@@ -475,8 +492,7 @@ class ExtensionConfig(object):
|
||||
['public', 'mathlib'],
|
||||
['public', 'vstdlib'],
|
||||
['public', 'tier0'],
|
||||
['public', 'tier1'],
|
||||
['public', 'appframework']
|
||||
['public', 'tier1']
|
||||
]
|
||||
if sdk.name == 'episode1' or sdk.name == 'darkm':
|
||||
paths.append(['public', 'dlls'])
|
||||
@@ -489,7 +505,7 @@ class ExtensionConfig(object):
|
||||
|
||||
compiler.defines += ['SOURCE_ENGINE=' + sdk.code]
|
||||
|
||||
if sdk.name in ['sdk2013', 'bms'] and compiler.like('gcc'):
|
||||
if sdk.name in ['sdk2013', 'bms', 'css', 'tf2', 'dods', 'hl2dm'] and compiler.like('gcc'):
|
||||
# The 2013 SDK already has these in public/tier0/basetypes.h
|
||||
compiler.defines.remove('stricmp=strcasecmp')
|
||||
compiler.defines.remove('_stricmp=strcasecmp')
|
||||
@@ -520,7 +536,6 @@ class ExtensionConfig(object):
|
||||
|
||||
if compiler.target.platform == 'linux':
|
||||
if sdk.name in ['csgo', 'blade']:
|
||||
compiler.linkflags.remove('-static-libstdc++')
|
||||
compiler.defines += ['_GLIBCXX_USE_CXX11_ABI=0']
|
||||
|
||||
for path in paths:
|
||||
@@ -532,16 +547,16 @@ class ExtensionConfig(object):
|
||||
elif sdk.name in ['sdk2013', 'bms']:
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
|
||||
elif compiler.target.arch == 'x86_64':
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'linux64')
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux64')
|
||||
else:
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux')
|
||||
elif compiler.target.platform == 'mac':
|
||||
if sdk.name in ['sdk2013', 'bms']:
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
|
||||
elif compiler.target.arch == 'x86_64':
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'osx64')
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx64')
|
||||
else:
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
|
||||
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'mac')
|
||||
|
||||
if compiler.target.platform in ['linux', 'mac']:
|
||||
if sdk.name in ['sdk2013', 'bms'] or compiler.target.arch == 'x86_64':
|
||||
@@ -580,9 +595,9 @@ class ExtensionConfig(object):
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
if compiler.target.arch == 'x86':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', 'x86', lib) + '.lib'
|
||||
elif compiler.target.arch == 'x86_64':
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', 'win64', lib) + '.lib'
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', 'x64', lib) + '.lib'
|
||||
compiler.linkflags.append(lib_path)
|
||||
|
||||
for library in dynamic_libs:
|
||||
@@ -598,16 +613,41 @@ class ExtensionConfig(object):
|
||||
|
||||
return binary
|
||||
|
||||
def AddCDetour(self, binary):
|
||||
sm_public_path = os.path.join(self.sm_root, 'public')
|
||||
|
||||
if os.path.exists(os.path.join(sm_public_path, 'safetyhook')):
|
||||
binary.sources += [ os.path.join(sm_public_path, 'CDetour', 'detours.cpp') ]
|
||||
binary.compiler.cxxincludes += [ os.path.join(builder.sourcePath, 'safetyhook', 'include') ]
|
||||
|
||||
for task in self.libsafetyhook:
|
||||
if task.target.arch == binary.compiler.target.arch:
|
||||
binary.compiler.linkflags += [task.binary]
|
||||
return
|
||||
raise Exception('No suitable build of safetyhook was found.')
|
||||
else:
|
||||
binary.sources += [
|
||||
os.path.join(sm_public_path, 'CDetour', 'detours.cpp'),
|
||||
os.path.join(sm_public_path, 'asm', 'asm.c'),
|
||||
]
|
||||
# sm1.10+
|
||||
libudis_folder = os.path.join(sm_public_path, 'libudis86')
|
||||
if os.path.isdir(libudis_folder):
|
||||
binary.compiler.defines += ['HAVE_STRING_H']
|
||||
binary.sources += [
|
||||
os.path.join(libudis_folder, 'decode.c'),
|
||||
os.path.join(libudis_folder, 'itab.c'),
|
||||
os.path.join(libudis_folder, 'syn-att.c'),
|
||||
os.path.join(libudis_folder, 'syn-intel.c'),
|
||||
os.path.join(libudis_folder, 'syn.c'),
|
||||
os.path.join(libudis_folder, 'udis86.c'),
|
||||
]
|
||||
|
||||
def HL2Library(self, context, compiler, name, sdk):
|
||||
binary = self.Library(context, compiler, name)
|
||||
self.ConfigureForExtension(context, binary.compiler)
|
||||
return self.ConfigureForHL2(context, binary, sdk)
|
||||
|
||||
def HL2Project(self, context, compiler, name):
|
||||
project = context.LibraryProject(name)
|
||||
self.ConfigureForExtension(context, compiler)
|
||||
return project
|
||||
|
||||
def HL2Config(self, project, context, compiler, name, sdk):
|
||||
binary = project.Configure(compiler, name,
|
||||
'{0} - {1} {2}'.format(self.tag, sdk.name, compiler.target.arch))
|
||||
@@ -622,24 +662,43 @@ class ExtensionConfig(object):
|
||||
self.ConfigureForExtension(context, binary.compiler)
|
||||
return binary
|
||||
|
||||
class SafetyHookShim(object):
|
||||
def __init__(self):
|
||||
self.all_targets = {}
|
||||
self.libsafetyhook = {}
|
||||
|
||||
if getattr(builder, 'target', None) is not None:
|
||||
sys.stderr.write("Your output folder was configured for AMBuild 2.1, and SourceMod is now\n")
|
||||
sys.stderr.write("configured to use AMBuild 2.2. Please remove your output folder and\n")
|
||||
sys.stderr.write("reconfigure to continue.\n")
|
||||
sys.stderr.write("Your output folder was configured for AMBuild 2.1.\n")
|
||||
sys.stderr.write("Please remove your output folder and reconfigure to continue.\n")
|
||||
os._exit(1)
|
||||
|
||||
SM = ExtensionConfig()
|
||||
SM.detectSDKs()
|
||||
SM.configure()
|
||||
Extension = ExtensionConfig()
|
||||
Extension.detectProductVersion()
|
||||
Extension.detectSDKs()
|
||||
Extension.configure()
|
||||
|
||||
if os.path.exists(os.path.join(Extension.sm_root, 'public', 'safetyhook')):
|
||||
# we need to pull safetyhook in locally because ambuild does not take kindly to outside relpaths
|
||||
safetyhook_dest = Normalize(builder.sourcePath + '/safetyhook/')
|
||||
shutil.copytree(os.path.join(Extension.sm_root, 'public', 'safetyhook'), safetyhook_dest, dirs_exist_ok=True)
|
||||
|
||||
SafetyHook = SafetyHookShim()
|
||||
SafetyHook.all_targets = Extension.all_targets
|
||||
builder.Build('safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
|
||||
Extension.libsafetyhook = SafetyHook.libsafetyhook
|
||||
|
||||
# This will clone the list and each cxx object as we recurse, preventing child
|
||||
# scripts from messing up global state.
|
||||
builder.targets = builder.CloneableList(SM.all_targets)
|
||||
builder.targets = builder.CloneableList(Extension.all_targets)
|
||||
|
||||
# Add additional buildscripts here
|
||||
BuildScripts = [
|
||||
'AMBuilder',
|
||||
]
|
||||
|
||||
if builder.backend == 'amb2':
|
||||
BuildScripts = [
|
||||
'AMBuilder',
|
||||
'PackageScript',
|
||||
]
|
||||
BuildScripts += [
|
||||
'PackageScript',
|
||||
]
|
||||
|
||||
builder.Build(BuildScripts, { 'SM': SM})
|
||||
builder.Build(BuildScripts, { 'Extension': Extension })
|
||||
|
||||
Reference in New Issue
Block a user