Ok I am writing a library that will be shard between unix and windows. I work with unix all day so the layout of the code is no problem. It is how I present this to a windows guys using VS2008.
Its been a really long time since I did windows dev (cough 3.1) so way out of touch.
I noticed VS2008 creates lots of directories and sub-directories (all of which seem undeeded).
Ok so onto the real question – I think cmake seems a nice easy portable solution – but what about instructions for the windows guys to include the library.
Unix guys know by command line how to add a library – but when you add an IDE it all gets (overly) complicated to me
So the meat of the question is how to provide/layout dir struct for a shared unix/windows library from the point of view of a die hard unix guy
The IDEs are frustrating as hell to use, but it is “expected” of you. 🙂 I find that I just create a “win32/” directory, in which the VC++ project files and directories go, in whatever manner the IDE wants to put them. In the project, I add the files in src/, the same as Unix. At least the IDE will refer to them with relative paths, so it tends to work out.
As for the code itself, using #if HAVE_UNISTD_H around #include <unistd.h> etc, has been very helpful, and in the Windows compile, I tend do have one “win32.h” file that does the porting need.
It gets a little ugly in win32.h, with the preprocessor calls for “strcase* -> stri*” and win32 versions of
opendiretc. But I prefer that myself, as I personally do not want the bulk of the code be littered with #ifdef WIN32. I only boot Windows to compile, not to dev.I will say that I did the Win32 IDE work with the idea that people could compile my apps themselves. This has never happened, and they ask me to compile newer versions. Which is the opposite to Unix world.