Skip to content

Commit

Permalink
Improve s2_sample_mm build script
Browse files Browse the repository at this point in the history
Now it's possible to use run-time variables to compute the target paths/defines for includes/libs/defines
  • Loading branch information
GAMMACASE authored and psychonic committed Dec 21, 2023
1 parent bc36e07 commit 6b8ae69
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions samples/s2_sample_mm/AMBuildScript
@@ -1,19 +1,26 @@
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os, sys

additional_libs = [
# Path should be relative either to hl2sdk folder or to build folder
#'path/to/lib/example.lib',
]

additional_defines = [
#'EXAMPLE_DEFINE=2'
]

additional_includes = [
# Path should be absolute only!
#'D:/absolute/path/to/include/folder/'
]
# Edit the functions below for the extra functionality, the return should be
# a list of path's to wanted locations
def additional_libs(context, binary, sdk):
return [
# Path should be relative either to hl2sdk folder or to build folder
# 'path/to/lib/example.lib',
]

def additional_defines(context, binary, sdk):
return [
# 'EXAMPLE_DEFINE=2'
]

def additional_includes(context, binary, sdk):
return [
# Path should be absolute only!
# os.path.join(sdk['path'], 'game', 'server'),
# os.path.join(sdk['path'], 'public', 'entity2'),
# 'D:/absolute/path/to/include/folder/'
]

def ResolveEnvPath(env, folder):
if env in os.environ:
Expand Down Expand Up @@ -286,9 +293,9 @@ class MMSPluginConfig(object):

SdkHelpers.configureCxx(context, binary, sdk)

cxx.linkflags += additional_libs
cxx.defines += additional_defines
cxx.cxxincludes += additional_includes
cxx.linkflags += additional_libs(context, binary, sdk)
cxx.defines += additional_defines(context, binary, sdk)
cxx.cxxincludes += additional_includes(context, binary, sdk)

return binary

Expand Down

0 comments on commit 6b8ae69

Please sign in to comment.