Best folder structure for C++ cross-platform library and bindings
Solution 1:
The structure looks good to me, but there are a few points:
- it's normal to separate C++ header and source files into different directories, or maybe there is structure in the modules directory you are not showing?
- you probably want directories to put intermediate files like *.obj in
- you will need different directories for debug and release output files
- a directory for installers like InnoSetup and their install files can be useful - you have to make the philosphical decision about whether to version control these
As for tools to create the structure, a few minutes spent writing a bash script is all you need - it's worth having the same tools (like bash) available on all platforms.
Solution 2:
Why you need different platform folders for binary files? You going to build this source code under different platoforms but with same file system?
If yes, I think you need compiller specific folders too.
Why you don't use different folders for debug and release build, maybe unicode and non-unicode, single-threading or multithreading builds?
Look on bjam or Scons make replacers. Maybe you don't need different folders in build directory.
I think it will be better if all modules from "modules" directory will contain "tests" directory for test self.
And last - see boost library, this platofrm independed library which have nice structure.
Also try to get ideas from antother platform independed projects.
Boost folders structure:
boost - root dir
- boost - library header lib ( for users )
- libs - library source dir ( one dir per lib )
- build - library build files ( if they are needed )
- doc - documentation files
- example - sample programs
- src - library source files
- test - programs and srcipts for testing module
- bin - created by bjam build system
- libs
- <lib-name>
for all compiled folders from libs [example|test|build]
- <compiler-name>/<[static|dynamic]-link>/<[debug|release]>/<[threading mode]>
contain builded [obj|dll|lib|pdb|so|o|etc] files see detailed information in bjam build system
- doc
- tools
If you choose bjam - you will not be concerned on build and bin folders structure.
Also your libs/src/ dir could contain own for all platform files and couple dirs for platform spcific files.
I don't see any serious problems in your folders structre, maybe you will see them when start write project prototype.
Solution 3:
I recently posted a question about packaging headers in just one directory, decided to go with a small number of include directories.
Are you going to cater for Win64? That will be an increasingly important target.
Do not put your build intermediate files anywhere under a tree being checked into svn. If you do so, depending on your svn client tools, they will generate a lot of noise as files which are not in the repository. That makes it hard to see files you've added that should be in the repository.
Instead, if your compiler allows it, put the intermediate directories off to one side.
Otherwise, make sure you add the entire intermediate directories to your svn exclusion properties. Some GUI's make that easier than others (Tortoise on Windows, Cornerstone or Versions on OS/X).