Modernize build/CI, support SourceMod 1.13, deprecate ForceHeartbeat

Rework the build and CI: swap to SourceMod's safetyhook-based CDetour and
drop the vendored CDetour/asm sources, the old Makefile, Travis config, and
buildbot perl scripts. Add GitHub Actions building and releasing x86 and
x86_64 against SM 1.12 and 1.13, plus dependabot. Split the Windows and Linux
packages and tidy naming.

Gate IPluginManager::FindPluginByContext on the extension API version so the
extension builds against both SM 1.12 (API 8) and 1.13 (API 9), and shim
DETOUR_CREATE_STATIC_FIXED over the address overload safetyhook exposes.

Deprecate SteamWorks_ForceHeartbeat: newer Steamworks SDKs removed
ISteamGameServer::ForceHeartbeat, so make the native a no-op and mark it
deprecated in the include.
This commit is contained in:
Nicholas Hastings
2026-07-12 10:56:36 -04:00
parent f0c1b62dff
commit 39fcfa564e
21 changed files with 332 additions and 1842 deletions
+29 -91
View File
@@ -1,24 +1,5 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
class SDK(object):
def __init__(self, sdk, ext, aDef, name, platform, dir):
self.folder = 'hl2sdk-' + dir
self.envvar = sdk
self.ext = ext
self.code = aDef
self.define = name
self.platform = platform
self.name = dir
self.path = None # Actual path
WinOnly = ['windows']
WinLinux = ['windows', 'linux']
WinLinuxMac = ['windows', 'linux', 'mac']
PossibleSDKs = {
'sdk2013': SDK('HL2SDK2013', '2.sdk2013', '9', 'SDK2013', WinLinuxMac, 'sdk2013'),
}
import os
def ResolveEnvPath(env, folder):
if env in os.environ:
@@ -43,7 +24,6 @@ def Normalize(path):
class SteamWorksConfig(object):
def __init__(self):
self.sdks = {}
self.binaries = []
self.mms_root = None
self.sm_root = None
@@ -62,29 +42,7 @@ class SteamWorksConfig(object):
return 'Debug'
return 'Release'
def detectSDKs(self):
sdk_list = builder.options.sdks.split(',')
use_all = sdk_list[0] == 'all'
use_present = sdk_list[0] == 'present'
for sdk_name in PossibleSDKs:
sdk = PossibleSDKs[sdk_name]
if builder.cxx.target.platform in sdk.platform:
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
else:
sdk_path = ResolveEnvPath(sdk.envvar, sdk.folder)
if sdk_path is None or not os.path.isdir(sdk_path):
if use_all or sdk_name in sdk_list:
raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
continue
if use_all or use_present or sdk_name in sdk_list:
sdk.path = Normalize(sdk_path)
self.sdks[sdk_name] = sdk
if len(self.sdks) < 1:
raise Exception('At least one SDK must be available.')
def detectDeps(self):
#METAMOD:SOURCE
if builder.options.mms_path:
self.mms_root = builder.options.mms_path
@@ -153,15 +111,22 @@ class SteamWorksConfig(object):
'-Wno-format',
'-Wno-format-security',
'-Wno-array-bounds',
'-msse',
'-m32',
]
cxx.cxxflags += [
'-std=c++11',
'-std=c++17',
]
have_gcc = cxx.vendor == 'gcc'
have_clang = cxx.vendor == 'clang'
if cxx.target.arch == 'x86':
cxx.cflags += ['-msse', '-m32']
cxx.linkflags += ['-m32']
if cxx.family == 'gcc':
cxx.cflags += ['-mfpmath=sse']
elif cxx.target.arch == 'x86_64':
cxx.cflags += ['-m64']
cxx.linkflags += ['-m64']
have_gcc = cxx.family == 'gcc'
have_clang = cxx.family == 'clang'
if have_clang or (have_gcc and cxx.version >= '4'):
cxx.cflags += ['-fvisibility=hidden']
cxx.cxxflags += ['-fvisibility-inlines-hidden']
@@ -179,17 +144,13 @@ class SteamWorksConfig(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':
elif cxx.like('msvc'):
if builder.options.debug == '1':
cxx.cflags += ['/MTd']
cxx.linkflags += ['/NODEFAULTLIB:libcmt']
@@ -208,9 +169,10 @@ class SteamWorksConfig(object):
'/EHsc',
'/GR-',
'/TP',
'/std:c++17',
]
cxx.linkflags += [
'/MACHINE:X86',
'/MACHINE:X64' if cxx.target.arch == 'x86_64' else '/MACHINE:X86',
'/SUBSYSTEM:WINDOWS',
'kernel32.lib',
'user32.lib',
@@ -244,27 +206,17 @@ class SteamWorksConfig(object):
cxx.cflags += ['/d2Zi+']
# This needs to be after our optimization flags which could otherwise disable it.
if cxx.vendor == 'msvc':
if cxx.like('msvc'):
# Don't omit the frame pointer.
cxx.cflags += ['/Oy-']
# Platform-specifics
if cxx.target.platform == 'linux':
cxx.defines += ['_LINUX', 'POSIX']
if cxx.vendor == 'gcc':
if cxx.family == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.vendor == 'clang':
elif cxx.family == 'clang':
cxx.linkflags += ['-lgcc_eh']
elif cxx.target.platform == 'mac':
cxx.defines += ['OSX', '_OSX', 'POSIX']
cxx.cflags += ['-mmacosx-version-min=10.5']
cxx.linkflags += [
'-mmacosx-version-min=10.5',
'-arch', 'i386',
'-static',
'-stdlib=libc++'
]
cxx.cxxflags += ['-stdlib=libstdc++']
elif cxx.target.platform == 'windows':
cxx.defines += ['WIN32', '_WINDOWS']
@@ -274,49 +226,35 @@ class SteamWorksConfig(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, 'public', 'sourcepawn'),
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):
def ConfigureForHL2(self, binary):
compiler = binary.compiler
if sdk.name == 'episode1':
mms_path = os.path.join(self.mms_root, 'core-legacy')
else:
mms_path = os.path.join(self.mms_root, 'core')
mms_path = os.path.join(self.mms_root, 'core')
compiler.cxxincludes += [
os.path.join(mms_path),
os.path.join(mms_path, 'sourcehook'),
]
defines = ['SE_' + PossibleSDKs[i].define + '=' + PossibleSDKs[i].code for i in PossibleSDKs]
compiler.defines += defines
if compiler.like('msvc'):
compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32']
else:
compiler.defines += ['COMPILER_GCC']
return binary
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.LibraryProject(name)
self.ConfigureForExtension(context, context.cxx)
return project
def HL2Config(self, project, cxx, name, sdk):
binary = project.Configure(cxx, name, '{0} - {1}'.format(self.tag, sdk.name))
return self.ConfigureForHL2(binary, sdk)
def HL2Config(self, project, cxx, name):
binary = project.Configure(cxx, name, '{0}'.format(self.tag))
return self.ConfigureForHL2(binary)
SteamWorks = SteamWorksConfig()
SteamWorks.detectSDKs()
SteamWorks.detectDeps()
SteamWorks.configure()
BuildScripts = ['Extension/AMBuilder']