Skip to content

Developer Getting Started: Visual Studio

cxong edited this page Apr 4, 2013 · 35 revisions

Prerequisites

Clone repo

  1. Right-click where you want to clone the repo (e.g. C:\), select "Git Clone..."

  2. In clone dialog, enter the repo URL

  3. Cloning...

  4. You should now see the repo contents in C:\cdogs-sdl

  5. Right click in C:\cdogs-sdl and select "TortoiseGit > Submodule Update" to get the submodules as well (just tinydir).

Install SDL/SDL_mixer development libraries

There are many instructions for installing SDL for visual studio, but unfortunately CMake's Windows SDL support is quite poor, so these instructions are designed to support CMake as well.

  1. Choose a location for the SDL libraries (e.g. C:\dev).

  2. Copy the contents of the SDL_1.2.XX subfolder to C:\dev (so you should have the folders C:\dev\include, C:\dev\lib etc.)

  3. Do the same for SDL_mixer, combining the contents of the include and lib folders. However, you should also copy the contents of those folders to C:\dev for CMake's benefit (just SDL_mixer.h and SDL_mixer.lib).

  4. In C:\dev\lib, there are x86 and x64 versions of the same libraries. Copy the .lib files in x86 to the lib folder.

  5. Copy the .dll files to the C:\cdogs-sdl folder

  6. Create an environment variable SDLDIR that points to C:\dev

Run CMake

  1. Run CMake: for "Where is the source code:" input C:\cdogs-sdl\src, and for "Where to build the binaries:" input C:\cdogs-sdl

  2. Click "Configure", choosing the right Visual Studio version (e.g. VS2012 is VS11); click Finish

  3. Click "Generate"; you should now see Visual Studio projects in C:\cdogs-sdl.

Visual Studio

  1. Open C:\cdogs-sdl\cdogs-sdl.sln

  2. Set the cdogs-sdl project as the startup project

  3. Press F5 to compile and run. You are ready to go!