scons : src and include dirs

怎甘沉沦 提交于 2019-12-03 15:31:41

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.

Andrew Beyer

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.

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!