mirror of
https://github.com/alliedmodders/sourcemod.git
synced 2025-12-06 18:08:36 +00:00
* Add x64 Windows support * undo changes of hook.cpp * undo changes of hook.h * undo changes of extension.cpp * undo changes of listeners.cpp * undo changes of signatures.cpp * fix dhooks on x86 * Fix-up dhooks buildscript --------- Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
83 lines
2.6 KiB
Python
83 lines
2.6 KiB
Python
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
|
|
import os
|
|
|
|
for cxx in builder.targets:
|
|
binary = SM.ExtLibrary(builder, cxx, 'dhooks.ext')
|
|
|
|
# mac isn't supported
|
|
if binary.compiler.target.platform == 'mac':
|
|
continue
|
|
# Presently only x86_64 on Windows is supported
|
|
if binary.compiler.target.arch == 'x86_64' and binary.compiler.target.platform != 'windows':
|
|
continue
|
|
|
|
binary.compiler.defines += [
|
|
'META_NO_HL2SDK',
|
|
'HAVE_STRING_H',
|
|
]
|
|
|
|
if binary.compiler.like('gcc'):
|
|
binary.compiler.cflags += ['-Wno-invalid-offsetof']
|
|
|
|
binary.compiler.cxxincludes += [
|
|
os.path.join(SM.mms_root, 'core'),
|
|
os.path.join(SM.mms_root, 'core', 'sourcehook'),
|
|
os.path.join(builder.sourcePath, 'extensions', 'dhooks'),
|
|
os.path.join(builder.sourcePath, 'public', 'jit'),
|
|
os.path.join(builder.sourcePath, 'sourcepawn', 'include'),
|
|
os.path.join(builder.sourcePath, 'sourcepawn', 'vm'),
|
|
os.path.join(builder.sourcePath, 'extensions', 'dhooks', 'DynamicHooks'),
|
|
]
|
|
|
|
binary.compiler.includes += [
|
|
os.path.join(builder.sourcePath, 'extensions', 'dhooks')
|
|
]
|
|
|
|
binary.sources += [
|
|
'extension.cpp',
|
|
'listeners.cpp',
|
|
'natives.cpp',
|
|
'signatures.cpp',
|
|
'vhook.cpp',
|
|
'util.cpp',
|
|
'dynhooks_sourcepawn.cpp',
|
|
'../../public/smsdk_ext.cpp',
|
|
'asm/asm.c',
|
|
'libudis86/decode.c',
|
|
'libudis86/itab.c',
|
|
'libudis86/syn-att.c',
|
|
'libudis86/syn-intel.c',
|
|
'libudis86/syn.c',
|
|
'libudis86/udis86.c',
|
|
# Dynamic Hooks
|
|
os.path.join('DynamicHooks', 'registers.cpp')
|
|
]
|
|
|
|
if binary.compiler.target.arch == 'x86':
|
|
binary.sources += ['../../sourcepawn/vm/x86/assembler-x86.cpp']
|
|
binary.compiler.cxxincludes += [
|
|
os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
|
|
os.path.join(builder.sourcePath, 'sourcepawn', 'vm', 'x86')
|
|
]
|
|
# DynamicHooks
|
|
binary.sources += [
|
|
os.path.join('DynamicHooks', 'hook.cpp'),
|
|
os.path.join('DynamicHooks', 'manager.cpp'),
|
|
os.path.join('DynamicHooks', 'conventions', 'x86MsCdecl.cpp'),
|
|
os.path.join('DynamicHooks', 'conventions', 'x86MsStdcall.cpp'),
|
|
os.path.join('DynamicHooks', 'conventions', 'x86MsFastcall.cpp'),
|
|
]
|
|
|
|
if binary.compiler.target.platform == 'windows':
|
|
binary.sources += [os.path.join('DynamicHooks', 'conventions', 'x86MsThiscall.cpp')]
|
|
else:
|
|
binary.sources += [os.path.join('DynamicHooks', 'conventions', 'x86GccThiscall.cpp')]
|
|
|
|
# Dynamic detour is only supported on x86
|
|
binary.compiler.defines += ['DHOOKS_DYNAMIC_DETOUR']
|
|
|
|
elif binary.compiler.target.arch == 'x86_64':
|
|
binary.compiler.defines += ['PLATFORM_X64']
|
|
|
|
SM.extensions += [builder.Add(binary)]
|