hammer/SConstruct

43 lines
1.1 KiB
Text
Raw Normal View History

2013-07-11 23:44:28 +02:00
# -*- python -*-
import os
2013-10-28 09:35:44 -04:00
import os.path
env = Environment(ENV = {'PATH' : os.environ['PATH']})
2013-10-28 09:35:44 -04:00
env.MergeFlags("-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -lrt")
AddOption("--variant",
dest="variant",
nargs=1, type="choice",
choices=["debug", "opt"],
2013-07-10 21:32:05 +02:00
default="opt",
action="store",
help="Build variant (debug or opt)")
env['BUILDDIR'] = 'build/$VARIANT'
dbg = env.Clone(VARIANT='debug')
dbg.Append(CCFLAGS=['-g'])
opt = env.Clone(VARIANT='opt')
opt.Append(CCFLAGS="-O3")
if GetOption("variant") == 'debug':
env = dbg
else:
env = opt
2013-07-11 23:44:28 +02:00
if os.getenv("CC") == "clang":
env.Replace(CC="clang",
CXX="clang++")
2013-09-12 10:39:50 -07:00
#rootpath = env['ROOTPATH'] = os.path.abspath('.')
#env.Append(CPPPATH=os.path.join('#', "hammer"))
Export('env')
2013-09-12 10:39:50 -07:00
env.SConscript(["src/SConscript"], variant_dir='build/$VARIANT/src')
env.SConscript(["examples/SConscript"], variant_dir='build/$VARIANT/examples')
2013-07-10 21:32:05 +02:00
2013-07-11 23:44:28 +02:00
env.Command('test', 'build/$VARIANT/src/test_suite', 'env LD_LIBRARY_PATH=build/$VARIANT/src $SOURCE')