Difference between revisions of "Compiling SourceMod Plugins"

From AlliedModders Wiki
Jump to: navigation, search
(Brought it more up-to-date)
Line 1: Line 1:
Ok, so you've read the [[Introduction to SourcePawn]] and [[Introduction to SourceMod Plugins]] and now you want to actually compile a plugin.
+
Okay, so you've read the [[Introduction to SourcePawn]] and [[Introduction to SourceMod Plugins]] and now you want to actually compile a plugin.
  
You'll need the compiler which is included in the .../sourcemod/scripting/ folder of the [http://www.sourcemod.net/downloads.php main distribution] (not the [http://www.sourcemod.net/sdk.php SDK]). Windows users will need [http://www.7-zip.org/ 7-zip] to extract the .tar.gz files.
+
The simplest way to compile a plugin that doesn't rely on any custom include files is using the [http://www.sourcemod.net/compile.php web compiler].
 +
 
 +
Alternatively, you can use the executable compiler distributed with SourceMod. You can use this simply if you like compiling locally rather than using the web compiler. You have to use the local compiler if your plugin relies on custom include files. The compiler is included in the .../sourcemod/scripting/ folder of the [http://www.sourcemod.net/downloads.php SourceMod distribution].
  
 
In Windows, open up a command prompt (Start->Run or WindowsKey+R, then "cmd"):
 
In Windows, open up a command prompt (Start->Run or WindowsKey+R, then "cmd"):
Line 7: Line 9:
 
  spcomp myplugin.sp
 
  spcomp myplugin.sp
 
[http://www.computerhope.com/cdhlp.htm cd command reference]
 
[http://www.computerhope.com/cdhlp.htm cd command reference]
 +
 +
Alternatively, you can simply drag the .sp file on top of spcomp.exe, which will compile the plugin for you.
  
 
In Linux use:
 
In Linux use:

Revision as of 00:57, 5 February 2012

Okay, so you've read the Introduction to SourcePawn and Introduction to SourceMod Plugins and now you want to actually compile a plugin.

The simplest way to compile a plugin that doesn't rely on any custom include files is using the web compiler.

Alternatively, you can use the executable compiler distributed with SourceMod. You can use this simply if you like compiling locally rather than using the web compiler. You have to use the local compiler if your plugin relies on custom include files. The compiler is included in the .../sourcemod/scripting/ folder of the SourceMod distribution.

In Windows, open up a command prompt (Start->Run or WindowsKey+R, then "cmd"):

cd <sourcemod>\scripting
spcomp myplugin.sp

cd command reference

Alternatively, you can simply drag the .sp file on top of spcomp.exe, which will compile the plugin for you.

In Linux use:

./compile.sh myplugin.sp

Now simply move the .smx (not .sp) file from .../sourcemod/scripting/ to the .../sourcemod/plugins/ folder.

Note: When compiling preexisting plugins it is easiest to move the included from the plugin source folder to the include folder in your Sourcemod\scripting\include. Please see Spcomp_switches specifically the -i parameter for specifying a different folder for includes.

Reference Source

See Also: Scripting Forum