-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAMBuildScript
64 lines (52 loc) · 1.48 KB
/
AMBuildScript
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
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys
def ResolveEnvPath(env, folder):
if env in os.environ:
path = os.environ[env]
if os.path.isdir(path):
return path
return None
head = os.getcwd()
oldhead = None
while head != None and head != oldhead:
path = os.path.join(head, folder)
if os.path.isdir(path):
return path
oldhead = head
head, tail = os.path.split(head)
return None
def Normalize(path):
return os.path.abspath(os.path.normpath(path))
class ExtensionConfig(object):
def __init__(self):
self.generated_headers = None
self.sm_bin_path = None
self.smx_files = {}
@property
def tag(self):
if builder.options.debug == '1':
return 'Debug'
return 'Release'
def configure(self):
builder.DetectCompilers()
if builder.options.sm_bin_path:
self.sm_bin_path = builder.options.sm_bin_path
else:
self.sm_bin_path = ResolveEnvPath('SOURCEMOD_BINS', 'sourcemod-bins')
if not self.sm_bin_path or not os.path.isdir(self.sm_bin_path):
raise Exception('Could not find a compiled copy of SourceMod')
self.sm_bin_path = Normalize(self.sm_bin_path)
Extension = ExtensionConfig()
Extension.configure()
Extension.generated_headers = builder.RunScript(
'tools/buildbot/Versioning',
{ 'Extension': Extension }
)
if builder.backend == 'amb2':
builder.RunBuildScripts(
[
'scripting/AMBuilder',
'PackageScript',
],
{ 'Extension': Extension }
)