-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup AMBuild * remove amalgamated --------- Co-authored-by: Kenzzer <[email protected]>
- Loading branch information
Showing
15 changed files
with
149 additions
and
2,941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class SafetyHook(object): | ||
def __init__(self): | ||
self.all_targets = [] | ||
self.libsafetyhook = {} | ||
def configure(self): | ||
target_archs = [] | ||
if builder.options.targets: | ||
target_archs = builder.options.targets.split(',') | ||
else: | ||
target_archs = ['x86', 'x86_64'] | ||
|
||
for arch in target_archs: | ||
try: | ||
cxx = builder.DetectCxx(target_arch = arch) | ||
except Exception as e: | ||
if builder.options.targets: | ||
raise | ||
print('Skipping target {}: {}'.format(arch, e)) | ||
continue | ||
self.all_targets.append(cxx) | ||
|
||
SH = SafetyHook() | ||
SH.configure() | ||
|
||
builder.Build('AMBuilder', {'SafetyHook': SH }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import os | ||
|
||
def AddSourceFilesFromDir(path, files): | ||
list = [] | ||
for file in files: | ||
list.append(os.path.join(path, file)) | ||
return list | ||
|
||
libsafetyhook = builder.StaticLibraryProject('libsafetyhook') | ||
# SafetyHook sourcefiles | ||
libsafetyhook.sources = AddSourceFilesFromDir(os.path.join(builder.currentSourcePath, 'src'),[ | ||
"allocator.cpp", | ||
"easy.cpp", | ||
"inline_hook.cpp", | ||
"mid_hook.cpp", | ||
"utility.cpp", | ||
"vmt_hook.cpp", | ||
]) | ||
# Safetyhook dependency Zydis | ||
libsafetyhook.sources += AddSourceFilesFromDir(os.path.join(builder.currentSourcePath, 'zydis'),[ | ||
"Zydis.c" | ||
]) | ||
|
||
for compiler in SafetyHook.all_targets: | ||
binary = libsafetyhook.Configure(compiler, libsafetyhook.name, 'Release - {0}'.format(compiler.target.arch)) | ||
# Configure the binary's compiler | ||
compiler = binary.compiler | ||
# Reset all flags, safetyhook requires specific compilation flags | ||
compiler.cxxflags = [] | ||
compiler.cflags = [] | ||
compiler.defines = [] | ||
compiler.includes = [] | ||
compiler.cxxincludes = [] | ||
|
||
if compiler.target.platform == 'windows': | ||
compiler.cflags += [ | ||
"/W4", | ||
] | ||
compiler.cxxflags += [ | ||
"/EHsc", | ||
"/permissive-", | ||
"/w14640", | ||
"/std:c++17" | ||
] | ||
binary.sources += [ os.path.join(builder.currentSourcePath, 'src', 'os.windows.cpp') ] | ||
elif compiler.target.platform == 'linux': | ||
compiler.cflags += [ | ||
"-Werror", | ||
"-Wall", | ||
"-Wextra", | ||
"-pedantic", | ||
"-Wshadow", | ||
"-Wno-unused-const-variable", | ||
"-Wno-unused-function" | ||
] | ||
compiler.cxxflags += [ | ||
"-Wnon-virtual-dtor", | ||
"-std=c++17" | ||
] | ||
binary.sources += [ os.path.join(builder.currentSourcePath, 'src', 'os.linux.cpp') ] | ||
compiler.includes += [os.path.join(builder.currentSourcePath, 'include'), os.path.join(builder.currentSourcePath, 'zydis')] | ||
|
||
# Send back the binaries | ||
SafetyHook.libsafetyhook = builder.Add(libsafetyhook) |
Oops, something went wrong.