1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-11-28 10:24:20 +01:00

Upgrade to AMBuild 2.2.

This commit is contained in:
David Anderson 2020-08-19 13:34:12 -07:00
parent 3c5f0ca282
commit acea12f29b
10 changed files with 153 additions and 175 deletions

View File

@ -36,12 +36,6 @@ addons:
cache:
directories:
- ../mysql-5.0
env:
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
- MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
matrix:
fast_finish: true
@ -62,24 +56,6 @@ matrix:
packages: ['clang-3.8', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
env: ['MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"']
- os: linux
sudo: false
language: cpp
addons:
apt:
sources: ['llvm-toolchain-trusty-4.0']
packages: ['clang-4.0', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
env: ['MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"']
- os: linux
sudo: false
language: cpp
addons:
apt:
sources: ['llvm-toolchain-trusty-5.0']
packages: ['clang-5.0', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
env: ['MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"']
- os: linux
sudo: false
language: cpp
@ -89,15 +65,6 @@ matrix:
packages: ['g++-6', 'g++-6-multilib', 'lib32stdc++6', 'lib32z1-dev', 'libc6-dev-i386', 'linux-libc-dev', 'g++-multilib']
env: ['MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"']
allow_failures:
- env: MATRIX_EVAL="CC=clang-3.7 && CXX=clang++-3.7"
- env: MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
- env: MATRIX_EVAL="CC=gcc-4.8 && CXX=g++-4.8"
- env: MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
- env: MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
- env: MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
before_script:
- CHECKOUT_DIR=$PWD && cd .. && $CHECKOUT_DIR/support/checkout-deps.sh && cd $CHECKOUT_DIR
script:
@ -109,8 +76,10 @@ script:
- cd .. && mkdir build-sh-opt && cd build-sh-opt
- python ../configure.py --enable-optimize --enable-tests --sdks=
- ambuild
- ./core/sourcehook/test/test_sourcehook/test_sourcehook -v
- ./core/sourcehook/test/test_sourcehook/linux-x86/test_sourcehook -v
- ./core/sourcehook/test/test_sourcehook/linux-x86_64/test_sourcehook -v
- cd .. && mkdir build-sh-debug && cd build-sh-debug
- python ../configure.py --enable-debug --enable-tests --sdks=
- ambuild
- ./core/sourcehook/test/test_sourcehook/test_sourcehook -v
- ./core/sourcehook/test/test_sourcehook/linux-x86/test_sourcehook -v
- ./core/sourcehook/test/test_sourcehook/linux-x86_64/test_sourcehook -v

View File

@ -18,24 +18,24 @@ class SDK(object):
else:
self.platformSpec = platform
def shouldBuild(self, target, archs):
if target.platform not in self.platformSpec:
return False
if not len([i for i in self.platformSpec[target.platform] if i in archs]):
return False
return True
def shouldBuild(self, targets):
for cxx in targets:
if cxx.target.platform in self.platformSpec:
if cxx.target.arch in self.platformSpec[cxx.target.platform]:
return True
return False
WinOnly = ['windows']
WinLinux = ['windows', 'linux']
WinLinuxMac = ['windows', 'linux', 'mac']
CSGO = {
'windows': ['x86'],
'linux': ['x86', 'x64'],
'mac': ['x64']
'linux': ['x86', 'x86_64'],
'mac': ['x86_64']
}
Source2 = {
'windows': ['x86', 'x64'],
'linux': ['x64'],
'windows': ['x86', 'x86_64'],
'linux': ['x86_64'],
}
PossibleSDKs = {
@ -78,28 +78,6 @@ def ResolveEnvPath(env, folder):
oldhead = head
head, tail = os.path.split(head)
return None
def SetArchFlags(compiler, arch, platform):
if compiler.behavior == 'gcc':
if arch == 'x86':
compiler.cflags += ['-m32']
compiler.linkflags += ['-m32']
if platform == 'mac':
compiler.linkflags += ['-arch', 'i386']
elif arch == 'x64':
compiler.cflags += ['-m64', '-fPIC']
compiler.linkflags += ['-m64']
if platform == 'mac':
compiler.linkflags += ['-arch', 'x86_64']
elif compiler.like('msvc'):
if arch == 'x86':
compiler.linkflags += ['/MACHINE:X86']
elif arch == 'x64':
compiler.linkflags += ['/MACHINE:X64']
def AppendArchSuffix(binary, name, arch):
if arch == 'x64':
binary.localFolder = name + '.x64'
class MMSConfig(object):
def __init__(self):
@ -107,7 +85,30 @@ class MMSConfig(object):
self.binaries = []
self.generated_headers = None
self.versionlib = None
self.archs = builder.target.arch.replace('x86_64', 'x64').split(',')
self.all_targets = []
self.target_archs = set()
if builder.options.targets:
target_archs = builder.options.targets.split(',')
else:
target_archs = ['x86']
if builder.backend == 'amb2':
target_archs.append('x86_64')
for arch in target_archs:
try:
cxx = builder.DetectCxx(target_arch = arch)
self.target_archs.add(cxx.target.arch)
except Exception as e:
# Error if archs were manually overridden.
if builder.options.targets:
raise
print('Skipping target {}: {}'.format(arch, e))
continue
self.all_targets.append(cxx)
if not self.all_targets:
raise Exception('No suitable C/C++ compiler was found.')
def use_auto_versioning(self):
if builder.backend != 'amb2':
@ -135,9 +136,10 @@ class MMSConfig(object):
if sdk_list[0] == '':
sdk_list = []
not_found = []
for sdk_name in PossibleSDKs:
sdk = PossibleSDKs[sdk_name]
if sdk.shouldBuild(builder.target, self.archs):
if sdk.shouldBuild(self.all_targets):
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, sdk.folder)
else:
@ -145,26 +147,29 @@ class MMSConfig(object):
if sdk_path is None:
if use_all or sdk_name in sdk_list:
raise Exception('Could not find a valid path for {0}'.format(sdk.envvar))
not_found.append(sdk_name)
continue
if use_all or use_present or sdk_name in sdk_list:
sdk.path = sdk_path
self.sdks[sdk_name] = sdk
if len(self.sdks) < 1 and len(sdk_list):
raise Exception('No SDKs were found that build on {0}-{1}, nothing to do.'.format(
builder.target.platform, builder.target.arch))
raise Exception('No SDKs were found, nothing to build.')
if use_present:
for sdk in not_found:
print('Warning: hl2sdk-{} was not found, and will not be included in build.'.format(sdk))
def configure(self):
builder.AddConfigureFile('pushbuild.txt')
if not set(self.archs).issubset(['x86', 'x64']):
raise Exception('Unknown target architecture: {0}'.format(builder.target.arch))
for cxx in self.all_targets:
if cxx.target.arch not in ['x86', 'x86_64']:
raise Exception('Unknown target architecture: {0}'.format(arch))
cxx = builder.DetectCxx()
if cxx.like('msvc') and len(self.archs) > 1:
raise Exception('Building multiple archs with MSVC is not currently supported')
self.configure_cxx(cxx)
def configure_cxx(self, cxx):
if cxx.behavior == 'gcc':
cxx.defines += [
'stricmp=strcasecmp',
@ -183,6 +188,7 @@ class MMSConfig(object):
'-Wno-unused',
'-Wno-switch',
'-msse',
'-fPIC',
]
cxx.cxxflags += [ '-std=c++11' ]
@ -267,13 +273,13 @@ class MMSConfig(object):
cxx.cflags += ['/Oy-']
# Platform-specifics
if builder.target.platform == 'linux':
if cxx.target.platform == 'linux':
cxx.defines += ['_LINUX', 'POSIX', '_FILE_OFFSET_BITS=64']
if cxx.family == 'gcc':
cxx.linkflags += ['-static-libgcc']
elif cxx.family == 'clang':
cxx.linkflags += ['-lgcc_eh']
elif builder.target.platform == 'mac':
elif cxx.target.platform == 'mac':
cxx.defines += ['OSX', '_OSX', 'POSIX']
if cxx.version >= 'apple-clang-10.0':
@ -290,7 +296,7 @@ class MMSConfig(object):
cxx.linkflags += [
'-lc++',
]
elif builder.target.platform == 'windows':
elif cxx.target.platform == 'windows':
cxx.defines += ['WIN32', '_WINDOWS']
# Finish up.
@ -305,8 +311,8 @@ class MMSConfig(object):
os.path.join(builder.sourcePath, 'versionlib'),
]
def HL2Compiler(self, context, sdk, arch):
compiler = context.cxx.clone()
def HL2Compiler(self, context, cxx, sdk):
compiler = cxx.clone()
compiler.cxxincludes += [
os.path.join(context.currentSourcePath),
os.path.join(context.currentSourcePath, 'sourcehook'),
@ -339,9 +345,9 @@ class MMSConfig(object):
if compiler.family == 'msvc':
compiler.defines += ['COMPILER_MSVC']
if arch == 'x86':
if compiler.target.arch == 'x86':
compiler.defines += ['COMPILER_MSVC32']
elif arch == 'x64':
elif compiler.target.arch == 'x86_64':
compiler.defines += ['COMPILER_MSVC64']
if compiler.version >= 1900:
@ -349,14 +355,14 @@ class MMSConfig(object):
else:
compiler.defines += ['COMPILER_GCC']
if arch == 'x64':
if compiler.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']:
if compiler.target.platform in ['linux', 'mac']:
compiler.defines += ['NO_HOOK_MALLOC', 'NO_MALLOC_OVERRIDE']
if sdk.name in ['csgo', 'blade'] and builder.target.platform == 'linux':
if sdk.name in ['csgo', 'blade'] and compiler.target.platform == 'linux':
compiler.linkflags += ['-lstdc++']
@ -365,35 +371,35 @@ class MMSConfig(object):
return compiler
def AddVersioning(self, binary, arch):
if builder.target.platform == 'windows':
def AddVersioning(self, binary):
if binary.compiler.target.platform == 'windows':
binary.sources += ['version.rc']
binary.compiler.rcdefines += [
'BINARY_NAME="{0}"'.format(binary.outputFile),
'RC_COMPILE'
]
elif builder.target.platform == 'mac' and binary.type == 'library':
elif binary.compiler.target.platform == 'mac' and binary.type == 'library':
binary.compiler.postlink += [
'-compatibility_version', '1.0.0',
'-current_version', self.productVersion
]
if self.use_auto_versioning():
binary.compiler.linkflags += [self.versionlib[arch]]
binary.compiler.linkflags += [self.versionlib[binary.compiler.target.arch]]
binary.compiler.sourcedeps += MMS.generated_headers
if builder.options.breakpad_dump:
binary.compiler.symbol_files = 'separate'
return binary
def LibraryBuilder(self, compiler, name, arch):
binary = compiler.Library(name)
AppendArchSuffix(binary, name, arch)
self.AddVersioning(binary, arch)
def Library(self, cxx, name):
binary = cxx.Library(name)
self.AddVersioning(binary)
return binary
def ProgramBuilder(self, compiler, name, arch):
def Program(self, compiler, name):
binary = compiler.Program(name)
AppendArchSuffix(binary, name, arch)
self.AddVersioning(binary, arch)
compiler = binary.compiler
self.AddVersioning(binary)
if '-static-libgcc' in binary.compiler.linkflags:
binary.compiler.linkflags.remove('-static-libgcc')
if '-lgcc_eh' in binary.compiler.linkflags:
@ -402,56 +408,37 @@ class MMSConfig(object):
binary.compiler.linkflags += ['-lstdc++']
return binary
def StaticLibraryBuilder(self, compiler, name, arch):
binary = compiler.StaticLibrary(name)
AppendArchSuffix(binary, name, arch)
return binary;
def StaticLibrary(self, cxx, name):
return cxx.StaticLibrary(name)
def Library(self, context, name, arch):
compiler = context.cxx.clone()
SetArchFlags(compiler, arch, builder.target.platform)
return self.LibraryBuilder(compiler, name, arch)
def Program(self, context, name, arch):
compiler = context.cxx.clone()
SetArchFlags(compiler, arch, builder.target.platform)
return self.ProgramBuilder(compiler, name, arch)
def HL2Library(self, context, compiler, name, sdk):
compiler = self.HL2Compiler(context, compiler, sdk)
def StaticLibrary(self, context, name, arch):
compiler = context.cxx.clone()
SetArchFlags(compiler, arch, builder.target.platform)
return self.StaticLibraryBuilder(compiler, name, arch)
def HL2Library(self, context, name, sdk, arch):
compiler = self.HL2Compiler(context, sdk, arch)
SetArchFlags(compiler, arch, builder.target.platform)
if builder.target.platform == 'linux':
if compiler.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':
elif compiler.target.arch == 'x86_64':
lib_folder = os.path.join(sdk.path, 'lib', 'linux64')
else:
lib_folder = os.path.join(sdk.path, 'lib', 'linux')
elif builder.target.platform == 'mac':
elif compiler.target.platform == 'mac':
if sdk.name in ['sdk2013', 'bms']:
lib_folder = os.path.join(sdk.path, 'lib', 'public', 'osx32')
elif arch == 'x64':
elif arch == 'x86_64':
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']:
if sdk.name in ['sdk2013', 'bms'] or arch == 'x64':
if compiler.target.platform in ['linux', 'mac']:
if sdk.name in ['sdk2013', 'bms'] or compiler.target.arch == 'x86_64':
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'tier1.a'))]
else:
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'tier1_i486.a'))]
if sdk.name in ['blade', 'insurgency', 'doi', 'csgo', 'dota']:
if arch == 'x64':
if compiler.target.arch == 'x86_64':
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces.a'))]
else:
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'interfaces_i486.a'))]
@ -459,32 +446,33 @@ class MMSConfig(object):
if sdk.name == 'bms':
compiler.postlink += [compiler.Dep(os.path.join(lib_folder, 'mathlib.a'))]
binary = self.LibraryBuilder(compiler, name, arch)
binary = self.Library(compiler, name)
compiler = binary.compiler
dynamic_libs = []
if builder.target.platform == 'linux':
if compiler.target.platform == 'linux':
compiler.linkflags[0:0] = ['-lm']
if sdk.name in ['css', 'hl2dm', 'dods', 'tf2', 'sdk2013', 'bms', 'nucleardawn', 'l4d2', 'insurgency', 'doi']:
dynamic_libs = ['libtier0_srv.so', 'libvstdlib_srv.so']
elif arch == 'x64' and sdk.name in ['csgo', 'blade']:
elif compiler.target.arch == 'x86_64' and sdk.name in ['csgo', 'blade']:
dynamic_libs = ['libtier0_client.so', 'libvstdlib_client.so']
elif sdk.name in ['l4d', 'blade', 'insurgency', 'doi', 'csgo', 'dota']:
dynamic_libs = ['libtier0.so', 'libvstdlib.so']
else:
dynamic_libs = ['tier0_i486.so', 'vstdlib_i486.so']
elif builder.target.platform == 'mac':
elif compiler.target.platform == 'mac':
binary.compiler.linkflags.append('-liconv')
dynamic_libs = ['libtier0.dylib', 'libvstdlib.dylib']
elif builder.target.platform == 'windows':
elif compiler.target.platform == 'windows':
libs = ['tier0', 'tier1', 'vstdlib']
if sdk.name in ['swarm', 'blade', 'insurgency', 'doi', 'csgo', 'dota']:
libs.append('interfaces')
if sdk.name == 'bms':
libs.append('mathlib')
for lib in libs:
if arch == 'x86':
if compiler.target.arch == 'x86':
lib_path = os.path.join(sdk.path, 'lib', 'public', lib) + '.lib'
elif arch == 'x64':
elif compiler.target.arch == 'x86_64':
lib_path = os.path.join(sdk.path, 'lib', 'public', 'win64', lib) + '.lib'
binary.compiler.linkflags.append(binary.Dep(lib_path))
@ -503,6 +491,12 @@ class MMSConfig(object):
return binary
if getattr(builder, 'target', None) is not None:
sys.stderr.write("Your output folder was configured for AMBuild 2.1, and Metamod:Source\n")
sys.stderr.write("is now configured to use AMBuild 2.2. Please remove your output folder\n")
sys.stderr.write("and reconfigure to continue.\n")
os._exit(1)
MMS = MMSConfig()
MMS.detectProductVersion()
MMS.detectSDKs()

View File

@ -12,23 +12,26 @@ except:
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
sys.exit(1)
def make_objdir_name(p):
return 'obj-' + util.Platform() + '-' + p.target_arch
# Hack to show a decent upgrade message, which wasn't done until 2.2.
ambuild_version = getattr(run, 'CURRENT_API', '2.1')
if ambuild_version.startswith('2.1'):
sys.stderr.write("AMBuild 2.2 or higher is required; please update\n")
sys.exit(1)
parser = run.BuildParser(sourcePath=sys.path[0], api='2.1')
parser.default_arch = 'x86'
parser.default_build_folder = make_objdir_name
parser.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
parser = run.BuildParser(sourcePath=sys.path[0], api='2.2')
parser.options.add_argument('--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',
parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
help='Enable debugging symbols')
parser.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
parser.options.add_option('-s', '--sdks', default='all', dest='sdks',
parser.options.add_argument('-s', '--sdks', default='present', dest='sdks',
help='Build against specified SDKs; valid args are "all", "present", or '
'comma-delimited list of engine names (default: %default)')
parser.options.add_option('--enable-tests', default=False, dest='enable_tests', action='store_true',
'comma-delimited list of engine names')
parser.options.add_argument('--enable-tests', default=False, dest='enable_tests', action='store_true',
help='Build tests.')
parser.options.add_option('--breakpad-dump', action='store_true', dest='breakpad_dump',
parser.options.add_argument('--breakpad-dump', action='store_true', dest='breakpad_dump',
default=False, help='Dump and upload breakpad symbols')
parser.options.add_argument('--targets', type=str, dest='targets', default=None,
help="Override the target architecture (use commas to separate multiple targets).")
parser.Configure()

View File

@ -2,14 +2,14 @@
import os
for sdk_name in MMS.sdks:
for arch in MMS.archs:
for cxx in MMS.all_targets:
sdk = MMS.sdks[sdk_name]
if not arch in sdk.platformSpec[builder.target.platform]:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
name = 'metamod.' + sdk.ext
binary = MMS.HL2Library(builder, name, sdk, arch)
binary = MMS.HL2Library(builder, cxx, name, sdk)
binary.sources += [
'metamod.cpp',
@ -29,7 +29,7 @@ for sdk_name in MMS.sdks:
]
# Source2 hack. TODO: check this more deterministically, "are we doing an x64 build?"
if arch == 'x86':
if binary.compiler.target.arch == 'x86':
binary.sources += ['sourcehook/sourcehook_hookmangen.cpp']
nodes = builder.Add(binary)
MMS.binaries += [nodes]

View File

@ -1,9 +1,9 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
for arch in MMS.archs:
for cxx in MMS.all_targets:
name = 'test_sourcehook'
binary = MMS.Program(builder, name, arch)
binary = MMS.Program(cxx, name)
binary.compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'core', 'sourcehook'),
]
@ -36,7 +36,7 @@ for arch in MMS.archs:
'testrefret.cpp',
'testvphooks.cpp',
]
if arch == 'x86':
if binary.compiler.target.arch == 'x86':
binary.sources += ['../sourcehook_hookmangen.cpp']
builder.Add(binary)

View File

@ -1,9 +1,9 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os.path
def configure_library(name, linux_defines, arch):
def configure_library(cxx, name, linux_defines):
libname = name
binary = MMS.Library(builder, libname, arch)
binary = MMS.Library(cxx, libname)
binary.compiler.cxxincludes += [os.path.join(builder.sourcePath, 'core', 'sourcehook')]
binary.sources += [
'loader.cpp',
@ -12,17 +12,17 @@ def configure_library(name, linux_defines, arch):
'utility.cpp',
]
if builder.target.platform == 'linux':
if binary.compiler.target.platform == 'linux':
binary.compiler.defines += linux_defines
nodes = builder.Add(binary)
MMS.binaries += [nodes]
for arch in MMS.archs:
if builder.target.platform == 'linux':
if arch == 'x64':
configure_library('libserver', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'], arch)
elif arch == 'x86':
configure_library('server_i486', ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"'], arch)
for cxx in MMS.all_targets:
if cxx.target.platform == 'linux':
if cxx.target.arch == 'x64':
configure_library(cxx, 'libserver', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])
elif cxx.target.arch == 'x86':
configure_library(cxx, 'server_i486', ['LIB_PREFIX=""', 'LIB_SUFFIX="_i486.so"'])
configure_library('server', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'], arch)
configure_library(cxx, 'server', ['LIB_PREFIX="lib"', 'LIB_SUFFIX=".so"'])

View File

@ -7,17 +7,17 @@ addons_folder = builder.AddFolder('addons')
metamod_folder = builder.AddFolder(os.path.join('addons', 'metamod'))
bin_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin'))
for arch in MMS.archs:
if arch == 'x64':
if builder.target.platform == 'windows':
for cxx in MMS.all_targets:
if cxx.target.arch == 'x86_64':
if cxx.target.platform == 'windows':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'win64'))
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_win64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
elif builder.target.platform == 'linux':
elif cxx.target.platform == 'linux':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'linux64'))
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_linux64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
elif builder.target.platform == 'mac':
elif cxx.target.platform == 'mac':
bin64_folder = builder.AddFolder(os.path.join('addons', 'metamod', 'bin', 'osx64'))
builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'metamod_osx64.vdf'),
os.path.join('addons', 'metamod_x64.vdf'))
@ -28,7 +28,7 @@ builder.AddCopy(os.path.join(builder.sourcePath, 'support', 'README.txt'), metam
pdb_list = []
for task in MMS.binaries:
if '.x64' + os.sep in task.binary.path:
if task.target.arch == 'x86_64':
builder.AddCopy(task.binary, bin64_folder)
else:
builder.AddCopy(task.binary, bin_folder)

View File

@ -19,6 +19,17 @@ our ($root) = getcwd();
my $reconf = 0;
my $trigger_file = 'support/buildbot/trigger_full_rebuild';
if (-f $trigger_file) {
my $trigger_mtime = (stat $trigger_file)[9];
if (-f 'OUTPUT/.ambuild2/graph') {
my $graph_mtime = (stat 'OUTPUT/.ambuild2/graph')[9];
if ($trigger_mtime > $graph_mtime) {
print "Trigger time $trigger_mtime > $graph_mtime, cleaning objdir...\n";
rmtree('OUTPUT');
}
}
}
if (!(-f 'OUTPUT/.ambuild2/graph') || !(-f 'OUTPUT/.ambuild2/vars')) {
rmtree('OUTPUT');
mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
@ -49,6 +60,7 @@ if ($^O !~ /MSWin/) {
} else {
push(@conf_argv, '--target-arch=x86');
}
push(@conf_argv, '--sdks=all');
my $conf_args = join(' ', @conf_argv);
@ -56,7 +68,7 @@ if ($argn > 0 && $^O !~ /MSWin/) {
$result = `CC=$ARGV[0] CXX=$ARGV[0] python ../build/configure.py $conf_args`;
} else {
if ($^O =~ /MSWin/) {
$result = `C:\\Python27\\Python.exe ..\\build\\configure.py $conf_args`;
$result = `C:\\Python38\\Python.exe ..\\build\\configure.py $conf_args`;
} else {
$result = `CC=clang CXX=clang python ../build/configure.py $conf_args`;
}

View File

@ -0,0 +1 @@
Aug 19, 2020

View File

@ -1,9 +1,9 @@
# vim: sts=2 ts=8 sw=2 tw=99 et ft=python:
rvalue = {}
for arch in MMS.archs:
for cxx in MMS.all_targets:
libname = 'version'
lib = MMS.StaticLibrary(builder, libname, arch)
lib = MMS.StaticLibrary(cxx, libname)
lib.compiler.defines.remove('MMS_USE_VERSIONLIB')
lib.compiler.sourcedeps += MMS.generated_headers
lib.sources += [
@ -12,5 +12,4 @@ for arch in MMS.archs:
cmd = builder.Add(lib)
rvalue[arch] = cmd.binary
rvalue[cxx.target.arch] = cmd.binary