Building ioquake3 on Windows - Visual Studio 2008
Return to Building ioquake3.
This is based off of these instructions: http://www.ioquake.org/forums/viewtopic.php?f=12&t=60
Credit goes to DevHC, ensiform, GreyGhost, benmachine, kevlarman, and the rest of the ioquake3 IRC denizens. Keepin' it real one ASCII gang sign at a time!
This should work for XP and Vista. Tested on WinXP but it will probably work on Vista.
Installing VS2008 and Required Libraries
- go to http://www.microsoft.com/express/download/ and scroll to the bottom of the page, find the Offline Install, choose the language of your choice, and click Download. Download the file into c:\temp\vs2008exp\
- follow the instructions at http://www.microsoft.com/express/download/offline.aspx to install the program--I mounted the ISO in a virtual CD and installed from there, but you can burn it to a DVD-R or extract the files, whatever floats your boat.
- run the installer, all you need is "Visual C++ 2008 Express Edition" and nothing else. I unchecked "Allow Visual Studio to receive and display online RSS content" and I did NOT install the optional installs of Microsoft Silverlight Runtime and Microsoft SQL Server 2008 Express Edition (x86). Install to default directories, etc.
- VS2008 will litter your hard drive with a stupid temporary directory, feel free to delete it. For reference, mine was C:\1514b1b9a0b983757ae90709a18b\
- download http://libsdl.org/release/SDL-devel-1.2.13-VC8.zip to c:\temp\sdl\
- extract SDL-devel-1.2.13-VC8.zip into c:\temp\sdl\
- copy *.lib from C:\temp\SDL-1.2.13\lib to C:\Program Files\Microsoft Visual Studio 9.0\VC\lib (should be SDL.lib and SDLmain.lib)
- download http://tortoisesvn.net/downloads into c:\temp\svn\
- run the installer with all the defaults, reboot when it tells you to
- go to http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 and download the latest installer; it should be near the top of the list and named something like "Setup-Subversion-1.5.3.msi"
- run the installer with all the defaults
- make the folder c:\ioq3-vs2008
- right-click that folder and choose "TortoiseSVN" and then "Settings", under the General section click on the Edit button (lower middle right). This will pop up a config file to edit.
- search for "enable-auto-props"; it is near the bottom of the config. Uncomment that line. Make sure there is no leading whitespace for the line you uncomment or SVN freaks out.
- also uncomment all the lines in the "[auto-props]" section, the last section of the config file. Save the config file and then hit the Ok button to close the Settings window.
- right-click the "ioq3-vs2008" folder again and choose "SVN Checkout", use the URL of repository to be svn://svn.icculus.org/quake3/trunk
- leave everything else as default and click the OK button; you should start getting source unless svn is down/broken
- alternatively, you can use the command-line version of svn by opening a command prompt, navigating to c:\ and then running the following command: "svn co svn://svn.icculus.org/quake3/trunk ioq3-vs2008".
- VS2008 installs the parts of the Windows SDK that it needs, so we don't need to install that or configure it.
Setting up Visual Studio
- Load VS2008, go to File and choose Open and then Project/Solution... and select C:\ioq3-vs2008\misc\msvc\ioq3.sln
- It will run you through an import wizard. Basically you'll get an option to create backups before converting or not. I lived dangerously and didn't bother.
- Once your "solution" has loaded, go to Build and choose Configuration Manager... and make sure the drop-down menu says "Release"; mine was defaulted to "Debug TA".
- Close VS2008 to make sure everything is saved before you start messing things up.
- Load VS2008, go to File -> Open -> Project/Solution... and select
- Once your "solution" has loaded, right-click on "Solution 'ioq3'" in the upper-left Solution Explorer window and select "Build". If you want to rebuild things fresh, select "Rebuild".
- You should get warnings in your Output window, but the only really important part is the last line which should look something like:
========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ==========
The ui module will fail, but it is currently unused, so it is safe to ignore this error. Since this guide only deals with compiling straight from the SVN trunk, it will not go into detail about how to compile and use ui (as opposed to q3_ui).
- compiling depends on how much RAM you have and how fast your computer is. So it could go quickly or take forever.
- when you're done compiling, you should have the compiled files in:
- Speex files generate a ton of warnings. The main speex project disables these specifically, though you may or may not want to. If you want to disable these warnings specifically, open up the properties of the "quake3" project, go to Configuration Properties, then to C/C++, then to Advanced, and in the Disable Specific Warnings field, type: 4244;4305;4311;4100;4127 When done, apply this to save it and you should get less chatter. I went from 550 warnings down to 73 warnings. Since the speex people themselves don't care about these warnings (else I assume they'd have fixed them), they probably aren't too important. You can also add ones that are related to the JPEG code as well, such as 4245, 4389, 4706 or even 4201 for some warnings from the Platform SDK. Again, the more warnings you exclude, the more errors or bugs might make their way into your code because you're suppressing the compiler telling you about them, but it might make finding major errors/bugs easier.
- Instead of dynamically linking the microsoft libraries, we are going to statically link them. When compiling, you will get warnings about LIBCMT and OleAcc.dll, but the binary will build fine and should work on systems without requiring the microsoft DLLs to be included as well. You can research /NODEFAULTLIB: and other things if those LINK warnings bother you, but the resulting binary seems to work fine.
- If you get failures like these:
- c:\ioq3-vs2008\code\libspeex\arch.h(65) : fatal error C1189: #error : You now need to define either FIXED_POINT or FLOATING_POINT
- c:\ioq3-vs2008\code\renderer\qgl.h(32) : fatal error C1083: Cannot open include file: 'SDL_opengl.h': No such file or directory
- c:\ioq3-vs2008\code\client\cl_curl.h(44) : fatal error C1083: Cannot open include file: 'curl/curl.h': No such file or directory
- c:\ioq3-vs2005\code\sdl\sdl_snd.c(29) : fatal error C1083: Cannot open include file: 'SDL.h': No such file or directory
...then make sure the drop-down menu says "Release"; mine was defaulted to "Debug TA".
Using your compiled files
- I installed Quake 3 into, say, c:\program files\quake3, then installed the latest patches. I then installed ioquake3 into that same folder. I copied the whole install from c:\program files\quake3 to something like c:\program files\devquake3 so I could mess around and not ruin my regular game install.
- since the needed SDL and OpenAL .dll files were already installed with ioquake3, all you need to copy over are the .exe and new .dll files when you want to test them in your \devquake3 install.
- in case you're wondering, for the devquake3 example:
- c:\Program Files\devquake3\ <--- put the .exe here
- c:\Program Files\devquake3\baseq3 <--- put the .pk3 files here
- c:\Program Files\devquake3\missionpack <--- put the .dll files here
- if you opted to dynamically link the VS2008 libraries instead of statically linking them and want to give the resulting binary to someone who doesn't have VS2008 installed, you may need to have that machine or user install "Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)" if they are getting errors when trying to run the program you compiled. If you have some users who get the errors and some who don't, the ones who don't probably had another program already install this silently and just never informed the user. You can find this here: http://www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en
Building the Debug Version
For those of you who wish to utilize the Debug Version, it's doable, with little additional hassle. Follow Step 6-7 of the Install guide, and additionally copy the contents of the /include directory to C:\Program Files\Microsoft Visual Studio 9.0\VC\include. Follow the other instructions and build the Debug Version as usual, it should work.