forked from APGRoboCop/rcbot2
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAMBuilder
More file actions
181 lines (152 loc) · 5.99 KB
/
AMBuilder
File metadata and controls
181 lines (152 loc) · 5.99 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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
projectName = 'rcbot'
sourceFiles = [
"utils/RCBot2_meta/bot.cpp",
"utils/RCBot2_meta/bot_accessclient.cpp",
#"utils/RCBot2_meta/bot_black_mesa.cpp",
"utils/RCBot2_meta/bot_buttons.cpp",
"utils/RCBot2_meta/bot_client.cpp",
"utils/RCBot2_meta/bot_commands.cpp",
"utils/RCBot2_meta/bot_configfile.cpp",
"utils/RCBot2_meta/bot_coop.cpp",
"utils/RCBot2_meta/bot_css_bot.cpp",
"utils/RCBot2_meta/bot_css_buying.cpp",
"utils/RCBot2_meta/bot_css_mod.cpp",
"utils/RCBot2_meta/bot_dod_bot.cpp",
"utils/RCBot2_meta/bot_dod_mod.cpp",
"utils/RCBot2_meta/bot_events.cpp",
"utils/RCBot2_meta/bot_fortress.cpp",
"utils/RCBot2_meta/bot_ga.cpp",
"utils/RCBot2_meta/bot_ga_ind.cpp",
"utils/RCBot2_meta/bot_getprop.cpp",
"utils/RCBot2_meta/bot_globals.cpp",
"utils/RCBot2_meta/bot_hl1dmsrc.cpp",
"utils/RCBot2_meta/bot_hldm_bot.cpp",
"utils/RCBot2_meta/bot_kv.cpp",
"utils/RCBot2_meta/bot_menu.cpp",
"utils/RCBot2_meta/bot_mods.cpp",
"utils/RCBot2_meta/bot_mtrand.cpp",
#"utils/RCBot2_meta/bot_navmesh.cpp",
"utils/RCBot2_meta/bot_perceptron.cpp",
"utils/RCBot2_meta/bot_profile.cpp",
"utils/RCBot2_meta/bot_profiling.cpp",
"utils/RCBot2_meta/bot_schedule.cpp",
"utils/RCBot2_meta/bot_tf2_points.cpp",
"utils/RCBot2_meta/bot_som.cpp",
"utils/RCBot2_meta/bot_squads.cpp",
"utils/RCBot2_meta/bot_strings.cpp",
"utils/RCBot2_meta/bot_synergy.cpp",
"utils/RCBot2_meta/bot_synergy_mod.cpp",
"utils/RCBot2_meta/bot_task.cpp",
"utils/RCBot2_meta/bot_tf2_mod.cpp",
"utils/RCBot2_meta/bot_utility.cpp",
"utils/RCBot2_meta/bot_visibles.cpp",
"utils/RCBot2_meta/bot_waypoint.cpp",
"utils/RCBot2_meta/bot_waypoint_locations.cpp",
"utils/RCBot2_meta/bot_waypoint_visibility.cpp",
"utils/RCBot2_meta/bot_weapons.cpp",
"utils/RCBot2_meta/bot_wpt_dist.cpp",
"utils/RCBot2_meta/bot_zombie.cpp",
"utils/RCBot2_meta/bot_sigscan.cpp",
"utils/RCBot2_meta/bot_cvars.cpp",
"utils/RCBot2_meta/bot_plugin_meta.cpp",
"rcbot/logging.cpp",
"rcbot/helper.cpp",
"rcbot/entprops.cpp",
"rcbot/propvar.cpp",
"rcbot/math_fix.cpp",
"rcbot/utils.cpp",
"rcbot/tf2/conditions.cpp",
]
include_paths = [
os.path.join(builder.currentSourcePath, 'utils', 'RCBot2_meta'),
]
compiler_defines = []
# Build with SourceMod extension support if --sm-path was specified
if builder.options.sm_path:
# Validate required SourceMod directories exist
required_sm_dirs = [
os.path.join(builder.options.sm_path, 'sourcepawn', 'include'),
os.path.join(builder.options.sm_path, 'public'),
]
for sm_dir in required_sm_dirs:
if not os.path.isdir(sm_dir):
raise Exception("Required SourceMod directory '{}' not found. Check your --sm-path setting.".format(sm_dir))
include_paths += [
os.path.join(builder.options.sm_path, 'sourcepawn', 'include'),
os.path.join(builder.options.sm_path, 'public', 'amtl'),
os.path.join(builder.options.sm_path, 'public', 'amtl', 'amtl'),
os.path.join(builder.options.sm_path, 'public', 'extensions'),
os.path.join(builder.options.sm_path, 'public'),
os.path.join(builder.currentSourcePath, 'sm_ext'),
]
sourceFiles += [
os.path.join(builder.currentSourcePath, 'sm_ext', 'smsdk_config.cpp'),
os.path.join(builder.currentSourcePath, 'sm_ext', 'bot_sm_ext.cpp'),
os.path.join(builder.currentSourcePath, 'sm_ext', 'bot_sm_natives.cpp'),
]
compiler_defines += [ 'SM_EXT', ]
# List of SDK names that require hooks on runcmd
mods_requiring_runcmd_overrides = [
# hack: DOD:S uses `Bot_Think`, which forces all `bot`-spawned entities to use Valve's
# default bot AI. we'll hook into their RunPlayerMove for now, but for consistency across
# games it'd be better to supercede `Bot_Think` (or `Bot_RunAll` higher up the call stack)
'dods',
'sdk2013',
]
# List of SDK Names that has undefined reference to some math functions
sdks_requring_extern_math_functions = [
'sdk2013',
'bms',
]
# Decouple sourcesdk MAX_PLAYERS from the project - NoSoop
# https://github.com/nosoop/rcbot2/commit/684f2a28189b4523d067a31b26778632e5e50212
default_maxplayers = 65
override_maxplayers = {
'tf2': 101,
'hl2dm': 101,
}
###############
# Make sure to edit PackageScript, which copies your files to their appropriate locations
# Simple extensions do not need to modify past this point.
# set up the build info
include_paths += [
os.path.join(builder.currentSourcePath, 'versioning'),
os.path.join(builder.buildPath, 'includes'),
]
sourceFiles += [ os.path.join(builder.currentSourcePath, 'versioning', 'build_info.cpp'), ]
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
# Use the copy included in the project
# sourceFiles += [os.path.join('sdk', 'smsdk_ext.cpp')]
pass
else:
# Use the copy included with SM 1.6 and newer
# sourceFiles += [os.path.join(MMS.sm_root, 'public', 'smsdk_ext.cpp')]
pass
for sdk_target in MMS.sdk_targets:
sdk = sdk_target.sdk
cxx = sdk_target.cxx
name = projectName + '.' + sdk['extension']
sdk_name = sdk['name']
binary = MMS.HL2Library(builder, cxx, name, sdk)
binary.sources += sourceFiles
cxx = binary.compiler
if cxx.family == 'msvc':
# suppress macro redefinition of 'offsetof'
cxx.cflags += [ '/wd4005' ]
cxx.cxxincludes += include_paths
cxx.defines += compiler_defines
if sdk_name in mods_requiring_runcmd_overrides:
cxx.defines += [ 'OVERRIDE_RUNCMD' ]
if sdk_name in sdks_requring_extern_math_functions and cxx.target.platform == 'linux':
cxx.defines += [ 'MATH_LIB_FIX' ]
# RCBot: Library requires exceptions
if '-fno-exceptions' in cxx.cflags: cxx.cflags.remove('-fno-exceptions')
# Decouple sourcesdk MAX_PLAYERS from the project - NoSoop
cxx.defines += ['RCBOT_MAXPLAYERS={}'.format(override_maxplayers.get(sdk_name, default_maxplayers))]
# Epic hack for rcbot2
hl2sdkfolder = 'hl2sdk-' + sdk['name']
cxx.cxxincludes += [ os.path.join(builder.options.hl2sdk_root, hl2sdkfolder, 'game', 'server') ]
nodes = builder.Add(binary)
MMS.binaries += [nodes]