barryharris.me.uk
Tuesday, 7 February 2012, 00:26
drgnbowl

Guide to Compiling FB Alpha using Visual C++

FB Alpha
This guide was updated on the 21st of September 2011 with updates to the latest versions of the tools.

This guide will help you to setup an environment to compile FB Alpha using Visual C++. This guide will also use some of the tools from the MinGW guides so ensure at least one of these is setup first.

I have listed the version number of each package used, these are current at the time of writing and it is advised that you use these versions unless you are capable of fixing any problems that arise from not using them.

The guide is aimed at people who have basic Windows skills and can understand instructions such as download and extract. The default installation folders are recommended, if you install to other locations then you will need to change some of the later commands.

Note - this guide is intended for use with FB Alpha versions 0.2.97.09 and newer.

Visual C++

Download and install Visual C++ 2010 Express Edition.

Microsoft Windows SDK

Download and install Microsoft Windows SDK for Windows 7 and .NET Framework 4.

DirectX August 2007 SDK

Because we use some of the older deprecated files then you will need to download two DirectX SDKs. Firstly, download and install the August 2007 SDK. This is the last SDK to support Direct3D versions prior to 9. We need to take a copy of the following files;

  • include/d3d.h
  • include/d3dcaps.h
  • include/d3dtypes.h
  • include/d3dvec.inl
  • lib/x86/ddraw.lib

from the August 2007 DirectX SDK folder. Once these files are copied to a temporary location then this SDK should be uninstalled.

Alternatively you can use an archiving program to extract these files from the archive rather than install and uninstall should you prefer.

DirectX June 2010 SDK

Download and install the June 2010 SDK. We now need to make sure that the files we copied from the August 2007 SDK are now in the compile environment. The easiest way to do this is to copy the files into the relevant folders of the June 2010 SDK.

FB Alpha Source

Download the FB Alpha source code and extract it into a folder on your machine. For the purpose of this guide we will be using c:\fbasrc. After the source is extracted open a command prompt window and change to the c:\fbasrc folder. This can be achieved by typing (substitute your FB Alpha source folder where appropriate);

cd \fbasrc

and pressing Enter.

Next, we need to add the compile environment to our path. The easiest way to achive this is to use the batch file below;

@echo off

call "c:\program files\Microsoft SDKs\Windows\v7.1\bin\SetEnv.cmd" /x86 /xp /Release

call "c:\program files\Microsoft DirectX SDK (June 2010)\Utilities\bin\Dx_Setenv.cmd" x86

call "c:\program files\microsoft visual studio 10.0\VC\vcvarsall.bat"

path=c:\mingw345\bin;c:\perl\bin;%PATH%

Copy and paste the above into a batch file and amend the paths as necessary for your setup.

Execute the batch file from a command prompt window and then type;

mingw32-make vc

and press Enter.

This will build the program and take between 5 and 15 minutes depending on your computer. When the build is complete you will have an fba.exe to run.

If you are looking to do any development work, then it may be useful to turn on the debug features. Simply uncomment the

DEBUG = 1

line in the main makefile to build a debug version of the program.