This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
AMBuilder
91 lines (75 loc) · 3.47 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
MMSPlugin.plugin_name = 'cs2scrim'
for sdk_name in MMSPlugin.sdks:
for cxx in MMSPlugin.all_targets:
sdk = MMSPlugin.sdks[sdk_name]
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
binary = MMSPlugin.HL2Library(builder, cxx, MMSPlugin.plugin_name, sdk)
if binary.compiler.family == 'gcc' or binary.compiler.family == 'clang':
binary.compiler.cxxflags += ['--std=c++17']
elif binary.compiler.family == 'msvc':
binary.compiler.cxxflags += ['/std:c++20']
if binary.compiler.family == 'clang':
binary.compiler.cxxflags += ['-Wno-register']
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'src', 'cs2_sdk'),
os.path.join(builder.sourcePath, 'src', 'utils'),
os.path.join(builder.sourcePath, 'vendor', 'subhook'),
os.path.join(builder.sourcePath, 'vendor', 'funchook', 'include'),
os.path.join(builder.sourcePath, 'vendor', 'protobuf-3.21.8', 'src'),
os.path.join(builder.sourcePath, 'protobuf', 'generated'),
]
target_folder = 'Debug' if builder.options.debug else 'Release'
target_protobuf = 'libprotobufd' if builder.options.debug else 'libprotobuf'
if binary.compiler.target.platform == 'linux':
binary.compiler.postlink += [
os.path.join(builder.sourcePath, 'vendor', 'funchook', 'lib', target_folder, 'libfunchook.a'),
os.path.join(builder.sourcePath, 'vendor', 'funchook', 'lib', target_folder, 'libdistorm.a'),
os.path.join(builder.sourcePath, 'vendor', 'protobuf-lib', target_folder, target_protobuf + '.a'),
]
binary.sources += ['src/utils/plat_unix.cpp']
elif binary.compiler.target.platform == 'windows':
binary.compiler.postlink += [
os.path.join('psapi.lib'),
os.path.join(builder.sourcePath, 'vendor', 'funchook', 'lib', target_folder, 'funchook.lib'),
os.path.join(builder.sourcePath, 'vendor', 'funchook', 'lib', target_folder, 'distorm.lib'),
os.path.join(builder.sourcePath, 'vendor', 'protobuf-lib', target_folder, target_protobuf + '.lib'),
os.path.join(builder.sourcePath, 'sdk', 'lib', 'public', 'win64', 'steam_api64.lib')
]
binary.sources += ['src/utils/plat_win.cpp']
binary.sources += [
'src/cs2fixes.cpp',
'src/mempatch.cpp',
'src/cvars.cpp',
'src/adminsystem.cpp',
'src/commands.cpp',
'src/addresses.cpp',
'src/detours.cpp',
'src/events.cpp',
'src/utils/entity.cpp',
'src/cs2_sdk/schema.cpp',
'src/ctimer.cpp',
'src/playermanager.cpp',
'src/gameconfig.cpp',
'src/gamesystem.cpp',
'src/entitylistener.cpp',
]
if sdk_name in ['dota', 'cs2']:
binary.sources += [
os.path.join(sdk.path, 'entity2', 'entitysystem.cpp'),
os.path.join(sdk.path, 'entity2', 'entityidentity.cpp'),
os.path.join(sdk.path, 'entity2', 'entitykeyvalues.cpp'),
os.path.join(sdk.path, 'tier1', 'convar.cpp'),
os.path.join(sdk.path, 'tier1', 'keyvalues3.cpp'),
]
if sdk_name in ['dota', 'cs2'] and (binary.compiler.target.platform == 'windows' and builder.options.debug != '1') or binary.compiler.target.platform == 'linux':
binary.sources += [
os.path.join(sdk.path, 'public', 'tier0', 'memoverride.cpp')
]
if cxx.target.arch == 'x86':
binary.sources += ['sourcehook/sourcehook_hookmangen.cpp']
nodes = builder.Add(binary)
MMSPlugin.binaries += [nodes]
break