forked from rcbotCheeseh/rcbot2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AMBuilder
176 lines (153 loc) · 6.12 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
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
# 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_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",
]
include_paths = []
compiler_defines = []
# Build with SourceMod extension support if --sm-path was specified
if builder.options.sm_path:
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'),
os.path.join(builder.currentSourcePath, 'sm_ext'),
os.path.join(builder.currentSourcePath, 'utils', 'RCBot2_meta'),
]
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',
]
###############
# 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'), ]
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_name in MMS.sdks:
for arch in MMS.archs:
sdk = MMS.sdks[sdk_name]
if not arch in sdk.platformSpec[builder.target.platform]:
continue
name = projectName + '.' + sdk.ext
binary = MMS.HL2Library(builder, name, sdk, arch)
binary.sources += sourceFiles
cxx = binary.compiler
if (cxx.version >= 'gcc-4.0') or cxx.family == 'clang':
cxx.cflags += [ '-Dstrcmpi=strcasecmp', ]
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' ]
# RCBot: Library requires exceptions
if '-fno-exceptions' in cxx.cflags: cxx.cflags.remove('-fno-exceptions')
if builder.target.platform == 'linux':
if sdk.name == 'episode1':
lib_folder = os.path.join(sdk.path, 'linux_sdk')
elif sdk.name in ['sdk2013', 'bms']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'linux32')
elif arch == 'x64':
lib_folder = os.path.join(sdk.path, 'lib', 'linux64')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
elif builder.target.platform == 'mac':
if sdk.name in ['sdk2013', 'bms']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
elif arch == 'x64':
lib_folder = os.path.join(sdk.path, 'lib', 'osx64')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'mac')
if builder.target.platform in ['linux', 'mac']:
## RCBot2: link other dependencies
if sdk.name in ['sdk2013', 'bms']:
cxx.postlink += [
cxx.Dep(os.path.join(lib_folder, 'mathlib.a')),
cxx.Dep(os.path.join(lib_folder, 'tier2.a')),
cxx.Dep(os.path.join(lib_folder, 'tier3.a')),
'libvstdlib_srv.so',
'-lm',
'-ldl',
'-lpthread'
]
else:
cxx.postlink += [
cxx.Dep(os.path.join(lib_folder, 'mathlib_i486.a')),
cxx.Dep(os.path.join(lib_folder, 'tier2_i486.a')),
cxx.Dep(os.path.join(lib_folder, 'tier3_i486.a')),
'libvstdlib_srv.so',
'-lm',
'-ldl',
'-lpthread'
]
nodes = builder.Add(binary)
MMS.binaries += [nodes]