From ec50291ea9e5352a57d1f88243d8b441294d493b Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Sun, 15 Dec 2024 09:08:08 +0100 Subject: [PATCH] Fix compilation against older pre safetyhook SourceMod --- AMBuildScript | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/AMBuildScript b/AMBuildScript index 5f9542a..5d7ca71 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -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: @@ -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 = [