3

I was wondering what is the best way to organize my source code. I was researching on SO and found https://stackoverflow.com/a/1398594/137261 but this source code layout is library specific and doesn't cover my situation.

My situation:

  • 10 own modules (100k lines of code)
  • 15 external libraries (e.g. boost, sqlite, zlib, etc.)
  • 2 critical modules have to be available for selected developers only (maybe separate git repos ?)
  • project is multiplatform (Linux and Windows)
  • Git as version control system
  • cmake used to build project

Question:

  • does it make sense to incorporate all libraries into my project e.g. in _3rd_party_libs_ folder ?
  • how to handle lib include paths in my modules (environmental variable, relative paths, git submodules, etc. ) ?
  • should I always build external libs from source or just use their binaries ?
2
  • 1
    Hi tommyk, your question was migrated to Programmers where it is more appropriate, so there was no need to post a duplicate question. We discourage cross posting across stackexchange sites, so if you feel you posted your question on the wrong site then flag for a moderator and we will look into migrating it for you. Thank you.
    – maple_shaft
    Commented Mar 28, 2013 at 12:09
  • @maple_shaft Sorry for that, I took quite a while until the question has been migrated so I though my migration request has been ignored (what already happened in the past).
    – tommyk
    Commented Mar 28, 2013 at 12:39

1 Answer 1

4

does it make sense to incorporate all libraries into my project e.g. in _3rd_party_libs_ folder ?

Do whatever you want, but keep it consistent. I do note that you've listed examples such as boost/sqlite; these should be standard in your dev environments and not included in your project, unless you depend on say some funny version of boost.

how to handle lib include paths in my modules (environmental variable, relative paths, git submodules, etc. ) ?

This is what your build system - CMake - is for. Your source code just has #include <third_party_lib.h> without worrying about where they are located.

should I always build external libs from source or just used their binaries ?

Prefer binaries by default, unless you have a good reason to build from source every time.

Not the answer you're looking for? Browse other questions tagged or ask your own question.