Make [was Re: SCons and gdc]

Rob T rob at ucora.com
Tue Oct 23 16:49:45 PDT 2012


I may be getting messed up by the way modules map directly to 
folder structures, and how to separate an interface from the 
implementation.

Eg. import A.m1;

I understand that the above import requires that a folder "A" be 
found at the root level of the source folder (where ever it may 
be), and module m1.d must be located directly in A. So far so 
good, however A may be located in a folder outside of the current 
project. For example, the std lib imports are located outside you 
projects root folder (this is a goal to acheive what I want to 
reproduce with my own D prebuilt libraries).

When I try to import from another project located in another set 
of folders, how do I tell the compiler to start looking at a 
certain point?

For example

/projects/
      /p1
          /src
              /A
              /B
              /C

      /p2
          /src
              /D
              /E
              /F

With the above folder structiure, how can I get this to work?

import A.m1;
import D.m2;

I may be able to manually get something to work, but how can it 
be automated with scons? I know I'll have to manually supply the 
project search paths somehow, but will scons be able to figure 
out that "import D.m2;" means to look under /projects/p2/src/D/?

Also if I make an edit to D/m2.d will scons be able to figure out 
that D/m2.d needs to be rebuilt and/or that all files that import 
D/m2.d must be rebuilt?

In C/C++ full rebuilding is only required when header files (.h) 
are modified and included, not when the implementation is 
modified. How do we make the distinction between the interface 
and the implementation in D?

Perhaps I should be building interface files (.di), how is that 
done and how do you refer to them after they are built?

Finally how do you specify an alternate folder for dumping the 
build stuff to separate it from being dumped into your source 
folders? Also how to you specify an installation folder, eg 
/usr/local/bin along with location of necessary import folders. I 
definitely do not want to install full source code so that 
imports will work, so I assume the .di files are installed 
instead.

I know I'm asking a lot of basic questions which means I havn't 
much clue how to build D apps yet, so are there any good examples 
or documentation I can look at that will supply me with the 
answers?

ps: I'm an experienced C++ programmer, so the tendancy is to 
replicate the same practice, however I'm definietly open to 
better ways that make the most out of D.

Thanks for any help you gave give!

--rt



More information about the Digitalmars-d mailing list