Copying No Longer Needed

Copying the HL2SDK manifest is no longer needed.
Requires latest AMBuild.
This commit is contained in:
caxanga334 2024-07-31 15:00:29 -03:00
parent 399a90bcdc
commit 0b8b9ed72f
No known key found for this signature in database
GPG Key ID: A340D41A4ADCE85F
2 changed files with 10 additions and 15 deletions

View File

@ -1,5 +1,5 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, shutil
import os
def ResolveEnvPath(env, folder):
if env in os.environ:
@ -30,22 +30,17 @@ def SetArchFlags(compiler):
if compiler.target.arch == 'x86_64':
compiler.defines += ['WIN64']
hl2sdk_manifests_root = None
hl2sdk_manifests_dest = Normalize(builder.sourcePath + '/hl2sdk-manifests/')
hl2sdk_manifests_path = None
if not builder.options.hl2sdk_manifest:
if not os.path.exists(hl2sdk_manifests_dest): # if no root was specified and an hl2sdk-manifests folder does not exists in the source folder
raise Exception('HL2SDK Manifests directory not found! Set --hl2sdk-manifest-path or manually copy the hl2sdk manifests folder to the current source folder.')
raise Exception('HL2SDK Manifest root path not set! (--hl2sdk-manifest-path)')
else:
# The HL2SDK Manifest looks for the manifest file based on the current sourcePath, so we need to copy it to our sourcePath first
hl2sdk_manifests_root = Normalize(builder.options.hl2sdk_manifest + '/')
hl2sdk_manifests_path = os.path.join(builder.options.hl2sdk_manifest, 'SdkHelpers.ambuild')
if not os.path.exists(hl2sdk_manifests_dest):
shutil.copytree(hl2sdk_manifests_root, hl2sdk_manifests_dest)
else:
print('HL2SDK Manifests folder already exists, not copying.')
if not os.path.exists(hl2sdk_manifests_path):
raise Exception('Could not find SdkHelpers.ambuild in the given HL2SDK Manifest path!')
SdkHelpers = builder.Eval('hl2sdk-manifests/SdkHelpers.ambuild', {
SdkHelpers = builder.Eval(hl2sdk_manifests_path, {
'Project': 'sm-extension'
})

View File

@ -1,15 +1,15 @@
# 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'
extName = projectName + '.ext.'
# smsdk_ext.cpp will be automatically added later
sourceFiles = [
'extension.cpp',
]
project = builder.LibraryProject(extName)
project = builder.LibraryProject(projectName)
if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
# Use the copy included in the project
@ -29,6 +29,6 @@ for sdk_name in Extension.sdks:
if not cxx.target.arch in sdk['platforms'][cxx.target.platform]:
continue
binary = Extension.HL2ExtConfig(project, builder, cxx, extName + sdk['extension'], sdk)
binary = Extension.HL2ExtConfig(project, builder, cxx, projectName + '.ext.' + sdk['extension'], sdk)
Extension.extensions += builder.Add(project)