With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: sparcdr, torhu, Tequila

[Tutorial] Compiling on Windows with MinGW and MINSYS

Postby Barto » Sat Apr 06, 2013 5:26 pm

Introduction
In this small tutorial, I will present you how to compile the game from sources. I will use Windows7 32bit Home Edition for this tutorial.

Content
  • Why
  • Git bash
  • MinGW and MINSYS
  • Getting the code
  • Compilation
  • Update
  • Troubles

Why
There are two kinds of people in the world, my friend. Those who already have a reason to click on that topic and those who are curious and just want to read this text.
I don't think I need to explain much for those who knows they will - no matter what - attempt to compile the game but for the others, I got a nice suggestion that I should explain them why. Here is a list of the possible reasons that may need you to compile the game code:
  • Testing the last development revision helps to find bugs and fix them simply by simply saying: "It's still there" or "It's now fixed".
  • Being on the bleeding edge of the game by discovering the last new implemented features like the second renderer recently added by ioquake3.
  • You have a Windows server and you want to have the latest server-side code because Baller-bude is awesome and you want the same possibilities ( :mrgreen: ).
  • Or, I don't really hope this from you, but you have some troubles with the actual .exe and you think it is a good solution to try to create your own set of binaries.

Git bash
We will need this program to gather the sources from GitHub.
Go to git-scm.com, download and install git. You will have afterwards a new icon named "Git bash" on your desktop.

MinGW and MINSYS
This program is our compiler. Download and install the latest .exe from sourceforge.net. Take care to install it to the recommended path (C:\MinGW) and to add the component named "MSYS Basic System" to the installation.

Getting the code
Now we will get the source code, for this tutorial, we will work directly from the documents folder namely C:\User\YourName\.
So open Git Bash and a black command prompt will open. Just type:
Code: Select all
git clone https://github.com/smokin-guns/SmokinGuns.git

and a folder named SmokinGuns with the whole source code will be created.
You can now close git bash, we'll use it later when we will want to update the source code.

Compilation
So you have installed MinGW and MINSYS, you'll need to launch "MinGW Shell" from the application list and surprise: another command prompt! We will firstly need to move to the folder where your code is, just type:
(you can use the autocompletion with the tabulation button to move faster in the folders)
Code: Select all
cd C:
cd Users\YourName\SmokinGuns

Time to compile! Just type in the same console:
Code: Select all
make

It will take some time and cpu percent for the compilation, but afterwards you will have the compiled files into SmokinGuns\build\release-mingw32-x86\.

The only useful files are the *.dll (if there is/are one/some) and the *.exe that goes to your root game folder (usually C:\Program Files\Smokin' Guns\).
There is also an important folder in SmokinGuns\build\release-mingw32-x86\smokinguns, just compress the vm folder as vm.zip, rename it to vm.pk3 and put it into C:\Program Files\Smokin' Guns\smokinguns with all other pk3s. Your vm.pk3 file should look like that:
Code: Select all
vm/
vm/cgame.qvm
vm/qagame.qvm
vm/ui.qvm

You can now play with the new .exe, I have had no problems to connect to servers since the pk3 are not touched during this process.

"Go out and test it" - Linus Trovalds

Update
When a change in the code is made, it is always nice to be able to recompile the code to test the changes.
Just open git bash and type:
Code: Select all
cd SmokinGuns
git pull

to update the code. You also need to redo the compilation process, it will thus be smaller since it only compile the changes.

Troubles
- If it doesn't compile for some reason when you just updated the code, try to remove the build folder and try to compile again. If it doesn't make the trick, contact the developers via the forum.
- If you spot any bug while testing, just contact the developers via the forum or make a bug report (you will still need a forum account to log in here, in small caps).
- If you want to play with the sources, I suggest you to learn git (especially the checkout command), there are plenty of tutorials around.
- For some other problems, you can contact the devs via IRC (#smokinguns on freenode), me via PM, with a forum post, via a homing pigeon, etc.

--EDIT--
- 08-04-2013: added the "why" section, and idea of Biondo
"Chuck Norris had to shorten his beard in the presence of Richard Stallman because two beards that awesome, so close would segfault the universe (again)."
User avatar
Barto
Jeuxlinux Admin
 
Posts: 360
Joined: Fri Oct 23, 2009 5:08 pm
Location: Switzerland



Return to Code

Show Sidebar
Show Sidebar

User Control Panel

cron