1
opts=Options()
2
3
opts.Add(BoolOption('PROFILE', 'Compile with profiling.', 0))
4
opts.Add(BoolOption('USE_ASSERT', 'Compile with assertions', 0))
5
6
env = Environment(options = opts)
7
Help(opts.GenerateHelpText(env))
8
9
# Extra places we need to look for includes
10
env.Append(CPPPATH = ['/opt/local/include', '/usr/local/include'])
11
env.Append(LIBPATH = ['/opt/local/lib', '/usr/local/lib'])
12
13
if ARGUMENTS.get('USE_ASSERT', 0):
14
    env.Append(CCFLAGS = '-DUSE_ASSERT=1')
15
16
env.Append(CCFLAGS = '-g -Wall -Werror')
17
env.Append(LINKFLAGS = '-g')
18
19
if ARGUMENTS.get('PROFILE', 0):
20
    env.Append(CCFLAGS = '-pg')
21
    env.Append(LINKFLAGS = '-pg')
22
else:
23
    # Turn on tons of optimization if we're not profiling.
24
    env.Append(CCFLAGS = '-O3')
25
26
env.conf = Configure(env)
27
28
build_libs=['z']
29
30
if not env.conf.CheckLibWithHeader('boost_regex',
31
                                   'boost/regex.hpp', 'c++'):
32
    if not env.conf.CheckLibWithHeader('boost_regex-mt',
33
                                       'boost/regex.hpp', 'c++'):
34
        print 'Boost regex is required'
35
        Exit(1)
36
    else:
37
        build_libs.append('boost_regex-mt')
38
else:
39
    build_libs.append('boost_regex')
40
41
env = env.conf.Finish()
42
env.Program('logmerge', ['logmerge.cpp', 'logfiles.cpp'], LIBS=build_libs)
43
44
# vim: syntax=python