everything's working for new-build except Clean()

This commit is contained in:
Meredith L. Patterson 2013-11-26 15:29:28 -08:00
parent ef235136d9
commit f21954eecd
3 changed files with 37 additions and 20 deletions

View file

@ -1,7 +1,6 @@
# -*- python -*-
Import('env')
bindings = ['python']
import os.path
Import('env testruns')
dist_headers = [
"hammer.h",
@ -62,15 +61,16 @@ misc_hammer_parts = [
'registry.c',
'system_allocator.c']
tests = ['t_benchmark.c',
't_bitreader.c',
't_bitwriter.c',
't_parser.c',
't_grammar.c',
't_misc.c']
ctests = ['t_benchmark.c',
't_bitreader.c',
't_bitwriter.c',
't_parser.c',
't_grammar.c',
't_misc.c']
libhammer_shared = env.SharedLibrary('hammer', parsers + backends + misc_hammer_parts)
libhammer_static = env.StaticLibrary('hammer', parsers + backends + misc_hammer_parts)
Default(libhammer_shared, libhammer_static)
env.Install("$libpath", [libhammer_static, libhammer_shared])
env.Install("$incpath", dist_headers)
@ -81,9 +81,12 @@ env.Install("$pkgconfigpath", "../../../libhammer.pc")
testenv = env.Clone()
testenv.ParseConfig('pkg-config --cflags --libs glib-2.0')
testenv.Append(LIBS=['hammer'], LIBPATH=['.'])
testenv.Program('test_suite', tests + ['test_suite.c'])
ctestexec = testenv.Program('test_suite', ctests + ['test_suite.c'])
ctest = Alias('testc', [ctestexec], "".join(["env LD_LIBRARY_PATH=", os.path.dirname(ctestexec[0].path), " ", ctestexec[0].path]))
AlwaysBuild(ctest)
testruns.append(ctest)
Export("libhammer_static libhammer_shared")
for b in bindings:
for b in env['bindings']:
env.SConscript(["bindings/%s/SConscript" % b])

View file

@ -1,11 +1,12 @@
# -*- python -*-
import os.path
Import('env libhammer_shared')
import os, os.path
Import('env libhammer_shared testruns')
pythonenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
pythonenv.Append(CPPPATH = ['../../', '/usr/include/python2.7'])
pythonenv.Append(CPPPATH = ['../../'])
pythonenv.Append(CCFLAGS = ['-fpic', '-DSWIG', '-Wno-all', '-Wno-extra', '-Wno-error'])
pythonenv.ParseConfig("pkg-config --cflags python")
pythonenv.Append(LIBS = ['hammer'])
pythonenv.Append(LIBPATH = ['../../'])
pythonenv.Append(SWIGFLAGS = ['-DHAMMER_INTERNAL__NO_STDARG_H', '-Isrc/', '-python'])
@ -15,9 +16,13 @@ pythonenv.Command("hammer.i", "../swig/hammer.i", Copy("$TARGET", "$SOURCE"))
swig = ['hammer.i']
libhammer_python = pythonenv.SharedLibrary('hammer', swig, SHLIBPREFIX='_')
Default(libhammer_python)
pytestenv = pythonenv.Clone()
pytestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
pytestenv.Command(None, ['hammer_tests.py'] + libhammer_python, "nosetests -vv $SOURCE")
pytestexec = pytestenv.Command(None, ['hammer_tests.py'] + libhammer_python, "nosetests -vv $SOURCE")
pytest = Alias("testpython", [pytestexec], pytestexec)
AlwaysBuild(pytest)
testruns.append(pytest)
Clean('.', ['hammer.pyc', 'hammer_tests.py', 'hammer_tests.pyc'])