accelerator/extension/AMBuilder
caxanga334 87704dc53b
Some checks failed
Release / main-ci (push) Has been cancelled
Release / release (push) Has been cancelled
[Feature]: Add on crash uploaded SourceMod forward (#42)
* Squashed commit of the following:

commit c7efce2d6722b08e2ea719ce1a39f80747502f77
Author: caxanga334 <10157643+caxanga334@users.noreply.github.com>
Date:   Sat Nov 22 22:35:24 2025 -0300

    Fix Error

commit e8acf9f505aa26b007c5837d4075f649099f43c3
Author: caxanga334 <10157643+caxanga334@users.noreply.github.com>
Date:   Sat Nov 22 22:23:57 2025 -0300

    Fix Possible Memory Leak

commit 51e718922726c074c0e7a45f9d13c6a51e4b97eb
Author: caxanga334 <10157643+caxanga334@users.noreply.github.com>
Date:   Sat Nov 22 22:13:55 2025 -0300

    Add Upload Forward

* Update accelerator.inc

* Fix: Missing forwards.cpp in AMBuilder

* Refactor API

Forward notifies plugins when the extension is done uploading.
Plugins can fetch data from uploaded crashes via natives.
Added example plugin.

* Implement Requested Changes

* Fix Error

* Update Example Plugin

Removed timer example.
Added example of how to handle plugin late loads.
2025-12-02 16:32:12 -05:00

60 lines
1.8 KiB
Python

# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os, sys
builder.SetBuildFolder('/')
project = builder.LibraryProject('accelerator.ext')
project.sources = [
'extension.cpp',
'MemoryDownloader.cpp',
'forwards.cpp',
'natives.cpp',
os.path.join(Accelerator.sm_root, 'public', 'smsdk_ext.cpp')
]
def AddSourceFilesFromDir(path, files):
list = []
for file in files:
list.append(os.path.join(path, file))
return list
for cxx in Accelerator.targets:
binary = Accelerator.ConfigureExtension(project, cxx, builder)
compiler = binary.compiler
# Wait for breakpad to be patched
compiler.sourcedeps += Accelerator.breakpad_patch
# We depend on breakpad on config
compiler.sourcedeps += Accelerator.breakpad_config[compiler.target.arch]
compiler.defines += ['HAVE_CONFIG_H']
compiler.cxxincludes += [
os.path.join(builder.sourcePath, 'third_party', 'breakpad', 'src'),
os.path.join(builder.buildPath, 'third_party', 'config', compiler.target.arch),
]
if compiler.target.platform in ['linux']:
binary.sources += AddSourceFilesFromDir(os.path.join(builder.currentSourcePath, '..', 'third_party', 'breakpad', 'src', 'common'), [
'dwarf_cfi_to_module.cc',
'dwarf_cu_to_module.cc',
'dwarf_line_to_module.cc',
'dwarf_range_list_handler.cc',
'language.cc',
'module.cc',
'path_helper.cc',
'stabs_reader.cc',
'stabs_to_module.cc',
'dwarf/bytereader.cc',
'dwarf/dwarf2diehandler.cc',
'dwarf/dwarf2reader.cc',
'dwarf/elf_reader.cc',
'linux/crc32.cc',
'linux/dump_symbols.cc',
'linux/elf_symbols_to_module.cc',
'linux/breakpad_getcontext.S'
])
Accelerator.link_libbreakpad_client(compiler, builder)
Accelerator.link_libbreakpad(compiler, builder)
Accelerator.link_libdisasm(compiler, builder)
Accelerator.extension = builder.Add(project)