Difference between revisions of "Building SourceMod"

From AlliedModders Wiki
Jump to: navigation, search
m
m
Line 29: Line 29:
 
*Microsoft Visual C++ 2010 (Express or higher) is supported and used for official builds.
 
*Microsoft Visual C++ 2010 (Express or higher) is supported and used for official builds.
  
Grab the necessary SourceMod Windows dependencies by running <tt>tools\buildbot\checkout-windows-deps.bat</tt>. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:
+
Grab the necessary Windows dependencies by running <tt>tools\buildbot\checkout-windows-deps.bat</tt>. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:
 
<pre>
 
<pre>
 
C:\Users\dvander> sourcemod-central\tools\buildbot-checkout-windows-deps.bat
 
C:\Users\dvander> sourcemod-central\tools\buildbot-checkout-windows-deps.bat
Line 46: Line 46:
 
</pre>
 
</pre>
  
Grab the remaining necessary SourceMod Linux dependencies by running <tt>tools/buildbot/checkout-linux-deps.sh</tt>. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:
+
Grab the remaining necessary Linux dependencies by running <tt>tools/buildbot/checkout-linux-deps.sh</tt>. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:
 
<pre>
 
<pre>
 
$ bash ./sourcemod-central/tools/buildbot-checkout-linux-deps.sh
 
$ bash ./sourcemod-central/tools/buildbot-checkout-linux-deps.sh
 
</pre>
 
</pre>
  
==OS X==
+
==Mac OS X==
  
 
+
Grab the remaining necessary OS X dependencies by running <tt>tools/buildbot/checkout-linux-deps.sh</tt>. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:
 
 
==CPU==
 
SourceMod is strictly a 32-bit x86 (IA32) product.  You should not try to force a compiler to build 64-bit binaries of SourceMod.
 
 
 
Your CPU and its compiler must support SSE in order to build SourceMod.  To build without needing or having a dependency against SSE, please see the [[Compiling SourceMod#Removing SSE|Removing SSE]] section near the bottom.
 
 
 
Approximate compiling times for SourceMod's Core are roughly in September 2008:
 
*Windows, Core 2 Quad E6600: 30 seconds (using /MP)
 
*Windows, Core 2 Duo E6600: 75 seconds
 
*Windows, Centrino 1.8GHz: 5 minutes
 
*Linux, Core 2 Duo E6600: <= 1 minute
 
*Linux, P3 Dual 500MHz: >= 7 minutes
 
 
 
=Setup=
 
This section describes how to set up your computer for compiling.
 
 
 
==Getting the Files==
 
This section describes which files you must obtain and how to obtain them.  Do not worry about where to place them yet -- that will be discussed on a per-platform basis.  You can download the files anywhere you'd like.
 
 
 
The recommended method of getting the required files is via [http://mercurial.selenic.com/ Mercurial].  We have our own [[Mercurial_Tutorial]] if you prefer that method.  Although you do not need all HL2SDK versions (unless you wish to build binaries against all of them), you do need Metamod:Source.  Extensions don't necessarily require Metamod:Source (or even the Source Engine) but its template library is used extensively in SourceMod.
 
 
 
*SourceMod. For full download options, see the [http://www.sourcemod.net/downloads.php SourceMod Downloads] page.  Obviously, you must download the source code and not a binary package.
 
*Download the appropriate [http://hg.alliedmods.net/hl2sdks/ Source SDK] for the game you want to compile for or download it from the list below:
 
**HL2SDK Original/Episode 1.  As of this writing (Dec 2012) this engine is only used by Half-Life: Source Deathmatch ('''not''' HL2:DM) and third-party mods. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk hl2sdk]
 
**HL2SDK OrangeBox.  As of this writing (Dec 2012) this engine is only used by third-party mods. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-ob hl2sdk-ob]
 
**HL2DSK OrangeBox Valve.  As of this writing (Dec 2012) this engine is used for Source 2009 games (HL2:DM, DoD:S, and TF2). Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-ob-valve hl2sdk-ob-valve]
 
**HL2SDK Alien Swarm. This engine is used for Alien Swarm. As of this writing (Dec 2012), this is only supported on SourceMod for Windows. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-swarm hl2sdk-swarm]
 
**HL2SDK BGT. This engine is used for Bloody Good Time. As of this writing (Dec 2012), this is only supported on SourceMod for Windows. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-bgt hl2sdk-bgt]
 
**HL2SDK CS:GO. This engine is used for CS:GO. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-csgo hl2sdk-csgo]
 
**HL2SDK CS:S. This engine is used for CS:S. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-css hl2sdk-css]
 
**HL2SDK DarkM. This engine is used for Dark Messiah. As of this writing (Dec 2012), this is only supported on SourceMod for Windows. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-darkm hl2sdk-darkm]
 
**HL2SDK EYE. This engine is used for E.Y.E. Divine Cybermancy. As of this writing (Dec 2012), this is only supported on SourceMod for Windows. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-eye hl2sdk-eye]
 
**HL2SDK Gmod12. This engine is used for GMod12. As of this writing (Dec 2012), SourceMod does not support GMod13. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-gmod hl2sdk-gmod]
 
**HL2SDK Left4Dead. This engine is used for L4D. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-l4d hl2sdk-l4d]
 
**HL2SDK Left4Dead2. This engine is used for L4D2. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-l4d2 hl2sdk-l4d2]
 
**HL2SDK Portal 2. This engine is used for Portal 2. As of this writing (Dec 2012), SourceMod does not support Portal 2. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-portal2 hl2sdk-portal2]
 
**HL2SDK Dota 2. Repository: [http://hg.alliedmods.net/hl2sdks/hl2sdk-dota/ hl2sdk-dota]
 
*Metamod:Source Source Code. Visit [http://www.metamodsource.net/?go=downloads Metamod:Source downloads]. Right now SourceMod builds against Metamod:Source 1.9.
 
 
 
'''Note''' that when we refer to "Metamod:Source" in this article, we are referring to its source code tree, not a binary package.
 
 
 
If you intend to compile the MySQL extension, you must also download MySQL 5.0.  You can use any version.  For simplicity, here are the versions we use:
 
*Linux: We use the 5.0.45 binary from the "[http://dev.mysql.com/downloads/mysql/5.0.html#linux Linux (non RPM packages)]" for "Linux (x86)."  You can also use [http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.45-linux-i686-glibc23.tar.gz this direct link] (may not be valid in the future).
 
*Windows: Due to a MySQL build change we use 5.0.24a which is an older download.  The file name was "mysql-5.0.24a-win32.zip," if you can't find it you can use this [http://downloads.mysql.com/archives/mysql-5.0/mysql-noinstall-5.0.24a-win32.zip direct link] (may not be valid in the future).
 
 
 
You can remove all folders from the distribution except for the "lib" and "include" folders which comprise the MySQL SDK.
 
 
 
==Linux==
 
As of this writing, SourceMod's Makefiles are hardcoded to use a binary called "gcc"  You can override this, for example:
 
<pre>make CPP=gcc-4.4</pre>
 
 
 
Note that you must use <tt>gcc</tt> and not <tt>g++</tt>.
 
 
 
SourceMod's Makefiles have strict directory organizational rules.  You must have a top-level folder. For this document, we'll assume it is called <tt>sourcemod</tt>, though it can be named anything. The layout of <tt>sourcemod</tt> must be:
 
*<tt>sourcemod</tt>/
 
**<tt>hl2sdk</tt> - symlink or folder containing the HL2SDK for Original/Episode 1
 
**<tt>hl2sdk-ob</tt> - symlink or folder containing the HL2SDK for Orange Box
 
**<tt>hl2sdk-css</tt> - symlink or folder containing the HL2SDK for CS:S
 
**<tt>hl2sdk-ob-valve</tt> - symlink or folder containing the HL2SDK for Source 2009 (HL2:DM, DoD:S, TF2)
 
**<tt>hl2sdk-l4d</tt> - symlink or folder containing the HL2SDK for Left 4 Dead
 
**<tt>hl2sdk-l4d2</tt> - symlink or folder containing the HL2SDK for Left 4 Dead 2
 
**<tt>hl2sdk-csgo</tt> - symlink or folder containing the HL2SDK for CS:GO
 
**<tt>hl2sdk-dota</tt> - symlink or folder containing the HL2SDK for Dota 2
 
**<tt>mmsource-central</tt> - symlink or folder containing any Metamod:Source version 1.7 or higher (1.9 or newer recommended for CS:S and CS:GO support)
 
**<tt>sourcemod-central</tt> - folder containing SourceMod's source code tree. This can be named anything, as long as it's a valid SourceMod tree (like [http://hg.alliedmods.net/sourcemod-central sourcemod-central]).  You can also use [http://hg.alliedmods.net/sourcemod-1.1 sourcemod-1.1].
 
**<tt>mysql-5.0</tt> - symlink or folder containing a MySQL 5.0 distribution
 
 
 
If you are using a 64-bit version of Linux, you may need to install extra packages to be able to compile SourceMod.  On Debian-based distros, these are typically:
 
 
<pre>
 
<pre>
#prerequisites
+
$ bash ./sourcemod-central/tools/buildbot-checkout-mac-deps.sh
#apt-get install g++-4.1 gcc-4.1 make subversion
 
#apt-get install libz libz-dev
 
#only needed if you want to use the build tool
 
#apt-get install mono mono-devel
 
#32-bit support
 
apt-get install ia32-libs
 
apt-get install lib32z1 lib32z1-dev
 
apt-get install libc6-dev-i386 libc6-i386
 
 
</pre>
 
</pre>
  
==Windows==
+
=Visual Studio Project Files=
On Windows we don't require a particular directory layout. Instead, environment variables are used.  The directions below apply to Windows XP, and are assumed to be similar for other versions of Windows.
+
In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.
*Open the Control Panel (for example, via Start -> Settings).
+
 
*Open the System control.  If you don't see it, you may need to switch to "Classic view" (either via the left-hand pane or by going to Tools -> Folder Options).
+
First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the <tt>checkout-windows-deps.bat</tt> script. Next,
*Click the Advanced tab.
+
#Open the Control Panel (for example, via Start -> Settings).
*Click the Environment Variables button.
+
#Open the System control.  If you don't see it, you may need to switch to "Classic view" (either via the left-hand pane or by going to Tools -> Folder Options).
 +
#Click the Advanced tab.
 +
#Click the Environment Variables button.
  
You can add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. The item names are in <tt>fixed-width font</tt> and their value descriptions follow.
+
Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in <tt>fixed-width font</tt> and their value descriptions follow.
*<tt>MMSOURCE19</tt> - Path to Metamod:Source 1.9+
+
*<tt>MMSOURCE19</tt> - Path to Metamod:Source 1.10+
 +
*<tt>MMSOURCE18</tt> - Path to Metamod:Source 1.10+
 
*<tt>HL2SDK</tt> - Path to HL2SDK Ep1/Original
 
*<tt>HL2SDK</tt> - Path to HL2SDK Ep1/Original
 
*<tt>HL2SDKOB</tt> - Path to HL2SDK Ep2/OrangeBox for mods
 
*<tt>HL2SDKOB</tt> - Path to HL2SDK Ep2/OrangeBox for mods
Line 155: Line 82:
 
*<tt>HL2SDKL4D2</tt> - Path to HL2SDK L4D2
 
*<tt>HL2SDKL4D2</tt> - Path to HL2SDK L4D2
 
*<tt>HL2SDK-DOTA</tt> - Path to HL2SDK DOTA 2
 
*<tt>HL2SDK-DOTA</tt> - Path to HL2SDK DOTA 2
 +
*<tt>MYSQL5</tt> - Path to the folder that contains MySQL's <tt>include</tt> and <tt>lib</tt> folders.
  
Note that the Windows project does not have entries for Portal 2 or GMod.
+
=Makefiles=
 
+
Makefiles are deprecated and will be removed from the tree soon.
=Building=
 
Binaries have seven build modes, each paired with either Release or Debug, meaning there are fourteen build options total.  They build modes are:
 
*<tt>original</tt> - Building against HL2SDK_ORIG with MM:S 1.4 API (aka core-legacy)
 
*<tt>orangebox</tt> - Building against HL2SDK_OB with MM:S 1.6 API or higher
 
*<tt>css</tt> - Building against HL2SDK_CSS with MM:S 1.9 API or higher
 
*<tt>orangeboxvalve</tt> - Building against HL2SDK_OB_VALVE with MM:S 1.6 API or higher
 
*<tt>left4dead</tt> - Building against HL2SDK_L4D with MM:S 1.6 API or higher
 
*<tt>left4dead2</tt> - Building against HL2SDK_L4D2 with MM:S 1.6 API or higher
 
*<tt>csgo</tt> - Building against HL2SDK_CSGO with MM:S 1.9 API or higher
 
 
 
==Linux==
 
The object files and the final binary are placed in a folder called <tt>Release</tt> or <tt>Debug</tt> (in the same level as the Makefile) depending on which building mechanism you chose.
 
 
 
'''Note:''' Our Makefiles are not set up to detect changes in header files.  If you change a header file, you must clean your build.
 
 
 
Note that the Linux Makefile does not have entries for Dark Messiah, E.Y.E. Divine Cybermancy, Bloody Good Time, Portal 2, or GMod.
 
 
 
make has one required argument, <tt>ENGINE</tt>.  It must be <tt>original</tt>, <tt>orangebox</tt>, <tt>css</tt>, <tt>orangeboxvalve</tt>, <tt>left4dead</tt>, <tt>left4dead2</tt>, or <tt>csgo</tt>.  For example, to build a TF2-compatible binary in debug mode:
 
 
 
<pre>make ENGINE=orangeboxvalve DEBUG=true</pre>
 
 
 
Dependent binaries are dropped into one of the following folders:
 
*Debug.original
 
*Debug.orangebox
 
*Debug.css
 
*Debug.orangeboxvalve
 
*Debug.left4dead
 
*Debug.left4dead2
 
*Debug.csgo
 
*Release.original
 
*Release.orangebox
 
*Release.css
 
*Release.orangeboxvalve
 
*Release.left4dead
 
*Release.left4dead2
 
*Release.csgo
 
 
 
==Windows==
 
Windows solution files end with <tt>.sln</tt> and are found in an <tt>msvc10</tt> folder that resides inside each binary's main source folder.  For example, Core is located in <tt>core/msvc10/sourcemod_mm.sln</tt>. 
 
 
 
Once the file is opened, you can select which build to use by using the Solution Configurations listbox near the top of the screen.  As of MetaMod: Source 1.9, those are:
 
 
 
*CrazyDebug - Alien Swarm
 
*CrazyDebug - Bloody Good Time
 
*CrazyDebug - CS GO
 
*CrazyDebug - CSS
 
*CrazyDebug - Dark Messiah
 
*CrazyDebug - Episode 1
 
*CrazyDebug - EYE
 
*CrazyDebug - Left 4 Dead 2
 
*CrazyDebug - Left 4 Dead
 
*CrazyDebug - Old Metamod
 
*CrazyDebug - Orange Box Valve
 
*CrazyDebug - Orange Box
 
*Debug - Alien Swarm
 
*Debug - Bloody Good Time
 
*Debug - CS GO
 
*Debug - CSS
 
*Debug - Dark Messiah
 
*Debug - Episode 1
 
*Debug - EYE
 
*Debug - Left 4 Dead 2
 
*Debug - Left 4 Dead
 
*Debug - Old Metamod
 
*Debug - Orange Box Valve
 
*Debug - Orange Box
 
*Release - Alien Swarm
 
*Release - Bloody Good Time
 
*Release - CS GO
 
*Release - CSS
 
*Release - Dark Messiah
 
*Release - Episode 1
 
*Release - EYE
 
*Release - Left 4 Dead 2
 
*Release - Left 4 Dead
 
*Release - Old Metamod
 
*Release - Orange Box Valve
 
*Release - Orange Box
 
 
 
Once you have selected a configuration, you can compile by going to Build -> Build Solution.  The binaries and object files will be written to a folder inside <tt>msvc10</tt> named after the full configuration name.  For example, using "Debug - Old Metamod" with the "sdktools" extension will result in the binary: <tt>extensions/sdktools/msvc10/Debug - Old Metamod/sdktools.ext.dll</tt>
 
 
 
'''Note:''' Visual Studio detects changes to header files intelligently.  It is usually not necessary to rebuild a solution.
 
 
 
=Binary Organization=
 
Although SourceMod has a somewhat unified building mechanism, each of the binaries has a different purpose.  They can be separated into the following classes:
 
 
 
*Core-Related: Binaries which are required or loaded intrinsically by Core.
 
*Extensions: Binaries which are loaded via the extension mechanism.
 
*External: Binaries which are standalone or unrelated to SourceMod's live operation (for example, the compiler).
 
 
 
This article is only concerned with the first two types. 
 
 
 
==Core-Related Binaries==
 
Binaries related to Core are spread throughout the source code tree.  They are always placed in <tt>sourcemod/bin</tt> for packaging.  The projects files related to Core are:
 
 
 
*<tt>loader</tt> - This is a very small wrapper binary responsible for detecting the MM:S version and game engine, and deciding which SourceMod version to load.  The output binary is <tt>sourcemod_mm_i486.so</tt> or <tt>sourcemod_mm.dll</tt>.
 
*<tt>core</tt> - This is Core itself, and is a dependent binary.  It has eleven outputs:
 
**Original/Episode 1: <tt>sourcemod.1.ep1.so</tt>/<tt>sourcemod.1.ep1.dll</tt>
 
**Orange Box: <tt>sourcemod.2.ep2.so</tt>/<tt>sourcemod.2.ep2.dll</tt>
 
**Orange Box Valve: <tt>sourcemod.2.ep2v.so</tt>/<tt>sourcemod.2.ep2v.dll</tt>
 
**Alien Swarm: <tt>sourcemod.2.swarm.so</tt>/<tt>sourcemod.2.swarm.dll</tt>
 
**Bloody Good Time: <tt>sourcemod.2.bgt.so</tt>/<tt>sourcemod.2.bgt.dll</tt>
 
**CS:GO: <tt>sourcemod.2.csgo.so</tt>/<tt>sourcemod.2.csgo.dll</tt>
 
**CS:S: <tt>sourcemod.2.css.so</tt>/<tt>sourcemod.2.css.dll</tt>
 
**Dark Messiah: <tt>sourcemod.2.darkm.so</tt>/<tt>sourcemod.2.darkm.dll</tt>
 
**E.Y.E.: <tt>sourcemod.2.eye.so</tt>/<tt>sourcemod.2.eye.dll</tt>
 
**Left 4 Dead: <tt>sourcemod.2.l4d.so</tt>/<tt>sourcemod.2.l4d.dll</tt>
 
**Left 4 Dead 2: <tt>sourcemod.2.l4d2.so</tt>/<tt>sourcemod.2.l4d2.dll</tt>
 
 
 
*<tt>sourcepawn/jit/x86</tt> - This is the SourcePawn JIT for generating IA32/x86 instructions from <tt>.smx</tt> files.  Currently the source code for this is not made available.  It is built as <tt>sourcepawn.jit.x86.so</tt>/<tt>sourcepawn.jit.x86.dll</tt>.
 
 
 
It is technically not necessary to use the loader.  It is provided as a convenience so users do not have to perform extra steps while installing SourceMod.  However, it is highly recommend that you do use it in order to maintain similarity with the default SourceMod package.
 
 
 
==Extensions==
 
Extensions are found in the <tt>extensions</tt> folder of the source tree.  SDKTools, Cstrike, and the TF2 extension are engine/MM:S dependent (and the rest are generally not).
 
 
 
Normal extensions are named <tt>name.ext.so</tt> or <tt>name.ext.dll</tt> where <tt>name</tt> is a unique identifier.  Dependent extensions will be named like core above.
 
 
 
 
 
For example, the SDKTools binary on Counter-Strike: Source for Window would be loaded from <tt>extensions/sdktools.ext.2.css.dll</tt>, but the GeoIP binary (which is not dependent) would be loaded from <tt>extensions/geoip.ext.dll</tt>.
 
  
 
=Removing SSE=
 
=Removing SSE=
SourceMod binaries are built against SSE by default. SSE is an important set of optimizations, that, according to Valve's hardware survey, are supported on 99.6% percent of respondents' computers. If you are in this 0.4% which does not have SSE support, you should consider buying a newer processor. Only early Pentium 3-grade processors did not have SSE support (for example, the very early Durons), and it is likely your Source server will not perform adequately to support more than few players.
+
SourceMod binaries are built against SSE by default. SSE is an important set of optimizations, that, according to Valve's hardware survey, are supported on 99.6% percent of respondents' computers. If you are in this 0.4% which does not have SSE support, you should consider buying a newer processor. Only early Pentium 3-grade processors did not have SSE support (for example, the very early Durons), and it is likely your Source server will not perform adequately to support more than few players.
 
 
Nonetheless, SourceMod's binaries can all be recompiled to remove its SSE dependence.
 
 
 
==Linux==
 
Edit the Makefile of the binary you are trying to compile.  Remove all instances of these flags.  They can simply be erased, there is no need to replace them with anything.
 
*<tt>-msse</tt>
 
*<tt>-mfpmath=sse</tt>
 
 
 
Make sure to clean the build after changing the Makefile.
 
 
 
==Windows==
 
Load the project file into Visual Studio.  Go to Project -> Properties.  Expand "Configuration Properties," and then "C/C++" under it.  Select "Code Generation."  Change the setting "Enable Enhanced Instruction Set" to "Not Set."
 
 
 
'''Note:''' You must change this setting '''for each build configuration''' that you wish to use.
 
  
 +
If you must turn off SSE, you can try:
 +
<pre>
 +
python configure.py --no-sse
 +
</pre>
  
 
[[Category:SourceMod Documentation]]
 
[[Category:SourceMod Documentation]]
 
[[Category:SourceMod Development]]
 
[[Category:SourceMod Development]]

Revision as of 16:09, 14 November 2013

Compiling SourceMod is not difficult, but requires a number of prerequisites. This article details the requirements and steps to being able to build working SourceMod binaries.

Note that specific compiler versions are required to maintain ABI compatibility with Source engine binaries.

Requirements

No matter what platform you're on, you will need to install some baseline software to get going.

  1. Install Mercurial.
  2. Install AMBuild (You may need to run the install line as administrator):
    hg clone http://hg.alliedmods.net/ambuild
    cd ambuild
    python setup.py install
    
  3. Checkout the SourceMod source code. There are many ways to get it, but via the command-line is easiest:
    hg clone http://hg.alliedmods.net/sourcemod-central
    

Windows

You need one of the following Visual Studio versions:

  • Microsoft Visual C++ 2012 (Express or higher) will work for some games; notably, not Dota 2.
  • Microsoft Visual C++ 2010 (Express or higher) is supported and used for official builds.

Grab the necessary Windows dependencies by running tools\buildbot\checkout-windows-deps.bat. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:

C:\Users\dvander> sourcemod-central\tools\buildbot-checkout-windows-deps.bat

Linux

For Linux, SourceMod requires a compiler compatible with the GNU C/C++ Compiler:

  • If using GCC, 4.4 or higher is required. For SourceMod 1.5 and prior, GCC 4.4 is used officially.
  • If using Clang, 3.2 or higher is required. For SourceMod 1.6 and higher, Clang 3.3 is used officially.

If using a 64-bit Linux, you will need to install a few packages to ensure you can build 32-bit binaries. On Ubuntu or Debian, these packages are:

sudo apt-get install ia32-libs gcc-multilib g++-multilib
sudo apt-get install lib32z1 lib32z1-dev
sudo apt-get install libc6-dev-i386 libc6-i386

Grab the remaining necessary Linux dependencies by running tools/buildbot/checkout-linux-deps.sh. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:

$ bash ./sourcemod-central/tools/buildbot-checkout-linux-deps.sh

Mac OS X

Grab the remaining necessary OS X dependencies by running tools/buildbot/checkout-linux-deps.sh. It should be run in the folder above sourcemod-central. Note that it will download quite a few HL2SDK copies. Example:

$ bash ./sourcemod-central/tools/buildbot-checkout-mac-deps.sh

Visual Studio Project Files

In the future, we will use AMBuild to automatically generate project files, and the existing project files will be removed from the SourceMod tree. In the meantime however, it is possible to use these files. Unfortunately, they require a bit of extra work to use.

First, make sure you've downloaded all necessary dependencies (SDKs, Metamod:Source source code, and MySQL) via the checkout-windows-deps.bat script. Next,

  1. Open the Control Panel (for example, via Start -> Settings).
  2. Open the System control. If you don't see it, you may need to switch to "Classic view" (either via the left-hand pane or by going to Tools -> Folder Options).
  3. Click the Advanced tab.
  4. Click the Environment Variables button.

Now, add your environment variables to either your User settings or your System settings. Create a new variable for each item in the list below. You may omit SDKs that you do not plan to build against. The item names are in fixed-width font and their value descriptions follow.

  • MMSOURCE19 - Path to Metamod:Source 1.10+
  • MMSOURCE18 - Path to Metamod:Source 1.10+
  • HL2SDK - Path to HL2SDK Ep1/Original
  • HL2SDKOB - Path to HL2SDK Ep2/OrangeBox for mods
  • HL2SDKOBVALVE - Path to HL2SDK Source 2009 (HL2:DM, DoD:S, TF2)
  • HL2SDK-SWARM - Path to HL2SDK Alien Swarm
  • HL2SDK-BGT - Path to HL2SDK for Bloody Good Time
  • HL2SDKCSGO - Path to HL2SDK CS:GO
  • HL2SDKCSS - Path to HL2SDK CS:S
  • HL2SDK-DARKM - Path to HL2SDK Dark Messiah
  • HL2SDK-EYE - Path to HL2SDK E.Y.E.: Divine Cybermancy
  • HL2SDKL4D - Path to HL2SDK L4D1
  • HL2SDKL4D2 - Path to HL2SDK L4D2
  • HL2SDK-DOTA - Path to HL2SDK DOTA 2
  • MYSQL5 - Path to the folder that contains MySQL's include and lib folders.

Makefiles

Makefiles are deprecated and will be removed from the tree soon.

Removing SSE

SourceMod binaries are built against SSE by default. SSE is an important set of optimizations, that, according to Valve's hardware survey, are supported on 99.6% percent of respondents' computers. If you are in this 0.4% which does not have SSE support, you should consider buying a newer processor. Only early Pentium 3-grade processors did not have SSE support (for example, the very early Durons), and it is likely your Source server will not perform adequately to support more than few players.

If you must turn off SSE, you can try:

python configure.py --no-sse