Update ambuild scripts, added x64 build

This commit is contained in:
Accelerator 2024-05-06 07:52:43 +03:00
parent b296f9b488
commit 62ce9364e1
5 changed files with 627 additions and 513 deletions

View File

@ -152,7 +152,7 @@ jobs:
run: |
mkdir build
cd build
python ../configure.py --enable-optimize --sm-path="${{ github.workspace }}/sourcemod-${{ matrix.sm_version }}" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}"
python ../configure.py --enable-optimize --sm-path="${{ github.workspace }}/sourcemod-${{ matrix.sm_version }}" --mms-path="${{ github.workspace }}/metamod-${{ matrix.mm_version }}" --targets=x86,x86_64
ambuild
- name: Uploading package

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,33 @@
import os.path
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
import typing
if typing.TYPE_CHECKING:
from ambuild2.frontend.v2_2.context import BuildContext
builder: BuildContext
projectName = 'cleaner'
project = build_info.HL2Project(builder, projectName + '.ext')
project = builder.LibraryProject('cleaner')
project.sources += [
'extension.cpp',
os.path.join(build_info.sm_root, 'public', 'smsdk_ext.cpp'),
os.path.join(build_info.sm_root, 'public', 'CDetour', 'detours.cpp'),
os.path.join(build_info.sm_root, 'public', 'asm', 'asm.c'),
'extension.cpp',
os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp'),
os.path.join(Extension.sm_root, 'public', 'CDetour', 'detours.cpp'),
os.path.join(Extension.sm_root, 'public', 'asm', 'asm.c'),
]
# sm1.10+
libudis_folder = os.path.join(build_info.sm_root, 'public', 'libudis86')
libudis_folder = os.path.join(Extension.sm_root, 'public', 'libudis86')
if os.path.isdir(libudis_folder):
project.sources += [
os.path.join(libudis_folder, 'decode.c'),
os.path.join(libudis_folder, 'itab.c'),
os.path.join(libudis_folder, 'syn-att.c'),
os.path.join(libudis_folder, 'syn-intel.c'),
os.path.join(libudis_folder, 'syn.c'),
os.path.join(libudis_folder, 'udis86.c'),
]
project.sources += [
os.path.join(libudis_folder, 'decode.c'),
os.path.join(libudis_folder, 'itab.c'),
os.path.join(libudis_folder, 'syn-att.c'),
os.path.join(libudis_folder, 'syn-intel.c'),
os.path.join(libudis_folder, 'syn.c'),
os.path.join(libudis_folder, 'udis86.c'),
]
for sdk in build_info.sdks.values():
build_info.HL2Config(project, projectName + '.ext.2.' + sdk.short_name, sdk)
for sdk_name in Extension.sdks:
sdk = Extension.sdks[sdk_name]
build_info.extensions += builder.Add(project)
for cxx in builder.targets:
if not cxx.target.arch in sdk.platformSpec[cxx.target.platform]:
continue
binary = Extension.HL2ExtConfig(project, builder, cxx, 'cleaner.ext.' + sdk.ext, sdk)
Extension.extensions += builder.Add(project)

View File

@ -1,15 +1,8 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os.path
import typing
if typing.TYPE_CHECKING:
from ambuild2.frontend.v2_2.context import BuildContext
builder: BuildContext
# This is where the files will be output to
# package is the default
# noinspection PyUnboundLocalVariable
builder.SetBuildFolder('package')
# Add any folders you need to this list
@ -19,25 +12,31 @@ folder_list = [
'addons/sourcemod/configs',
]
if 'x86_64' in Extension.target_archs:
folder_list.extend([
'addons/sourcemod/extensions/x64',
])
# Create the distribution folder hierarchy
folder_map = {}
for folder in folder_list:
norm_folder = os.path.normpath(folder)
folder_map[folder] = builder.AddFolder(norm_folder)
norm_folder = os.path.normpath(folder)
folder_map[folder] = builder.AddFolder(norm_folder)
# Do all straight-up file copies from the source tree
def CopyFiles(src, dest, files):
if not dest:
dest = src
dest_entry = folder_map[dest]
for source_file in files:
source_path = os.path.join(builder.sourcePath, src, source_file)
builder.AddCopy(source_path, dest_entry)
if not dest:
dest = src
dest_entry = folder_map[dest]
for source_file in files:
source_path = os.path.join(builder.sourcePath, src, source_file)
builder.AddCopy(source_path, dest_entry)
# Copy extension
for cxx_task in build_info.extensions:
for cxx_task in Extension.extensions:
if cxx_task.target.arch == 'x86_64':
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions/x64'])
else:
builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions'])
CopyFiles('sourcemod/extensions', 'addons/sourcemod/extensions', ['cleaner.autoload'])

View File

@ -1,21 +1,37 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et:
# vim: set ts=2 sw=2 tw=99 noet:
import sys
from ambuild2 import run
try:
from ambuild2 import run, util
except:
try:
import ambuild
sys.stderr.write('It looks like you have AMBuild 1 installed, but this project uses AMBuild 2.\n')
sys.stderr.write('Upgrade to the latest version of AMBuild to continue.\n')
except:
sys.stderr.write('AMBuild must be installed to build this project.\n')
sys.stderr.write('http://www.alliedmods.net/ambuild\n')
sys.exit(1)
builder = run.PrepareBuild(sourcePath = sys.path[0])
# 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)
builder.options.add_option('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
help='Root search folder for HL2SDKs')
builder.options.add_option('--mms-path', type=str, dest='mms_path', default=None,
help='Path to Metamod:Source')
builder.options.add_option('--sm-path', type=str, dest='sm_path', default=None,
help='Path to SourceMod')
builder.options.add_option('--enable-debug', action='store_const', const='1', dest='debug',
help='Enable debugging symbols')
builder.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
builder.options.add_option('-s', '--sdks', default='all', dest='sdks',
help='Build against specified SDKs; valid args are "all", "present", or '
'comma-delimited list of engine names (default: %default)')
builder.Configure()
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_argument('--mms-path', type=str, dest='mms_path', default=None,
help='Path to Metamod:Source')
parser.options.add_argument('--sm-path', type=str, dest='sm_path', default=None,
help='Path to SourceMod')
parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
help='Enable debugging symbols')
parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
help='Enable optimization')
parser.options.add_argument('-s', '--sdks', default='present', dest='sdks',
help='Build against specified SDKs; valid args are "none", "all", "present",'
' or comma-delimited list of engine names')
parser.options.add_argument('--targets', type=str, dest='targets', default=None,
help="Override the target architecture (use commas to separate multiple targets).")
parser.Configure()