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: | run: |
mkdir build mkdir build
cd 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 ambuild
- name: Uploading package - 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 project = builder.LibraryProject('cleaner')
if typing.TYPE_CHECKING:
from ambuild2.frontend.v2_2.context import BuildContext
builder: BuildContext
projectName = 'cleaner'
project = build_info.HL2Project(builder, projectName + '.ext')
project.sources += [ project.sources += [
'extension.cpp', 'extension.cpp',
os.path.join(build_info.sm_root, 'public', 'smsdk_ext.cpp'), os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp'),
os.path.join(build_info.sm_root, 'public', 'CDetour', 'detours.cpp'), os.path.join(Extension.sm_root, 'public', 'CDetour', 'detours.cpp'),
os.path.join(build_info.sm_root, 'public', 'asm', 'asm.c'), os.path.join(Extension.sm_root, 'public', 'asm', 'asm.c'),
] ]
# sm1.10+ # 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): if os.path.isdir(libudis_folder):
project.sources += [ project.sources += [
os.path.join(libudis_folder, 'decode.c'), os.path.join(libudis_folder, 'decode.c'),
os.path.join(libudis_folder, 'itab.c'), os.path.join(libudis_folder, 'itab.c'),
os.path.join(libudis_folder, 'syn-att.c'), os.path.join(libudis_folder, 'syn-att.c'),
os.path.join(libudis_folder, 'syn-intel.c'), os.path.join(libudis_folder, 'syn-intel.c'),
os.path.join(libudis_folder, 'syn.c'), os.path.join(libudis_folder, 'syn.c'),
os.path.join(libudis_folder, 'udis86.c'), os.path.join(libudis_folder, 'udis86.c'),
] ]
for sdk in build_info.sdks.values(): for sdk_name in Extension.sdks:
build_info.HL2Config(project, projectName + '.ext.2.' + sdk.short_name, sdk) 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 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 # This is where the files will be output to
# package is the default # package is the default
# noinspection PyUnboundLocalVariable
builder.SetBuildFolder('package') builder.SetBuildFolder('package')
# Add any folders you need to this list # Add any folders you need to this list
@ -19,25 +12,31 @@ folder_list = [
'addons/sourcemod/configs', 'addons/sourcemod/configs',
] ]
if 'x86_64' in Extension.target_archs:
folder_list.extend([
'addons/sourcemod/extensions/x64',
])
# Create the distribution folder hierarchy # Create the distribution folder hierarchy
folder_map = {} folder_map = {}
for folder in folder_list: for folder in folder_list:
norm_folder = os.path.normpath(folder) norm_folder = os.path.normpath(folder)
folder_map[folder] = builder.AddFolder(norm_folder) folder_map[folder] = builder.AddFolder(norm_folder)
# Do all straight-up file copies from the source tree # Do all straight-up file copies from the source tree
def CopyFiles(src, dest, files): def CopyFiles(src, dest, files):
if not dest: if not dest:
dest = src dest = src
dest_entry = folder_map[dest] dest_entry = folder_map[dest]
for source_file in files: for source_file in files:
source_path = os.path.join(builder.sourcePath, src, source_file) source_path = os.path.join(builder.sourcePath, src, source_file)
builder.AddCopy(source_path, dest_entry) builder.AddCopy(source_path, dest_entry)
# Copy extension # 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']) builder.AddCopy(cxx_task.binary, folder_map['addons/sourcemod/extensions'])
CopyFiles('sourcemod/extensions', 'addons/sourcemod/extensions', ['cleaner.autoload']) 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 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, parser = run.BuildParser(sourcePath=sys.path[0], api='2.2')
help='Root search folder for HL2SDKs') parser.options.add_argument('--hl2sdk-root', type=str, dest='hl2sdk_root', default=None,
builder.options.add_option('--mms-path', type=str, dest='mms_path', default=None, help='Root search folder for HL2SDKs')
help='Path to Metamod:Source') parser.options.add_argument('--mms-path', type=str, dest='mms_path', default=None,
builder.options.add_option('--sm-path', type=str, dest='sm_path', default=None, help='Path to Metamod:Source')
help='Path to SourceMod') parser.options.add_argument('--sm-path', type=str, dest='sm_path', default=None,
builder.options.add_option('--enable-debug', action='store_const', const='1', dest='debug', help='Path to SourceMod')
help='Enable debugging symbols') parser.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug',
builder.options.add_option('--enable-optimize', action='store_const', const='1', dest='opt', help='Enable debugging symbols')
help='Enable optimization') parser.options.add_argument('--enable-optimize', action='store_const', const='1', dest='opt',
builder.options.add_option('-s', '--sdks', default='all', dest='sdks', help='Enable optimization')
help='Build against specified SDKs; valid args are "all", "present", or ' parser.options.add_argument('-s', '--sdks', default='present', dest='sdks',
'comma-delimited list of engine names (default: %default)') help='Build against specified SDKs; valid args are "none", "all", "present",'
' or comma-delimited list of engine names')
builder.Configure() parser.options.add_argument('--targets', type=str, dest='targets', default=None,
help="Override the target architecture (use commas to separate multiple targets).")
parser.Configure()