View Single Post
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-07-2015 , 15:43   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #13

This is now obsolete. Instead, use AlliedModders AMBuild system.

SourceMod 1.8's sample_ext project now include AMBuildScript, configure.py, AMBuilder, and PackageScript files to compile an extension. The AMBuildScript you may not even have to edit as the project-specific logic is in AMBuilder and PackageScript.

Note: The sample is for building SDK-specific binaries. This is generally the "safer" way of doing things as you will get appropriate game-specific versions of functions.

The basic way of setting up your project for AMBuild:
  1. Modify AMBuilder.
    • Set the name of what the extension will be. This will be part of the extension's filename.
    • Set the project's .cpp files in the sourceFiles array. It will look something like this:

      Code:
      sourceFiles = [
        'extension.cpp',
        'anotherfile.cpp',
      ]
  2. Modify PackageScript
    • Modify the folder_list. This is the list of folders that need to be created. By default, this is just the extensions directory. The example has several other common folders in it.
    • Modify the CopyFiles sections. This needs to be done for every directory except extensions (which is handled automatically). There are several commented CopyFile sections for common directories, such as 'include'.

To actually compile the extension:
  • Install AMBuild. You only need to do this once.
  • Make a build directory.
  • Change to that directory, then run python ..\configure.py or python ../configure.py.
    • To see what options are available, you can use the -h argument.
    • If you don't want to build versions for all SDKs, you can use -s or --sdks to specify which ones you want to use, or the present argument to use all SDKs it can find.
    • SDKs are usually looked up by environment variables, but you can instead used --hl2sdk-root to tell it where to look.
  • Run ambuild
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 07-07-2015 at 16:07.
Powerlord is offline