-
Notifications
You must be signed in to change notification settings - Fork 125
/
AMBuilder
116 lines (101 loc) · 4.38 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
import subprocess
MMSPlugin.plugin_name = 'cs2fixes'
MMSPlugin.plugin_alias = 'cs2fixes'
for sdk_target in MMSPlugin.sdk_targets:
sdk = sdk_target.sdk
cxx = sdk_target.cxx
binary = MMSPlugin.HL2Library(builder, cxx, MMSPlugin.plugin_name, sdk)
try:
version = subprocess.check_output(['git', 'describe', '--tags', '--long']).decode('ascii').strip()
except subprocess.SubprocessError as e:
version = "1.7-dev"
print("git describe failed as there are no tags")
print(f'Setting version to "{version}"')
binary.compiler.defines += ['CS2FIXES_VERSION="' + version + '"']
if binary.compiler.behavior == 'gcc':
binary.compiler.cxxflags += ['-Wno-invalid-offsetof']
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'src', 'cs2_sdk'),
os.path.join(builder.sourcePath, 'src', 'utils'),
os.path.join(builder.sourcePath, 'sdk', 'thirdparty', 'protobuf-3.21.8', 'src'),
os.path.join(builder.sourcePath, 'vendor', 'funchook', 'include'),
]
target_folder = 'Debug' if builder.options.debug else 'Release'
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, 'sdk', 'lib', 'linux64', 'release', 'libprotobuf.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, 'sdk', 'lib' ,'public', 'win64', '2015', 'libprotobuf.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/patches.cpp',
'src/cvars.cpp',
'src/adminsystem.cpp',
'src/commands.cpp',
'src/addresses.cpp',
'src/detours.cpp',
'src/entities.cpp',
'src/events.cpp',
'src/utils/entity.cpp',
'src/cs2_sdk/schema.cpp',
'src/ctimer.cpp',
'src/panoramavote.cpp',
'src/playermanager.cpp',
'src/gameconfig.cpp',
'src/gamesystem.cpp',
'src/votemanager.cpp',
'src/httpmanager.cpp',
'src/discord.cpp',
'src/map_votes.cpp',
'src/user_preferences.cpp',
'src/zombiereborn.cpp',
'src/customio.cpp',
'src/entitylistener.cpp',
'src/leader.cpp',
'src/buttonwatch.cpp',
'src/idlemanager.cpp',
'sdk/entity2/entitysystem.cpp',
'sdk/entity2/entityidentity.cpp',
'sdk/entity2/entitykeyvalues.cpp',
'sdk/tier1/keyvalues3.cpp',
]
protoc_builder = builder.tools.Protoc(protoc = sdk_target.protoc, sources = [
os.path.join(sdk['path'], 'common', 'network_connection.proto'),
os.path.join(sdk['path'], 'common', 'netmessages.proto'),
os.path.join(sdk['path'], 'common', 'networkbasetypes.proto'),
os.path.join(sdk['path'], 'common', 'engine_gcmessages.proto'),
os.path.join(sdk['path'], 'gcsdk', 'steammessages.proto'),
os.path.join(sdk['path'], 'gcsdk', 'gcsdk_gcmessages.proto'),
os.path.join(sdk['path'], 'game', 'shared', 'gameevents.proto'),
os.path.join(sdk['path'], 'game', 'shared', 'te.proto'),
os.path.join(sdk['path'], 'game', 'shared', 'usercmd.proto'),
os.path.join(sdk['path'], 'game', 'shared', 'usermessages.proto'),
os.path.join(builder.sourcePath, 'protobuf', 'cs_gameevents.proto'),
os.path.join(builder.sourcePath, 'protobuf', 'cs_usercmd.proto'),
os.path.join(builder.sourcePath, 'protobuf', 'cstrike15_gcmessages.proto'),
os.path.join(builder.sourcePath, 'protobuf', 'cstrike15_usermessages.proto'),
os.path.join(builder.sourcePath, 'protobuf', 'networksystem_protomessages.proto'),
])
protoc_builder.protoc.includes += [
os.path.join(sdk['path'], 'gcsdk'),
os.path.join(sdk['path'], 'common'),
os.path.join(sdk['path'], 'game', 'shared'),
os.path.join(builder.sourcePath, 'protobuf'),
]
binary.custom = [protoc_builder]
nodes = builder.Add(binary)
MMSPlugin.binaries += [nodes]