garyo edited this page Dec 13, 2014 · 1 revision

If you want to add additional compile flags, try this:

import glob

#assumes project name is the build directory name is the executable name...

project = 'myprogram'      #holds project name
buildroot = '../debug'     #holds root of the build directory tree
cflags = ['-W1', '-GX']    #some additional compile flags

#From here on will be common to all projects

builddir = buildroot + '/' + project   #holds build directory name
targetpath = builddir + '/' + project  #holds path to executable in the build directory

env = Environment()

#if cflags is defined, don't anything, otherwise append 
#the user's compile flags to the current compile flags
try: cflags
except NameError: pass
else: env.Append(CCFLAGS=cflags)

#set up the build directory
BuildDir('#' + builddir, "#.", duplicate=0)

env.Program(targetpath, source=map(lambda x: '#' + builddir + '/' + x, glob.glob('*.cpp')))
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.