Darkvater@5408: Compiling OpenTTD using Microsoft Visual C++ Darkvater@5489: January 2, 2007 Darkvater@5408: -------------------------------------------- Darkvater@5408: PLEASE READ THE ENTIRE DOCUMENT BEFORE DOING ANY ACTUAL CHANGES!! Darkvater@5355: Darkvater@5489: Darkvater@5408: SUPPORTED MSVC COMPILERS Darkvater@5408: ------------------------ rubidium@8409: OpenTTD includes projects for MSVC 2005.NET and MSVC 2008.NET. Both will Darkvater@5408: compile out of the box, providing you have the required libraries/headers; rubidium@8409: which ones, see below. There is no support for VS6 or MSVC 2002, or rubidium@8409: MSVC 2003.NET. You are therefore strongly encouraged to either upgrade to rubidium@8409: MSVC 2005 Express (free) or use GCC. Darkvater@5355: Darkvater@5489: Darkvater@5408: 1) REQUIRED FILES Darkvater@5408: ----------------- Darkvater@5408: You might already have some of the files already installed, so check before Darkvater@5408: downloading; mostly because the DirectX SDK and Platform SDK are about Darkvater@5408: 500MB each. Darkvater@5355: Download the following files: Darkvater@5355: Darkvater@5408: * openttd-useful.zip (http://sf.net/project/showfiles.php?group_id=103924&package_id=114307) Darkvater@5408: * DirectX 8.1 SDK (http://neuron.tuke.sk/~mizanin/eng/Dx81sdk-include-lib.rar) (or alternatively the latest DirectX SDK from Microsoft) Darkvater@5408: * MS Windows Platform SDK (http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en) Darkvater@5408: * afxres.h (http://www-d0.fnal.gov/d0dist/dist/packages/d0ve/devel/windows/AFXRES.H) Darkvater@5355: Darkvater@5355: ...and of course the newest source from svn://svn.openttd.org/trunk Darkvater@5355: Darkvater@5408: You need an SVN-client to download the source from subversion: Darkvater@5355: Darkvater@5408: * CLI Subversion (http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91) Darkvater@5408: * GUI TortoiseSVN (http://tortoisesvn.tigris.org/download.html) Darkvater@5355: Darkvater@5489: Darkvater@5408: 2) INCLUDES AND LIBRARIES Darkvater@5408: ------------------------- Darkvater@5408: Put the newly downloaded files in the VC lib\ and include\ directories; where Darkvater@5408: "C:\Program Files\Microsoft Visual Studio 8\VC" is your location of Visual C. Darkvater@5408: If you are compiling for an x64 system, use the include\ and lib\ directories Darkvater@5408: from the win64/ folder. Darkvater@5355: Darkvater@5408: * openttd-useful.zip\include\* Darkvater@5408: * afxresh.h Darkvater@5408: to > C:\Program Files\Microsoft Visual Studio 8\VC\Include Darkvater@5355: Darkvater@5408: * openttd-useful.zip\lib\* Darkvater@5408: to > C:\Program Files\Microsoft Visual Studio 8\VC\Lib Darkvater@5355: Darkvater@5408: Custom directories might be recommended, check 2.2) Darkvater@5355: Darkvater@5355: Darkvater@5408: 2.1) INCLUDES AND LIBRARIES - DIRECTX/PLATFORM SDK Darkvater@5408: -------------------------------------------------- Darkvater@5408: Basically the same procedure as with the useful zip file, providing Darkvater@5408: you are not using the Microsoft installer. Put the include files in the Darkvater@5408: include\ directory and the library files to the Lib\ directory. Darkvater@5355: Darkvater@5408: It is recommended to use custom directories so you don't overwrite any Darkvater@5408: default header or library files. Darkvater@5355: Darkvater@5489: Darkvater@5408: 2.2) CUSTOM DIRECTORIES Darkvater@5408: ----------------------- Darkvater@5408: If you have put the above include and/or library files into custom folders, Darkvater@5408: MSVC will not find them by default. You need to add these paths to VC through: Darkvater@5355: Darkvater@5408: Tools > Options > Projects and Solutions > VC++ Directories > show directories for Darkvater@5355: Darkvater@5408: * Include files: Add the DirectX/Platform SDK include dir you've created Darkvater@5408: * Library files: Add the path to the SDK custom lib dir Darkvater@5408: Darkvater@5408: NOTE: make sure that the directory for the DirectX SDK is the first one in the Darkvater@5408: list, above all others, otherwise compilation will most likely fail!! Darkvater@5408: Darkvater@5489: Darkvater@5408: 3) TTD GRAPHICS FILES Darkvater@5408: --------------------- Darkvater@5489: Copy the following files from Transport Tycoon Deluxe to the bin/data folder Darkvater@5355: Darkvater@5408: * sample.cat Darkvater@5408: * trg1r.grf Darkvater@5408: * trgcr.grf Darkvater@5408: * trghr.grf Darkvater@5408: * trgir.grf Darkvater@5408: * trgtr.grf Darkvater@5355: Darkvater@5355: Darkvater@5408: 4) COMPILING Darkvater@5408: ------------ rubidium@8409: Open trunk/openttd_vs[89]0.sln Darkvater@5408: Set the build mode to 'Release' in Darkvater@5408: Build > Configuration manager > Active solution configuration > select "Release" Darkvater@5355: Compile... Darkvater@5355: rubidium@8409: If everything works well the binary should be in trunk/objs/Win[32|64]/Release/openttd.exe Darkvater@5489: Darkvater@5355: Darkvater@5408: 5) EDITING, CHANGING SOURCE CODE Darkvater@5408: -------------------------------- Darkvater@5408: Set the build mode (back to) 'Debug' Darkvater@5408: Change the startup project to openttd by right-clicking the 'openttd' project Darkvater@5408: in the Solution Explorer and selecting 'Set as Startup Project'. The 'openttd' Darkvater@5408: project should now show up bold instead of 'strgen'. Darkvater@5355: Darkvater@5489: Darkvater@5408: 6) PROBLEMS? Darkvater@5408: ------------ Darkvater@5408: If compilation fails, double-check that you are using the latest SVN (!) Darkvater@5408: source. If it still doesn't work, check in on IRC (irc://irc.oftc.net/openttd), Darkvater@5408: to ask about reasons; or just wait. The problem will most likely solve itself Darkvater@5408: within a few days as the problem is noticed and fixed. Darkvater@5355: Darkvater@5408: An up-to-date version of this README can be found on the wiki: rubidium@8409: http://wiki.openttd.org/index.php/MicrosoftVisualCExpress