scons : src and include dirs

RichieHH picture RichieHH · Nov 19, 2008 · Viewed 9.1k times · Source

can someone give a scons config file which allows the following structure

toplevel/
        /src - .cc files
        /include .h files

at top level I want the o and final exe.

Answer

Amit picture Amit · Nov 19, 2008

Here is one example of Sconscript file

env=Environment(CPPPATH='/usr/include/glib-2.0/:/usr/lib/glib-2.0/include:inc',
                CPPDEFINES=[],
                LIBS=['glib-2.0']) 
env.Program('runme', Glob('src/*.c'))

(The environment line is not really necessary for the example, but I have it to include the non standard glib header path and left it there so you can get the idea how to add extra includes and defines)

The source files are in src directory and header files in inc directory. You run scons from the base directory and the output file is also generated in the same directory.