title: How organize opensource C++ project with IDE to share it on github
body: <p>I would like to know (according to <a href="https://en.wikipedia.org/wiki/Principle_of_least_astonishment" rel="nofollow noreferrer">Principle of Least Surprise</a>) how to organize C++ project with tradeoffs, for example, so that it can be easily shared over <code>git</code> (e.g. on github), or make it easy for anybody who is interested to import the source files into his environment.</p>
  
  <p>As an example I would refer to <code>Code::Blocks</code> since I currently starting to use it, but the question should be more general for any IDE. </p>
  
  <hr>
  
  <p><strong>How I currently do:</strong></p>
  
  <p>I have directory structure like this ( dictionaries starts with <code>/</code>, comment with <code>//</code> ):</p>
  
  <pre><code>/.git             // git repo metadata
  /common           // source code shared between projects
     /math
     /physics
     /GraphicsUtils
  /common_data      // shared data (resources)
  /apps             // executable projects ( use cases )
     /SailWar       // game about fighting sail boats
     /AirCraftSimulator
     /SpaceShipSimulator
  /libs             // dynamic library projects
     /OrbitalMechanics
  </code></pre>
  
  <p>In each project folder for particular executable program I have this structure:</p>
  
  <pre><code>/SailWar
    /bin         // CodeBlocks binary output
    /data        // my datafiles (resources) required for program to run
    /src         // my source code
    /obj         // CodeBlocks compiled objects files
    main.cpp  
    makefile    
    program.x       // binary
    SailWar.cbp     // CodeBlocks project file
    SailWar.depend  // CodeBlocks .depend
    SailWar.layout  // CodeBlocks .layout
    test            // bash script to make clean, make and run the binary
  </code></pre>
  
  <p>In <code>.git/info/exclude</code> I have:</p>
  
  <p><code>*~  *.pyc  *.o  *.a  *.so  *.x   bin   obj   .depend   .layout</code></p>
  
  <p>to make sure that only source files ( not the output and temporary files ) are uploaded to <code>github</code></p>
  
  <hr>
  
  <p><strong>What I'm not happy with / sure about:</strong></p>
  
  <ol>
  <li>Should I keep ( track ) <code>.depend   .layout</code> in git ?</li>
  <li>Is <code>CodeBlocks</code> project <code>.cbp</code> protable and genral enought or I have to still keep the <code>makefile</code> way of compilation. Best would be if CodeBlocks can use makefile instead of <code>.cbp</code></li>
  <li>when compiled binary is put to <code>/bin</code> it does not have correct path to <code>/data</code></li>
  <li>I'm not exactly sure how to best connect shared code <code>/common</code> and resources <code>/common_data</code>. Currently I put <code>../../common</code> into compiler search paths ... but I'm not sure if it is the best way. </li>
  <li>I would probably prefer to make a single project file for everything (all executables, all libraries in one). I think it would make it more clear for any potential user who download it from <code>github</code>. But that is probably not possible (?) (I was reading <a href="https://stackoverflow.com/questions/8411905/codeblocks-single-project-many-executables">this question</a> about that.)  </li>
  </ol>