Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scons : src and include dirs

Tags:

python

scons

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.

like image 384
RichieHH Avatar asked Nov 19 '08 18:11

RichieHH


3 Answers

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.

like image 51
Amit Avatar answered Oct 03 '22 04:10

Amit


This question: https://stackoverflow.com/questions/279860/... gives a pretty flexible scons skeleton which should serve your needs with a few tweaks to the path variables.

like image 36
Andrew Beyer Avatar answered Oct 05 '22 04:10

Andrew Beyer


env=Environment(CPPPATH='/usr/include/glib-2.0/:/usr/lib/glib-2.0/include:include',
                CPPDEFINES=[],
                LIBS=['glib-2.0']) 

if ARGUMENTS.get('debug', 0):
    env.Append(CCFLAGS = ' -g')

env.Program('template', Glob('src/*.cc'))

Worked a treat. Thanks.

like image 30
RichieHH Avatar answered Oct 04 '22 04:10

RichieHH