-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathAMBuildScript
More file actions
48 lines (41 loc) · 1.33 KB
/
Copy pathAMBuildScript
File metadata and controls
48 lines (41 loc) · 1.33 KB
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
class KHook(object):
def __init__(self):
self.all_targets = []
self.libsafetyhook = {}
self.libkhook = {}
self.libgtest = {}
self.test_binaries = []
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)
for cxx in self.all_targets:
if cxx.like('gcc'):
cxx.cxxflags += [
'-std=c++17',
]
elif cxx.family == 'msvc':
cxx.cxxflags += [
'/std:c++17'
]
if getattr(builder.options, 'enable_tests', False):
cxx.defines += ['KHOOK_TESTS']
KH = KHook()
KH.configure()
builder.Build('third_party/safetyhook/AMBuilder', {'SafetyHook': KH})
builder.Build('AMBuilder', {'KHook': KH})
if getattr(builder.options, 'enable_tests', False):
builder.Build('test/AMBuilder.gtest', {'GTest': KH})
builder.Build('test/AMBuilder', {'TestRunner': KH, 'KHook': KH, 'SafetyHook': KH})
builder.Build('PackageScript', {'KHook': KH})