Scons: src and include dirs

can someone give a scons configuration file that allows the following structure

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

at the top level. I want o and final exe.

+5
source share
3 answers
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'))

It worked. Thanks.

+4
source

Here is one example of a 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'))

(In this example, the environment string is not needed, but I need to include the non-standard glib header path and leave it there so that you can understand how to add additional attachments and defines)

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

+8
source

This question: fooobar.com/questions/360459 / ... gives a fairly flexible scons skeleton that should satisfy your needs with a few settings for path variables.

+4
source

All Articles