Raised This Month: $32 Target: $400
 8% 

SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension files


Post New Thread Reply   
 
Thread Tools Display Modes
floube
SourceMod Donor
Join Date: Jan 2013
Location: Austria
Old 08-17-2014 , 18:40   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #11

Well, idk if this is still *alive*, but the sample extension compiles fine with Visual Studio 2010 (Debug - TF2), but as I try it with AMBuild (using your instructions) it outputs this and I could figure out why this happens.

Using Debian 7.4 and Python 2.7.3, the latest sourcemod (1.6.1), mmsource (1.10) and hl2sdk-tf2 from GitHub.

Code:
# python ../configure.py --sdks tf2
Checking CC compiler (vendor test gcc)... ['cc', 'test.c', '-o', 'test']
found gcc version 4.7
Checking CXX compiler (vendor test gcc)... ['c++', 'test.cpp', '-o', 'testp']
found gcc version 4.7
Traceback (most recent call last):
  File "../configure.py", line 24, in <module>
    run.Configure()
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/prep.py", line 121, in Configure
    if not builder.generate():
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 235, in generate
    self.parseBuildScripts()
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 165, in parseBuildScripts
    self.evalScript(root)
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 204, in evalScript
    exec(code, new_vars)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuildScript", line 447, in <module>
    'SM': SM
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 114, in RunBuildScripts
    self.generator.evalScript(script, vars)
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 204, in evalScript
    exec(code, new_vars)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuilder", line 7, in <module>
    binary = SM.HL2Library(builder, 'sample.ext.' + sdk.ext, sdk)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuildScript", line 393, in HL2Library
    binary = self.LibraryBuilder(compiler, name)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuildScript", line 263, in LibraryBuilder
    binary.compiler.sourcedeps += SM.generated_headers
TypeError: 'NoneType' object is not iterable
__________________

Last edited by floube; 08-17-2014 at 18:44.
floube is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 08-19-2014 , 16:55   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #12

Quote:
Originally Posted by floube View Post
Well, idk if this is still *alive*, but the sample extension compiles fine with Visual Studio 2010 (Debug - TF2), but as I try it with AMBuild (using your instructions) it outputs this and I could figure out why this happens.

Using Debian 7.4 and Python 2.7.3, the latest sourcemod (1.6.1), mmsource (1.10) and hl2sdk-tf2 from GitHub.

Code:
# python ../configure.py --sdks tf2
Checking CC compiler (vendor test gcc)... ['cc', 'test.c', '-o', 'test']
found gcc version 4.7
Checking CXX compiler (vendor test gcc)... ['c++', 'test.cpp', '-o', 'testp']
found gcc version 4.7
Traceback (most recent call last):
  File "../configure.py", line 24, in <module>
    run.Configure()
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/prep.py", line 121, in Configure
    if not builder.generate():
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 235, in generate
    self.parseBuildScripts()
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 165, in parseBuildScripts
    self.evalScript(root)
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 204, in evalScript
    exec(code, new_vars)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuildScript", line 447, in <module>
    'SM': SM
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 114, in RunBuildScripts
    self.generator.evalScript(script, vars)
  File "/usr/local/lib/python2.7/dist-packages/ambuild2/frontend/base_gen.py", line 204, in evalScript
    exec(code, new_vars)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuilder", line 7, in <module>
    binary = SM.HL2Library(builder, 'sample.ext.' + sdk.ext, sdk)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuildScript", line 393, in HL2Library
    binary = self.LibraryBuilder(compiler, name)
  File "/home/debian/Documents/host/Extensions/sourcemod-1.6/public/sourcemod-sampleext-sourcemod-1.6/AMBuildScript", line 263, in LibraryBuilder
    binary.compiler.sourcedeps += SM.generated_headers
TypeError: 'NoneType' object is not iterable
The AMBuild stuff basically needs a complete rewrite at this point. For that matter, the Makefile and VC++ projects could use some love too.

It's on my list of stuff to work on.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 08-19-2014 at 16:56.
Powerlord is offline
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
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-07-2015 , 19:07   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #14

Powerlord, does your sample-ext AMBuild stuff work well with --gen vs for people who wants AMBuild to gen VS Project Files.
__________________
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-07-2015 , 19:08   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #15

Quote:
Originally Posted by WildCard65 View Post
Powerlord, does your sample-ext AMBuild stuff work well with --gen vs for people who wants AMBuild to gen VS Project Files.
You mean the now-deprecated one in this thread or the one I wrote that got merged into SourceMod?

No for the former, yes to the latter.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 07-07-2015 , 19:47   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #16

Quote:
Originally Posted by Powerlord View Post
You mean the now-deprecated one in this thread or the one I wrote that got merged into SourceMod?

No for the former, yes to the latter.
Yes I meant the one merged into SM. And Awesome.
__________________
WildCard65 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-07-2015 , 19:52   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #17

Quote:
Originally Posted by WildCard65 View Post
Yes I meant the one merged into SM. And Awesome.
The SM one is a somewhat modified version of the AMBuild files used by SourceMod itself.

As I mentioned earlier, AMBuildScript probably doesn't need to be modified unless you're compiling multiple projects.

In fact, you should be able to replace the AMBuildScript with a newer version at any point, which is handy when new SDKs come out.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 09-09-2015 , 11:45   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #18

where can we find the new example project ? I can't seem to find it
ImACow is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-09-2015 , 13:00   Re: SourceMod Sample Extension Project: Updated SourceMod 1.5/1.6 sample extension fi
Reply With Quote #19

Quote:
Originally Posted by ImACow View Post
where can we find the new example project ? I can't seem to find it
It's in the SourceMod Github's master branch in the public/sample_ext directory.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode