Jump to content
  • Advertisement
Thomas Izzo

C++ Folder Organization Methods

Recommended Posts

Hi there,

I'm currently working on a C++ project in Visual Studio and trying to organize my folders in a clean and effective manner. My current organization looks like the following:

 

->external (external compiled and source libraries)

-> source (source code written by me)

-> resources (images, music, etc.)

-> visual studio (directory with visual studio folder)

 

I'm curious to see how you guys organize your folders. 

Share this post


Link to post
Share on other sites
Advertisement

Hello,

it depends on scale of the project - for one of the big ones I'm currently having - full featured game engine with editor (it actually builds multiple libraries and multiple executables - engine editor, runtime, etc.):

- Bin64 (binary output)
- Data (resources - models, textures, scripts, shaders, etc. - I generally live monitor (in editor) only folders under this)
- Dependencies (3rd party dependencies)
- Lib (dynamically loaded libraries (mainly plugins, etc.))
- Source (under this only source files, divided into projects, and for more complex ones even further)
- Projects (Visual studio project files/Makefiles)

for small projects I sometimes tend to dump them in single directory (refactoring once they get bigger).

Share this post


Link to post
Share on other sites

Here are some more directories that could be useful:

- Docs - documentation (also for your future self)
- Raw - source files for creating assets (photoshop files etc.)
- Backup - quick backup for deleted code and other obsolete stuff
- Tools - editors, shell scripts etc.
- Dist - place to build your distribution

Personally I'm not fond of deeply nested directory structures.

Share this post


Link to post
Share on other sites
Posted (edited)

There is a workspace in my ~ with projects as main directories. Inside of them:

  • Debug (IDE's default for binaries with debug information)
  • Release (IDE's default for optimized binaries. Unused :-))
  • Extern (3rd party dependencies source and headers)
  • Source (tree containing project's source files and headers, shaders)
  • Resources (textures and the like)
  • Utils (project related stand alone routines. Conversions for example)

Documentation is still missing. Will probably do inline. I too am not very fond of a single Source directory as it grows and grows, contains my framework as well as the tinkering that runs in it. Also i am not very fond of all that stuff the IDE brings with it. One day i'll ditch the IDE. I am just too lazy ...

Edited by Green_Baron

Share this post


Link to post
Share on other sites
Posted (edited)

I build the project from batch files, but it think it's not so important... here's how I structure my projects:

-build: here goes all the crap like debug files, executable for debugging, dll's etc. I go here when I want to debug the application.

-code: just the source code.

-assets: all the data that the application needs.

-release: this is where I put the "final product". With the help of some script I can pack everything I need and slam it in a folder here that will be like "ProjectX_0.0.1".

 

-I also have an "app" folder that contains all the external tools I use, like editor, command line scripts etc but that is one level up relative to the single "project".

-I also have an "external" folder, (one level up relative to the single project folder as well): for example I have external/SDL that contains all the sdl stuff, and I can grab it in every project I want.

 

Hope this helps :)

Edited by erpeo93

Share this post


Link to post
Share on other sites

Our SDK has some more folders in it, some static ones but most are generated from the build tool and package manager. Our package addressing requires a directory tree of no more than 3 sub-directories to find the project folder.

Static Folders

  • Config contains a sub-driectory for every tool we have that stores any kind configuration
  • Source is the root folder for everything project related. It contains a sub-directory Modules that contains the engine source code in separate module fodlers
  • Tools is the root fodler for everything tooling related. It contains a sub-directory Modules that contains the framework source code for tools in separate module fodlers

Generated Folders

  • .build is the hidden cache directory for compiled object files
  • .cache is the hidden directory for any tool to cache data in a sub-folder named like the tool
  • Deploy is the public directory for anything resulting from a build. There are sub-directories for every system/category like Engine, Editor, Tools but also Analytics

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!