www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Do you have any suggestions for project directory structure?

reply "Orfeo" <orfeo.davia gmail.com> writes:
Suppose I have a project "protocols" that uses DMock and a  
library Foo.
I would like to use a structure dub style..Which solution is 
better:

A.

protocols
  ├── bin
  │   └── protocols.a
  ├── dmocks
  │   └── *.d
  ├── foo
  │   └── *.d
  ├── src
  │   └── protocols
  │       └── *.d

B.

protocols
  ├── bin
  │   └── protocols.a
  ├── src
  │   ├── dmocks
  │   │    └── *.d
  │   ├── foo
  │   │    └── *.d
  │   └── protocols
  │        └── *.d


Or another solution?
Thanks
Feb 05 2014
next sibling parent reply "Dicebot" <public dicebot.lv> writes:
I'd try to keep external libraries out of the main source 
directory or as part of separate git submodule hierarchy if using 
stuff like dub is not an option. They don't belong to project 
sources.
Feb 05 2014
parent reply "Orfeo" <orfeo.davia gmail.com> writes:
On Wednesday, 5 February 2014 at 21:54:15 UTC, Dicebot wrote:
 I'd try to keep external libraries out of the main source [cut]
Something like this? ├── protocols │ └── src ├── dmocks │ └── *.d ├── foo │ └── *.d
Feb 05 2014
parent "Dicebot" <public dicebot.lv> writes:
On Wednesday, 5 February 2014 at 22:01:08 UTC, Orfeo wrote:
 On Wednesday, 5 February 2014 at 21:54:15 UTC, Dicebot wrote:
 I'd try to keep external libraries out of the main source [cut]
Something like this? ├── protocols │ └── src ├── dmocks │ └── *.d ├── foo │ └── *.d
Yes. And make sure build script for your project allows to define path to external import folder(s). dub automates that for you
Feb 05 2014
prev sibling next sibling parent "Chris Williams" <yoreanon-chrisw yahoo.co.jp> writes:
On Wednesday, 5 February 2014 at 21:50:17 UTC, Orfeo wrote:
 Suppose I have a project "protocols" that uses DMock and a  
 library Foo.
 I would like to use a structure dub style..Which solution is 
 better:

 A.

 protocols
  ├── bin
  │   └── protocols.a
  ├── dmocks
  │   └── *.d
  ├── foo
  │   └── *.d
  ├── src
  │   └── protocols
  │       └── *.d

 B.

 protocols
  ├── bin
  │   └── protocols.a
  ├── src
  │   ├── dmocks
  │   │    └── *.d
  │   ├── foo
  │   │    └── *.d
  │   └── protocols
  │        └── *.d


 Or another solution?
 Thanks
I would probably advise against having the outside libraries inside your project at all. Have them parallel to protocols either add a /lib folder to protocols that can hold their binaries or pull from the outside (you'll need to point your includes outside your own project anyways).
Feb 05 2014
prev sibling parent "Jesse Phillips" <Jesse.K.Phillips+D gmail.com> writes:
I'm not sure I would recommend this, but I've been using 
something like this:

  protocols
   ├── dmocks (I don't use this)
   │   └── *.d
   ├── libs
   │   └──foo
   │       └── *.d
   │   └── bar
   │       └── source
   │             └── *.d
   │
   ├── source
   │   └── protocols
   │       └── *.d

The libraries can actually have dependencies on other libraries, 
in this case bar requires foo and will expect to find ../foo
Feb 05 2014