mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-20 13:54:14 +01:00
Add --target-arch support.
This commit is contained in:
parent
0eaf14f9ec
commit
1b91dc28ca
@ -12,14 +12,26 @@ class SDK(object):
|
||||
self.path = None # Actual path
|
||||
self.platformSpec = platform
|
||||
|
||||
# By default, nothing supports x64.
|
||||
if type(platform) is list:
|
||||
self.platformSpec = {p: ['x86'] for p in platform}
|
||||
else:
|
||||
self.platformSpec = platform
|
||||
|
||||
def shouldBuild(self, target):
|
||||
if target.platform not in self.platformSpec:
|
||||
return False
|
||||
if target.arch not in self.platformSpec[target.platform]:
|
||||
return False
|
||||
return True
|
||||
|
||||
WinOnly = ['windows']
|
||||
WinLinux = ['windows', 'linux']
|
||||
WinLinuxMac = ['windows', 'linux', 'mac']
|
||||
Source2 = {
|
||||
'windows': ['x86', 'x86_64'],
|
||||
'linux': ['x86_64'],
|
||||
}
|
||||
|
||||
PossibleSDKs = {
|
||||
'episode1': SDK('HL2SDK', '1.ep1', '1', 'EPISODEONE', WinLinux, 'episode1'),
|
||||
@ -37,7 +49,7 @@ PossibleSDKs = {
|
||||
'bgt': SDK('HL2SDK-BGT', '2.bgt', '4', 'BLOODYGOODTIME', WinOnly, 'bgt'),
|
||||
'eye': SDK('HL2SDK-EYE', '2.eye', '5', 'EYE', WinOnly, 'eye'),
|
||||
'csgo': SDK('HL2SDKCSGO', '2.csgo', '20', 'CSGO', WinLinuxMac, 'csgo'),
|
||||
'dota': SDK('HL2SDKDOTA', '2.dota', '21', 'DOTA', WinLinux, 'dota'),
|
||||
'dota': SDK('HL2SDKDOTA', '2.dota', '21', 'DOTA', Source2, 'dota'),
|
||||
'portal2': SDK('HL2SDKPORTAL2', '2.portal2', '17', 'PORTAL2', [], 'portal2'),
|
||||
'blade': SDK('HL2SDKBLADE', '2.blade', '18', 'BLADE', WinLinux, 'blade'),
|
||||
'insurgency': SDK('HL2SDKINSURGENCY', '2.insurgency', '19', 'INSURGENCY', WinLinuxMac, 'insurgency'),
|
||||
@ -111,11 +123,15 @@ class MMSConfig(object):
|
||||
self.sdks[sdk_name] = sdk
|
||||
|
||||
if len(self.sdks) < 1 and len(sdk_list):
|
||||
raise Exception('At least one SDK must be available.')
|
||||
raise Exception('No SDKs were found that build on {0}-{1}, nothing to do.'.format(
|
||||
builder.target.platform, builder.target.arch))
|
||||
|
||||
def configure(self):
|
||||
builder.AddConfigureFile('pushbuild.txt')
|
||||
|
||||
if builder.target.arch not in ['x86', 'x86_64']:
|
||||
raise Exception('Unknown target architecture: {0}'.format(builder.target.arch))
|
||||
|
||||
cxx = builder.DetectCxx()
|
||||
|
||||
if cxx.behavior == 'gcc':
|
||||
@ -136,13 +152,19 @@ class MMSConfig(object):
|
||||
'-Wno-unused',
|
||||
'-Wno-switch',
|
||||
'-msse',
|
||||
'-m32',
|
||||
]
|
||||
|
||||
if builder.target.arch == 'x86':
|
||||
cxx.cflags += ['-m32']
|
||||
cxx.linkflags += ['-m32']
|
||||
elif builder.target.arch == 'x86_64':
|
||||
cxx.cflags += ['-m64', '-fPIC']
|
||||
cxx.linkflags += ['-m64']
|
||||
|
||||
cxx.cxxflags += [ '-std=c++11' ]
|
||||
if (cxx.version >= 'gcc-4.0') or cxx.family == 'clang':
|
||||
cxx.cflags += ['-fvisibility=hidden']
|
||||
cxx.cxxflags += ['-fvisibility-inlines-hidden']
|
||||
cxx.linkflags += ['-m32']
|
||||
cxx.cxxflags += [
|
||||
'-fno-exceptions',
|
||||
'-fno-rtti',
|
||||
@ -287,11 +309,8 @@ class MMSConfig(object):
|
||||
compiler.defines += ['COMPILER_GCC']
|
||||
|
||||
if sdk.name == 'dota' and builder.target.platform in ['linux', 'mac']:
|
||||
compiler.defines += ['X64BITS', 'PLATFORM_64BITS']
|
||||
compiler.cflags.remove('-m32')
|
||||
compiler.cflags += ['-m64', '-fPIC']
|
||||
compiler.linkflags.remove('-m32')
|
||||
compiler.linkflags += ['-m64']
|
||||
if builder.target.arch == 'x86_64':
|
||||
compiler.defines += ['X64BITS', 'PLATFORM_64BITS']
|
||||
|
||||
if sdk.name in ['css', 'hl2dm', 'dods', 'sdk2013', 'bms', 'tf2', 'l4d', 'nucleardawn', 'l4d2', 'dota']:
|
||||
if builder.target.platform in ['linux', 'mac']:
|
||||
|
@ -12,8 +12,12 @@ except:
|
||||
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
|
||||
sys.exit(1)
|
||||
|
||||
def make_objdir_name(p):
|
||||
return 'obj-linux-' + p.target_arch
|
||||
|
||||
parser = run.BuildParser(sourcePath=sys.path[0], api='2.1')
|
||||
parser.default_build_folder = 'obj-' + parser.host.platform
|
||||
parser.default_arch = 'x86'
|
||||
parser.default_build_folder = make_objdir_name
|
||||
parser.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
|
||||
help='Root search folder for HL2SDKs')
|
||||
parser.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
|
||||
|
@ -13,15 +13,15 @@ def configure_library(name, linux_defines):
|
||||
|
||||
if builder.target.platform == 'linux':
|
||||
binary.compiler.defines += linux_defines
|
||||
# Temporary Source2 hack. Always build linux with -m64
|
||||
binary.compiler.cflags.remove('-m32')
|
||||
binary.compiler.cflags += ['-m64', '-fPIC']
|
||||
binary.compiler.linkflags.remove('-m32')
|
||||
binary.compiler.linkflags += ['-m64']
|
||||
|
||||
nodes = builder.Add(binary)
|
||||
MMS.binaries += [nodes]
|
||||
|
||||
configure_library('server', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])
|
||||
if builder.target.platform == 'linux':
|
||||
libname = 'server'
|
||||
if builder.target.platform == 'linux' and builder.target.arch == 'x86_64':
|
||||
libname = 'libserver'
|
||||
|
||||
configure_library(libname, ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])
|
||||
|
||||
if builder.target.platform == 'linux' and builder.target.arch == 'x86':
|
||||
configure_library('server_i486', ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"'])
|
||||
|
@ -7,12 +7,6 @@ lib.sources += [
|
||||
'versionlib.cpp'
|
||||
]
|
||||
|
||||
# Temporary Source2 hack. Always build linux with -m64
|
||||
if builder.target.platform == 'linux':
|
||||
lib.compiler.cflags.remove('-m32')
|
||||
lib.compiler.cflags += ['-m64', '-fPIC']
|
||||
|
||||
|
||||
cmd = builder.Add(lib)
|
||||
|
||||
rvalue = cmd.binary
|
||||
|
Loading…
x
Reference in New Issue
Block a user