-
Notifications
You must be signed in to change notification settings - Fork 2
/
AMBuilder
66 lines (61 loc) · 1.86 KB
/
AMBuilder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
def AddSourceFilesFromDir(path, files):
list = []
for file in files:
list.append(os.path.join(path, file))
return list
libsafetyhook = builder.StaticLibraryProject('safetyhook')
# 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",
"-fPIC"
]
compiler.cxxflags += [
"-Wnon-virtual-dtor",
"-Wno-format",
"-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)