sourcemod/public/sample_ext/AMBuilder
caxanga334 600f493e69
Modernize Sample Extensions's AMBuildScript (#2107)
* Modernize Build Scripts

* Fix: Missing dot at extension file name.

Reported by @FortyTwoFortyTwo

* Clean Up: Removed unused variable

* Copying No Longer Needed

Copying the HL2SDK manifest is no longer needed.
Requires latest AMBuild.

* Allow Using Manifests From Project Folder

Check if the manifest already exists in the project folder. If not, then search in the path specified by --hl2sdk-manifest-path.

* Requested Changes by Kenzzer

* Fix Differences Between SDK/No SDK
2024-10-25 18:58:31 +02:00

35 lines
1006 B
Python

# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
# Name of your extesion, this will also be it's file name.
projectName = 'sample'
# smsdk_ext.cpp will be automatically added later
sourceFiles = [
'extension.cpp',
]
project = builder.LibraryProject(projectName)
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
# Use the copy included in the project
project.sources += [os.path.join('sdk', 'smsdk_ext.cpp')]
else:
# Use the copy included with SM 1.6 and newer
project.sources += [os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')]
project.sources += sourceFiles
for sdk_name in Extension.sdks:
sdk = Extension.sdks[sdk_name]
if sdk['name'] in ['mock']:
continue
for cxx in builder.targets:
if not cxx.target.arch in sdk['platforms'][cxx.target.platform]:
continue
binary = Extension.HL2ExtConfig(project, builder, cxx, projectName + '.ext.' + sdk['extension'], sdk)
Extension.extensions += builder.Add(project)