Move Safetyhook mess into a mirror repo (#2163)
* Bring in safetyhook mirror repo * Add proper submodule * Update submodule for linux fixes * Update submodule again * Change the method of compiling safetyhook (#2167) Co-authored-by: Kenzzer <[email protected]> * Update submodule * Update submodule for -fPIC --------- Co-authored-by: Benoist <[email protected]> Co-authored-by: Kenzzer <[email protected]>
This commit is contained in:
co-authored by
Kenzzer
Benoist
parent
11d3cf94f7
commit
d42a8c7c1e
+19
-7
@@ -55,6 +55,7 @@ class SMConfig(object):
|
||||
self.target_archs = set()
|
||||
self.enable_asan = getattr(builder.options, 'enable_asan', False)
|
||||
self.asan_libs = {}
|
||||
self.libsafetyhook = {}
|
||||
|
||||
if builder.options.targets:
|
||||
target_archs = builder.options.targets.split(',')
|
||||
@@ -522,13 +523,14 @@ class SMConfig(object):
|
||||
|
||||
def AddCDetour(self, binary):
|
||||
public_path = os.path.join(builder.sourcePath, 'public')
|
||||
binary.sources += [
|
||||
os.path.join(public_path, 'CDetour', 'detours.cpp'),
|
||||
os.path.join(public_path, 'safetyhook', 'safetyhook.cpp'),
|
||||
os.path.join(public_path, 'safetyhook', 'Zydis.c')
|
||||
]
|
||||
binary.compiler.cxxincludes += [ os.path.join(public_path, 'safetyhook') ]
|
||||
binary.compiler.includes += [ os.path.join(public_path, 'safetyhook') ]
|
||||
binary.sources += [ os.path.join(public_path, 'CDetour', 'detours.cpp') ]
|
||||
binary.compiler.cxxincludes += [ os.path.join(public_path, '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.')
|
||||
|
||||
def HL2Library(self, context, compiler, name, sdk):
|
||||
binary = self.Library(context, compiler, name)
|
||||
@@ -578,6 +580,16 @@ if SM.use_auto_versioning():
|
||||
{ 'SM': SM }
|
||||
)
|
||||
|
||||
class SafetyHookShim(object):
|
||||
def __init__(self):
|
||||
self.all_targets = {}
|
||||
self.libsafetyhook = {}
|
||||
|
||||
SafetyHook = SafetyHookShim()
|
||||
SafetyHook.all_targets = SM.all_targets
|
||||
builder.Build('public/safetyhook/AMBuilder', {'SafetyHook': SafetyHook })
|
||||
SM.libsafetyhook = SafetyHook.libsafetyhook
|
||||
|
||||
class SPRoot(object):
|
||||
def __init__(self):
|
||||
self.generated_headers = SM.generated_headers
|
||||
|
||||
Reference in New Issue
Block a user