fix build on latest sourcemod
This commit is contained in:
parent
5d04944952
commit
b8de0a49f9
120
AMBuildScript
120
AMBuildScript
@ -12,7 +12,7 @@ class SDK(object):
|
||||
self.define = name
|
||||
self.platform = platform
|
||||
self.name = dir
|
||||
self.path = None
|
||||
self.path = None # Actual path
|
||||
|
||||
WinOnly = ['windows']
|
||||
WinLinux = ['windows', 'linux']
|
||||
@ -111,6 +111,32 @@ class ExtensionConfig(object):
|
||||
cxx = builder.DetectCompilers()
|
||||
|
||||
if cxx.like('gcc'):
|
||||
self.configure_gcc(cxx)
|
||||
elif cxx.vendor == 'msvc':
|
||||
self.configure_msvc(cxx)
|
||||
|
||||
# Optimizaiton
|
||||
if builder.options.opt == '1':
|
||||
cxx.defines += ['NDEBUG']
|
||||
|
||||
# Debugging
|
||||
if builder.options.debug == '1':
|
||||
cxx.defines += ['DEBUG', '_DEBUG']
|
||||
|
||||
# Platform-specifics
|
||||
if builder.target_platform == 'linux':
|
||||
self.configure_linux(cxx)
|
||||
elif builder.target_platform == 'mac':
|
||||
self.configure_mac(cxx)
|
||||
elif builder.target_platform == 'windows':
|
||||
self.configure_windows(cxx)
|
||||
|
||||
# Finish up.
|
||||
cxx.includes += [
|
||||
os.path.join(self.sm_root, 'public'),
|
||||
]
|
||||
|
||||
def configure_gcc(self, cxx):
|
||||
cxx.defines += [
|
||||
'stricmp=strcasecmp',
|
||||
'_stricmp=strcasecmp',
|
||||
@ -123,28 +149,35 @@ class ExtensionConfig(object):
|
||||
'-pipe',
|
||||
'-fno-strict-aliasing',
|
||||
'-Wall',
|
||||
# '-Werror',
|
||||
'-Werror',
|
||||
'-Wno-unused',
|
||||
'-Wno-switch',
|
||||
'-Wno-array-bounds',
|
||||
'-msse',
|
||||
'-m32',
|
||||
'-fvisibility=hidden',
|
||||
]
|
||||
cxx.cxxflags += [
|
||||
'-std=c++11',
|
||||
'-fno-exceptions',
|
||||
'-fno-threadsafe-statics',
|
||||
'-Wno-non-virtual-dtor',
|
||||
'-Wno-overloaded-virtual',
|
||||
'-fvisibility-inlines-hidden',
|
||||
]
|
||||
cxx.linkflags += ['-m32']
|
||||
|
||||
have_gcc = cxx.vendor == 'gcc'
|
||||
have_clang = cxx.vendor == 'clang'
|
||||
if have_clang or (have_gcc and cxx.version >= '4'):
|
||||
cxx.cflags += ['-fvisibility=hidden']
|
||||
cxx.cxxflags += ['-fvisibility-inlines-hidden']
|
||||
if have_clang or (have_gcc and cxx.version >= '4.6'):
|
||||
if cxx.version >= 'clang-3.6':
|
||||
cxx.cxxflags += ['-Wno-inconsistent-missing-override']
|
||||
if have_clang or (cxx.version >= 'gcc-4.6'):
|
||||
cxx.cflags += ['-Wno-narrowing']
|
||||
if (have_gcc and cxx.version >= '4.7') or (have_clang and cxx.version >= '3'):
|
||||
if have_clang or (cxx.version >= 'gcc-4.7'):
|
||||
cxx.cxxflags += ['-Wno-delete-non-virtual-dtor']
|
||||
if have_gcc and cxx.version >= '4.8':
|
||||
if cxx.version >= 'gcc-4.8':
|
||||
cxx.cflags += ['-Wno-unused-result']
|
||||
|
||||
if have_clang:
|
||||
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
|
||||
if cxx.version >= 'apple-clang-5.1' or cxx.version >= 'clang-3.4':
|
||||
@ -153,17 +186,13 @@ class ExtensionConfig(object):
|
||||
cxx.cxxflags += ['-Wno-deprecated']
|
||||
cxx.cflags += ['-Wno-sometimes-uninitialized']
|
||||
|
||||
cxx.linkflags += ['-m32']
|
||||
cxx.cxxflags += [
|
||||
'-fno-exceptions',
|
||||
'-fno-threadsafe-statics',
|
||||
'-Wno-non-virtual-dtor',
|
||||
'-Wno-overloaded-virtual',
|
||||
]
|
||||
|
||||
if have_gcc:
|
||||
cxx.cflags += ['-mfpmath=sse']
|
||||
elif cxx.vendor == 'msvc':
|
||||
|
||||
if builder.options.opt == '1':
|
||||
cxx.cflags += ['-O3']
|
||||
|
||||
def configure_msvc(self, cxx):
|
||||
if builder.options.debug == '1':
|
||||
cxx.cflags += ['/MTd']
|
||||
cxx.linkflags += ['/NODEFAULTLIB:libcmt']
|
||||
@ -199,35 +228,26 @@ class ExtensionConfig(object):
|
||||
'odbccp32.lib',
|
||||
]
|
||||
|
||||
# Optimization
|
||||
if builder.options.opt == '1':
|
||||
cxx.defines += ['NDEBUG']
|
||||
if cxx.like('gcc'):
|
||||
cxx.cflags += ['-O3']
|
||||
elif cxx.like('msvc'):
|
||||
cxx.cflags += ['/Ox', '/Zo']
|
||||
cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
|
||||
|
||||
# Debugging
|
||||
if builder.options.debug == '1':
|
||||
cxx.defines += ['DEBUG', '_DEBUG']
|
||||
if cxx.like('msvc'):
|
||||
cxx.cflags += ['/Od', '/RTC1']
|
||||
|
||||
# This needs to be after our optimization flags which could otherwise disable it.
|
||||
if cxx.vendor == 'msvc':
|
||||
# Don't omit the frame pointer.
|
||||
cxx.cflags += ['/Oy-']
|
||||
|
||||
# Platform-specifics
|
||||
if builder.target_platform == 'linux':
|
||||
def configure_linux(self, cxx):
|
||||
cxx.defines += ['_LINUX', 'POSIX']
|
||||
cxx.linkflags += ['-lm']
|
||||
cxx.linkflags += ['-Wl,--exclude-libs,ALL', '-lm']
|
||||
if cxx.vendor == 'gcc':
|
||||
cxx.linkflags += ['-static-libgcc']
|
||||
elif cxx.vendor == 'clang':
|
||||
cxx.linkflags += ['-lgcc_eh']
|
||||
elif builder.target_platform == 'mac':
|
||||
|
||||
def configure_mac(self, cxx):
|
||||
cxx.defines += ['OSX', '_OSX', 'POSIX']
|
||||
cxx.cflags += ['-mmacosx-version-min=10.5']
|
||||
cxx.linkflags += [
|
||||
@ -237,13 +257,21 @@ class ExtensionConfig(object):
|
||||
'-stdlib=libstdc++',
|
||||
]
|
||||
cxx.cxxflags += ['-stdlib=libstdc++']
|
||||
elif builder.target_platform == 'windows':
|
||||
|
||||
def configure_windows(self, cxx):
|
||||
cxx.defines += ['WIN32', '_WINDOWS']
|
||||
|
||||
# Finish up.
|
||||
cxx.includes += [
|
||||
def ConfigureForExtension(self, context, compiler):
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(context.currentSourcePath),
|
||||
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'),
|
||||
]
|
||||
return compiler
|
||||
|
||||
def ConfigureForHL2(self, binary, sdk):
|
||||
compiler = binary.compiler
|
||||
@ -294,10 +322,10 @@ class ExtensionConfig(object):
|
||||
|
||||
# For everything after Swarm, this needs to be defined for entity networking
|
||||
# to work properly with sendprop value changes.
|
||||
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
|
||||
if sdk.name in ['blade', 'insurgency', 'doi', 'csgo']:
|
||||
compiler.defines += ['NETWORK_VARS_ENABLED']
|
||||
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2', 'dota']:
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2']:
|
||||
if builder.target_platform in ['linux', 'mac']:
|
||||
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']
|
||||
|
||||
@ -332,14 +360,14 @@ class ExtensionConfig(object):
|
||||
compiler.Dep(os.path.join(lib_folder, 'mathlib_i486.a'))
|
||||
]
|
||||
|
||||
if sdk.name in ['blade', 'insurgency', 'csgo', 'dota']:
|
||||
if sdk.name in ['blade', 'insurgency', 'doi', 'csgo']:
|
||||
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
|
||||
|
||||
dynamic_libs = []
|
||||
if builder.target_platform == 'linux':
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2']:
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']:
|
||||
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
|
||||
elif sdk.name in ['l4d', 'blade', 'insurgency', 'csgo', 'dota']:
|
||||
elif sdk.name in ['l4d', 'blade', 'insurgency', 'doi', 'csgo']:
|
||||
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
|
||||
else:
|
||||
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
|
||||
@ -348,7 +376,7 @@ class ExtensionConfig(object):
|
||||
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
|
||||
elif builder.target_platform == 'windows':
|
||||
libs = ['tier0', 'tier1', 'vstdlib', 'mathlib']
|
||||
if sdk.name in ['swarm', 'blade', 'insurgency', 'csgo', 'dota']:
|
||||
if sdk.name in ['swarm', 'blade', 'insurgency', 'doi', 'csgo']:
|
||||
libs.append('interfaces')
|
||||
for lib in libs:
|
||||
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
|
||||
@ -369,16 +397,10 @@ class ExtensionConfig(object):
|
||||
|
||||
return binary
|
||||
|
||||
def ConfigureForExtension(self, context, compiler):
|
||||
compiler.cxxincludes += [
|
||||
os.path.join(context.currentSourcePath),
|
||||
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', 'include'),
|
||||
]
|
||||
return compiler
|
||||
def HL2Library(self, context, name, sdk):
|
||||
binary = context.compiler.Library(name)
|
||||
self.ConfigureForExtension(context, binary.compiler)
|
||||
return self.ConfigureForHL2(binary, sdk)
|
||||
|
||||
def HL2Project(self, context, name):
|
||||
project = context.compiler.LibraryProject(name)
|
||||
|
15
AMBuilder
15
AMBuilder
@ -11,18 +11,19 @@ project.sources += [
|
||||
'extension.cpp',
|
||||
'../../public/smsdk_ext.cpp',
|
||||
'../../public/CDetour/detours.cpp',
|
||||
'../../public/asm/asm.c'
|
||||
'../../public/asm/asm.c',
|
||||
'../../public/libudis86/decode.c',
|
||||
'../../public/libudis86/itab.c',
|
||||
'../../public/libudis86/syn-att.c',
|
||||
'../../public/libudis86/syn-intel.c',
|
||||
'../../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]
|
||||
|
||||
binary = SM.HL2Config(project, projectName + '.ext', sdk)
|
||||
binary.compiler.cxxincludes += [
|
||||
os.path.join(SM.sm_root, 'public', 'extensions'),
|
||||
os.path.join(SM.sm_root, 'public', 'sourcepawn'),
|
||||
os.path.join(SM.sm_root, 'public', 'amtl'),
|
||||
os.path.join(SM.sm_root, 'public', 'amtl', 'amtl')
|
||||
]
|
||||
|
||||
SM.extensions += builder.Add(project)
|
||||
|
@ -187,9 +187,9 @@ public:
|
||||
int iChallenge;
|
||||
int iClientChallenge;
|
||||
int nAuthProtocol;
|
||||
char pchName[255];
|
||||
char pchPassword[255];
|
||||
char pCookie[255];
|
||||
char pchName[256];
|
||||
char pchPassword[256];
|
||||
char pCookie[256];
|
||||
int cbCookie;
|
||||
|
||||
uint64 ullSteamID;
|
||||
@ -206,9 +206,9 @@ public:
|
||||
this->iChallenge = iChallenge;
|
||||
this->iClientChallenge = iClientChallenge;
|
||||
this->nAuthProtocol = nAuthProtocol;
|
||||
strncpy(this->pchName, pchName, sizeof(this->pchName));
|
||||
strncpy(this->pchPassword, pchPassword, sizeof(this->pchPassword));
|
||||
strncpy(this->pCookie, pCookie, sizeof(this->pCookie));
|
||||
strncpy(this->pchName, pchName, sizeof(this->pchName) - 1);
|
||||
strncpy(this->pchPassword, pchPassword, sizeof(this->pchPassword) - 1);
|
||||
strncpy(this->pCookie, pCookie, sizeof(this->pCookie) - 1);
|
||||
this->cbCookie = cbCookie;
|
||||
this->GotValidateAuthTicketResponse = false;
|
||||
this->SteamLegal = false;
|
||||
|
Loading…
Reference in New Issue
Block a user