Difference between revisions of "Building SourceMod"
m |
|||
Line 4: | Line 4: | ||
=Requirements= | =Requirements= | ||
− | |||
− | |||
<ol> | <ol> | ||
− | |||
<li>Install AMBuild (You may need to run the install line as administrator): | <li>Install AMBuild (You may need to run the install line as administrator): | ||
<pre> | <pre> | ||
Line 24: | Line 21: | ||
==Windows== | ==Windows== | ||
− | You need one of the following Visual Studio versions: | + | <ol> |
− | + | <li>You need one of the following Visual Studio versions: | |
− | + | <ul> | |
− | + | <li>Microsoft Visual C++ 2012 (Express or higher) will work for some games; notably, not Dota 2.</li> | |
− | + | <li>Microsoft Visual C++ 2010 (Express or higher) is supported and used for official builds.</li> | |
− | 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: | + | </ul> |
+ | </li> | ||
+ | <li>Install [http://mercurial.selenic.com/ Mercurial].</li> | ||
+ | <li>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 | ||
</pre> | </pre> | ||
+ | </li> | ||
In order to actually perform builds, you will need to be in a Visual Studio Command Prompt. You can do this in a few ways: | In order to actually perform builds, you will need to be in a Visual Studio Command Prompt. You can do this in a few ways: |
Revision as of 16:52, 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.
Contents
Requirements
- 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
- 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.
- Install Mercurial.
- 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
- Under Start, Programs, Microsoft Visual Studio, select the "Visual Studio Tools" folder and run "Visual Studio Command Prompt".
- Open a command prompt, and run "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars.bat". You can substitute alternate version numbers.
- Use MozillaBuild. MozillaBuild provides batch files that will launch a unix-like shell for whatever Visual Studio environment you need. Make sure to launch 32-bit environments, not 64-bit ones.
- 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.
- --enable-debug - Compile with symbols and debug checks/assertions.
- --enable-optimize - Compile with optimizations.
- --no-sse - Disable floating point optimizations (if you have a very, very old CPU).
- 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).
- Click the Advanced tab.
- Click the Environment Variables button.
- 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.
In order to actually perform builds, you will need to be in a Visual Studio Command Prompt. You can do this in a few ways:
If you do not use MozillaBuild, there is one extra step. The Python installer on Windows, for some mysterious reason, does not install into PATH. Unless you want to run Python by using C:\Python27\python.exe, you should add C:\Python27;C:\Python27\Scripts to your PATH environment variable. (Control Panel, System, Advanced, Environment Variables.)
Linux
For Linux, SourceMod requires a compiler compatible with the GNU C/C++ Compiler:
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
Configuring
The first time you are building a SourceMod tree, you must configure the build. This step initializes some basic information and allows some customization around how things get compiled.
First create a build folder, and then run configure.py. For example: mkdir build cd build python ../sourcemod-central/configure.py
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.
There are a few extra options you can pass to configure:
Building
To build SourceMod, simply type:
ambuild
In your build folder. Alternately, you can specify the path of the build folder:
ambuild debug-build
The full package layout that would be shipped for release is in the package folder of the build.
Deprecated Tools
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,
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.
Makefiles
Makefiles are deprecated and will be removed from the tree soon.