Setting Up the Project - Part II (Project Properties)

Published December 15, 2011
Advertisement

[size="2"][font="Arial"][size="2"]Now that we have decided the basic directory structure and dependencies that each project will have, we will now set the project properties. I prefer to do this at the project level so that the properties are persistent and I don't have to set them every time I download the project. The steps are based on Visual 2008 Professional, but you can adapt them to a different IDE as well

[/font]

[size="2"][font="Arial"][size="2"][subheading]Setup the Main Exe Project[/subheading]

[/font]

  • [font="Arial"][size="2"]Create an Win 32 Project and delete all the files except for stdafx.h, stdafx.cpp (I named the project as Main)
[/font]
  • [font="Arial"][size="2"]Create a new folder called src and move the above files in there (I prefer all my source files in one main directory rolleyes.gif)
[/font]
  • [font="Arial"][size="2"]In the property settings for the project perform the following steps
  • [/font]
    • [font="Arial"][size="2"]For Both Release and Debug Modes
    [/font]
    • [font="Arial"][size="2"]In the tab C/C++ -> General -> Additional Include Directories add
    [/font]
    • [font="Arial"][size="2"]"$(SolutionDir)Common\src"
    [/font]
  • [font="Arial"][size="2"]"$(SolutionDir)Base\Includes"
  • [/font]
  • [font="Arial"][size="2"]"$(SolutionDir)Utilities\Includes"
  • [/font]
  • [font="Arial"][size="2"]"$(SolutionDir)GameBase\Includes"
  • [/font]
  • [font="Arial"][size="2"]"$(SolutionDir)Game\src"
  • [/font]
  • [font="Arial"][size="2"]For Debug Mode
  • [/font]
      • [font="Arial"][size="2"]In the tab Debugging -> Working Directory add
    [/font]
    • [font="Arial"][size="2"]..\..\Debug\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Output Directory add
  • [/font]
    • [font="Arial"][size="2"]..\..\Debug\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Output File add
  • [/font]
    • [font="Arial"][size="2"]$(OutDir)/$(ProjectName)_D.exe
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Additional Library Directories add
  • [/font]
    • [font="Arial"][size="2"]..\..\Debug\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> Input -> Additional Dependencies add
  • [/font]
    • [font="Arial"][size="2"]Utilities_D.lib
    [/font]
  • [font="Arial"][size="2"]Base_D.lib
  • [/font]
  • [font="Arial"][size="2"]Game_D.lib
  • [/font]
  • [font="Arial"][size="2"]For Release Mode
  • [/font]
    • [font="Arial"][size="2"]In the tab Debugging -> Working Directory add
    [/font]
    • [font="Arial"][size="2"]..\..\bin\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Output Directory add
  • [/font]
    • [font="Arial"][size="2"]..\..\bin\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Output File add
  • [/font]
    • [font="Arial"][size="2"]$(OutDir)/$(ProjectName).exe
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Additional Library Directories add
  • [/font]
    • [font="Arial"][size="2"]..\..\bin\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> Input -> Additional Dependencies add
  • [/font]
    • [font="Arial"][size="2"]Utilities.lib
    [/font]
  • [font="Arial"][size="2"]Base.lib
  • [/font]
  • [font="Arial"][size="2"]Game.lib
  • [/font]

    [size="2"][font="Arial"][size="2"][subheading]Setting up the DLL's[/subheading]

    [/font]

    [size="2"]

    [size="2"][font="Arial"][size="2"]I will explain how to setup one of the lib projects which links to an extern library. Properties for all the other projects can be set in the same way by looking at the dependencies from the previous tutorial

    [/font]

    [size="2"]

    • [font="Arial"][size="2"]Create an Win 32 Project but change the Application Type to DLL and delete all the files except for stdafx.h, stdafx.cpp (For tutorial purposes we will be setting up the Utilities project)
    [/font]
    • [font="Arial"][size="2"]Create a new folder called src and move the above files in there
    [/font]
  • [font="Arial"][size="2"]In the property settings for the project perform the following steps
  • [/font]
    • [font="Arial"][size="2"]For Both Release and Debug Modes
    [/font]
    • [font="Arial"][size="2"]In the tab C/C++ -> General -> Additional Include Directories add
    [/font]
    • [font="Arial"][size="2"]"Includes"
    [/font]
  • [font="Arial"][size="2"]"..\Common\src"
  • [/font]
  • [font="Arial"][size="2"]"..\Base\Includes"
  • [/font]
  • [font="Arial"][size="2"]"..\..\extern\Include""
  • [/font]
  • [font="Arial"][size="2"]For Debug Mode
  • [/font]
      • [font="Arial"][size="2"]In the tab Linker -> General -> Output Directory add
    [/font]
    • [font="Arial"][size="2"]..\..\Debug\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Output File add
  • [/font]
    • [font="Arial"][size="2"]$(OutDir)/$(ProjectName)_D.dll
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Additional Library Directories add
  • [/font]
    • [font="Arial"][size="2"]..\..\Debug\
    [/font]
  • [font="Arial"][size="2"]..\..\extern\Lib\Zlib
  • [/font]
  • [font="Arial"][size="2"]..\..\extern\Lib\TinyXml
  • [/font]
  • [font="Arial"][size="2"]In the tab Linker -> Input -> Additional Dependencies add
  • [/font]
    • [font="Arial"][size="2"]Winmm.lib
    [/font]
  • [font="Arial"][size="2"]tinyxmld.lib
  • [/font]
  • [font="Arial"][size="2"]Base_D.lib
  • [/font]
  • [font="Arial"][size="2"]zlibwapi.lib
  • [/font]
  • [font="Arial"][size="2"]For Release Mode
  • [/font]
    • [font="Arial"][size="2"]In the tab Linker -> General -> Output Directory add
    [/font]
    • [font="Arial"][size="2"]..\..\bin\
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Output File add
  • [/font]
    • [font="Arial"][size="2"]$(OutDir)/$(ProjectName).dll
    [/font]
  • [font="Arial"][size="2"]In the tab Linker -> General -> Additional Library Directories add
  • [/font]
    • [font="Arial"][size="2"]..\..\bin\
    [/font]
  • [font="Arial"][size="2"]..\..\extern\Lib\Zlib
  • [/font]
  • [font="Arial"][size="2"]..\..\extern\Lib\TinyXml
  • [/font]
  • [font="Arial"][size="2"]In the tab Linker -> Input -> Additional Dependencies add
  • [/font]
    • [font="Arial"][size="2"]tinyxml.lib
    [/font]
  • [font="Arial"][size="2"]Winmm.lib
  • [/font]
  • [font="Arial"][size="2"]Base.lib
  • [/font]
  • [font="Arial"][size="2"]zlibwapi.lib
  • [/font]

    [size="2"][font="Arial"][size="2"]Notes:

    [/font]

    [size="2"]

    1. [font="Arial"][size="2"]To point to the directx dir we can use the visual studio macro $(DXSDK_DIR)\Include

    [/font]
  • [font="Arial"][size="2"]I use the suffix _D to distinguish between debug and release builds
  • [/font]
  • [font="Arial"][size="2"]For the most part, only the Include folder should be added in the additional include directories. Exceptions Being GameBase and Game
  • [/font]

    [font="Arial"][size="2"][subheading]Final Thoughts[/subheading]

    [/font]

    [font="Arial"][size="2"]This finishes the initial setup. Since I am not sure, how much detail I should get into of why I setup my projects this way, I will be happy to answer any questions in the comments.

    [/font]

    [size="2"][font="Arial"][size="2"]The next tutorial will deal with the common includes, macros and how to make the debugger check for Memory Leaks

    [/font]cool.gif
    0 likes 0 comments

    Comments

    Nobody has left a comment. You can be the first!
    You must log in to join the conversation.
    Don't have a GameDev.net account? Sign up!
    Profile
    Author
    Advertisement
    Advertisement