Skip to content

Commit

Permalink
Refactor sample build and add --without-samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jonforums committed Nov 27, 2011
1 parent 6e5d5e3 commit 6e40a35
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
11 changes: 11 additions & 0 deletions samples/wscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
def build(bld):

bld.program(
source = [ 'mem_alloc.cpp' ],
includes = [ '../include' ],
target = 'mem_alloc',
cxxflags = [ '-Wall', '-O3', '-g' ],
linkflags = '-s',
)

# vim: ft=python ai ts=4 sw=4 sts=4 et
13 changes: 6 additions & 7 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ out = 'build'

def options(opts):
opts.load('compiler_cxx')
opts.add_option('--without-samples', action='store_true', default=False,
help='do not build samples')

def configure(conf):
conf.load('compiler_cxx')

conf.env.SAMPLES = not conf.options.without_samples

# override gcc defaults normally stored in _cache.py
conf.env.SHLIB_MARKER = '' # '-Wl,-Bdynamic'
conf.env.STLIB_MARKER = '' # '-Wl,-Bstatic'
Expand All @@ -40,13 +44,8 @@ def build(bld):
)

# build samples
bld.program(
source = [ 'samples/mem_alloc.cpp' ],
includes = [ 'include' ],
target = 'mem_alloc',
cxxflags = [ '-Wall', '-O3', '-g' ],
linkflags = '-s',
)
if bld.env.SAMPLES == True:
bld.recurse('samples')

# helper functions
def _prepare(args):
Expand Down

0 comments on commit 6e40a35

Please sign in to comment.