Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I was wondering what is the best way to organize my source code. I was researching on SO and found http://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 ?
share|improve this question
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 Mar 28 '13 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 Mar 28 '13 at 12:39
add comment

migrated from stackoverflow.com Mar 28 '13 at 11:18

This question came from our site for professional and enthusiast programmers.

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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