Search code examples
open-sourcedirectory-structure

How to manage directory structure of a project that uses third-party open source library?


I develope an open source application. Directory structure of my project is:

app
|-include
|-src
|-doc
|-build
|-lib
|-bin

I want to use another open source library. There are some choises:

  • Add third-party library source code to include and src directory.
  • Compile third-party library and add to include and lib directory.
  • Create a third_party directory and add complete source code of third-party library to it.
  • Create a third_party directory and add compiled of third-party library to it.

What is the best choise? Is there any better way to manage directory structure of a project that uses third-party open source library?


Solution

    • If you are ever planning to upgrade the third-party library, it will be much more convenient to keep it in a specific subdirectory. You don't have to have a specific "third-party" directory; you could name it after the library.

    • Think about what goes in version control.

      • If you are copying the third-party library into your repository, then you SHOULD NOT include compiled products (using source instead), as they are typically impossible to diff and platform-specific.
      • If the user is going to obtain the library separately and add it to your project's tree, then using a subdirectory will make it easier to unarchive and guarantee there won't be any name conflicts; source versus binary should be left up to the user.
      • At the other extreme, if you are using a reference your VCS manages (such as SVN externals or Git submodules), you will probably have to include the source in a subdirectory.