Changed build system so that it no longer requires all SDKs to be available (bug 5023, r=ds).
This commit is contained in:
parent
e62278859e
commit
e6df54537a
@ -8,25 +8,27 @@ class SM:
|
|||||||
self.compiler = Cpp.Compiler()
|
self.compiler = Cpp.Compiler()
|
||||||
|
|
||||||
#Build SDK info
|
#Build SDK info
|
||||||
self.sdkInfo = { }
|
self.possibleSdks = { }
|
||||||
self.sdkInfo['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
|
self.possibleSdks['ep1'] = {'sdk': 'HL2SDK', 'ext': '1.ep1', 'def': '1',
|
||||||
'name': 'EPISODEONE', 'platform': ['windows', 'linux']}
|
'name': 'EPISODEONE', 'platform': ['windows', 'linux']}
|
||||||
self.sdkInfo['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
|
self.possibleSdks['ep2'] = {'sdk': 'HL2SDKOB', 'ext': '2.ep2', 'def': '3',
|
||||||
'name': 'ORANGEBOX', 'platform': ['windows', 'linux']}
|
'name': 'ORANGEBOX', 'platform': ['windows', 'linux']}
|
||||||
self.sdkInfo['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '6',
|
self.possibleSdks['ep2v'] = {'sdk': 'HL2SDKOBVALVE', 'ext': '2.ep2v', 'def': '6',
|
||||||
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
|
'name': 'ORANGEBOXVALVE', 'platform': ['windows', 'linux', 'darwin']}
|
||||||
self.sdkInfo['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '7',
|
self.possibleSdks['l4d'] = {'sdk': 'HL2SDKL4D', 'ext': '2.l4d', 'def': '7',
|
||||||
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin']}
|
'name': 'LEFT4DEAD', 'platform': ['windows', 'linux', 'darwin']}
|
||||||
self.sdkInfo['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '8',
|
self.possibleSdks['l4d2'] = {'sdk': 'HL2SDKL4D2', 'ext': '2.l4d2', 'def': '8',
|
||||||
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin']}
|
'name': 'LEFT4DEAD2', 'platform': ['windows', 'linux', 'darwin']}
|
||||||
self.sdkInfo['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
self.possibleSdks['darkm'] = {'sdk': 'HL2SDK-DARKM', 'ext': '2.darkm', 'def': '2',
|
||||||
'name': 'DARKMESSIAH', 'platform': ['windows']}
|
'name': 'DARKMESSIAH', 'platform': ['windows']}
|
||||||
self.sdkInfo['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '9',
|
self.possibleSdks['swarm'] = {'sdk': 'HL2SDK-SWARM', 'ext': '2.swarm', 'def': '9',
|
||||||
'name': 'ALIENSWARM', 'platform': ['windows']}
|
'name': 'ALIENSWARM', 'platform': ['windows']}
|
||||||
self.sdkInfo['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
|
self.possibleSdks['bgt'] = {'sdk': 'HL2SDK-BGT', 'ext': '2.bgt', 'def': '4',
|
||||||
'name': 'BLOODYGOODTIME', 'platform': ['windows']}
|
'name': 'BLOODYGOODTIME', 'platform': ['windows']}
|
||||||
self.sdkInfo['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
|
self.possibleSdks['eye'] = {'sdk': 'HL2SDK-EYE', 'ext': '2.eye', 'def': '5',
|
||||||
'name': 'EYE', 'platform': ['windows']}
|
'name': 'EYE', 'platform': ['windows']}
|
||||||
|
|
||||||
|
self.sdkInfo = { }
|
||||||
|
|
||||||
if AMBuild.mode == 'config':
|
if AMBuild.mode == 'config':
|
||||||
#Detect compilers
|
#Detect compilers
|
||||||
@ -51,12 +53,22 @@ class SM:
|
|||||||
envvars['HL2SDK-BGT'] = 'hl2sdk-bgt'
|
envvars['HL2SDK-BGT'] = 'hl2sdk-bgt'
|
||||||
envvars['HL2SDK-EYE'] = 'hl2sdk-eye'
|
envvars['HL2SDK-EYE'] = 'hl2sdk-eye'
|
||||||
|
|
||||||
#Must have a path for each envvar (file a bug if you don't like this)
|
# Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary`
|
||||||
|
def findDictByKey(dictionary, key, value):
|
||||||
|
for index in dictionary:
|
||||||
|
elem = dictionary[index]
|
||||||
|
if elem[key] == value:
|
||||||
|
return (elem, index)
|
||||||
|
return None
|
||||||
|
|
||||||
for i in envvars:
|
for i in envvars:
|
||||||
if i in os.environ:
|
if i in os.environ:
|
||||||
path = os.environ[i]
|
path = os.environ[i]
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
raise Exception('Path for {0} was not found: {1}'.format(i, path))
|
raise Exception('Path for {0} was not found: {1}'.format(i, path))
|
||||||
|
elif i.startswith('HL2SDK'):
|
||||||
|
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
|
||||||
|
self.sdkInfo[sdk] = info
|
||||||
else:
|
else:
|
||||||
head = os.getcwd()
|
head = os.getcwd()
|
||||||
oldhead = None
|
oldhead = None
|
||||||
@ -66,10 +78,18 @@ class SM:
|
|||||||
break
|
break
|
||||||
oldhead = head
|
oldhead = head
|
||||||
head, tail = os.path.split(head)
|
head, tail = os.path.split(head)
|
||||||
if head == None or head == oldhead:
|
if i.startswith('HL2SDK'):
|
||||||
|
(info, sdk) = findDictByKey(self.possibleSdks, 'sdk', i)
|
||||||
|
self.sdkInfo[sdk] = info
|
||||||
|
elif head == None or head == oldhead:
|
||||||
raise Exception('Could not find a valid path for {0}'.format(i))
|
raise Exception('Could not find a valid path for {0}'.format(i))
|
||||||
AMBuild.cache.CacheVariable(i, path)
|
AMBuild.cache.CacheVariable(i, path)
|
||||||
|
|
||||||
|
if len(self.sdkInfo) < 1:
|
||||||
|
raise Exception('At least one SDK must be available.')
|
||||||
|
|
||||||
|
AMBuild.cache.CacheVariable('sdkInfo', self.sdkInfo)
|
||||||
|
|
||||||
#Set up defines
|
#Set up defines
|
||||||
cxx = self.compiler.cxx
|
cxx = self.compiler.cxx
|
||||||
if isinstance(cxx, Cpp.CompatGCC):
|
if isinstance(cxx, Cpp.CompatGCC):
|
||||||
@ -195,6 +215,7 @@ class SM:
|
|||||||
self.targetMap = { }
|
self.targetMap = { }
|
||||||
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
|
AMBuild.cache.CacheVariable('targetMap', self.targetMap)
|
||||||
else:
|
else:
|
||||||
|
self.sdkInfo = AMBuild.cache['sdkInfo']
|
||||||
self.compiler.FromConfig(AMBuild, 'compiler')
|
self.compiler.FromConfig(AMBuild, 'compiler')
|
||||||
self.targetMap = AMBuild.cache['targetMap']
|
self.targetMap = AMBuild.cache['targetMap']
|
||||||
|
|
||||||
@ -294,7 +315,7 @@ class SM:
|
|||||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
|
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms))
|
||||||
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
|
compiler['CXXINCLUDES'].append(os.path.join(self.mmsPath, mms, 'sourcehook'))
|
||||||
|
|
||||||
info = self.sdkInfo
|
info = self.possibleSdks
|
||||||
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
|
compiler['CDEFINES'].extend(['SE_' + info[i]['name'] + '=' + info[i]['def'] for i in info])
|
||||||
|
|
||||||
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
|
paths = [['public'], ['public', 'engine'], ['public', 'mathlib'], ['public', 'vstdlib'],
|
||||||
|
Loading…
Reference in New Issue
Block a user