Visus Zhao
Visus Zhao

Reputation: 1154

In Sconstruct, how can I specify include paths for D programming language

Seems that CPPPATH does not work

env = Environment()
target = 'app'
sources = ['app.d']
libs = ['phobos2', 'pthread', 'm', 'rt']
includes = ['/home/supertool/devel/d/vibe.d/source/vibe']

env.Program(target = target,
        source = sources,
        LIBS = libs,
        CPPPATH = includes);

and when I run scons, it generates compile command:

dmd -I. -c -ofapp.o app.d

includes is not added into -I part

So how can I config this? Is there a INCLUDEPATH ?

Upvotes: 2

Views: 2540

Answers (1)

Brady
Brady

Reputation: 10357

Instead of using the CPPPATH construction variable, for which SCons prepends the -I, you could try manually building the paths, like this:

includePaths = ['-Ipath1', '-Ipath2']
....
env.Program(target = target,
            source = sources,
            LIBS = libs,
            CCFLAGS = includePaths);

But this may lead to the same problem, that CCFLAGS wont be used for D compilation. I havent seen any D-specific construction variables other than DSUFFIXES

EDIT: Looks like DFLAGS and DPATH are not documented

I was playing around with this on my machine and see that CCFLAGS wont work for D, but DFLAGS and DPATH do, and they're not documented :( DPATH will have "I" prepended at compile time, so it is analogous to CPPPATH

There has been talk on the SCons user mail list about beefing up the SCons D support.

Upvotes: 5

Related Questions