Skip to content

Commit

Permalink
Fix compilation against older pre safetyhook SourceMod
Browse files Browse the repository at this point in the history
  • Loading branch information
peace-maker committed Dec 15, 2024
1 parent 223505d commit ec50291
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ class ExtensionConfig(object):

def AddCDetour(self, binary):
binary.sources += [ os.path.join(self.sm_root, 'public', 'CDetour', 'detours.cpp') ]
if os.path.exists(os.path.join(self.sm_root, 'public', 'asm', 'asm.c')):
binary.sources += [ os.path.join(self.sm_root, 'public', 'asm', 'asm.c') ]
binary.compiler.cxxincludes += [ os.path.join(builder.sourcePath, 'safetyhook', 'include') ]

for task in self.libsafetyhook:
Expand All @@ -473,15 +475,16 @@ Extension = ExtensionConfig()
Extension.detectSDKs()
Extension.configure()

class SafetyHookShim(object):
def __init__(self):
self.all_targets = {}
self.libsafetyhook = {}
if os.path.exists(os.path.join(builder.sourcePath, 'safetyhook', 'AMBuilder')):
class SafetyHookShim(object):
def __init__(self):
self.all_targets = {}
self.libsafetyhook = {}

SafetyHook = SafetyHookShim()
SafetyHook.all_targets = Extension.all_targets
builder.Build('safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
Extension.libsafetyhook = SafetyHook.libsafetyhook
SafetyHook = SafetyHookShim()
SafetyHook.all_targets = Extension.all_targets
builder.Build('safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
Extension.libsafetyhook = SafetyHook.libsafetyhook

# Add additional buildscripts here
BuildScripts = [
Expand Down

0 comments on commit ec50291

Please sign in to comment.