hammer/src/SConscript

122 lines
3.2 KiB
Text
Raw Normal View History

2013-07-10 21:32:05 +02:00
# -*- python -*-
import os.path
Import('env testruns')
2013-09-12 10:39:50 -07:00
2013-10-29 17:35:37 -04:00
dist_headers = [
'hammer.h',
'allocator.h',
'compiler_specifics.h',
'glue.h',
'internal.h',
'platform.h'
]
parsers_headers = [
'parsers/parser_internal.h'
]
backends_headers = [
'backends/regex.h',
'backends/contextfree.h'
2013-10-29 17:35:37 -04:00
]
parsers = ['parsers/%s.c'%s for s in
['action',
'and',
'attr_bool',
2015-01-23 18:59:30 +01:00
'bind',
'bits',
'butnot',
'ch',
'charset',
'choice',
'difference',
'end',
2014-05-07 19:24:26 +02:00
'endianness',
'epsilon',
'ignore',
'ignoreseq',
'indirect',
'int_range',
'many',
'not',
'nothing',
'optional',
2014-06-18 21:54:52 +02:00
'permutation',
'sequence',
'token',
'unimplemented',
'whitespace',
2014-05-12 09:45:22 +02:00
'xor',
'value']]
backends = ['backends/%s.c' % s for s in
2013-07-10 21:32:05 +02:00
['packrat', 'llk', 'regex', 'glr', 'lalr', 'lr', 'lr0']]
misc_hammer_parts = [
'allocator.c',
'benchmark.c',
'bitreader.c',
'bitwriter.c',
'cfgrammar.c',
'datastructures.c',
'desugar.c',
'glue.c',
'hammer.c',
'pprint.c',
2013-11-19 21:14:39 -06:00
'registry.c',
'system_allocator.c']
if env['PLATFORM'] == 'win32':
misc_hammer_parts += [
'platform_win32.c',
'tsearch.c',
]
else:
misc_hammer_parts += ['platform_bsdlike.c']
ctests = ['t_benchmark.c',
't_bitreader.c',
't_bitwriter.c',
't_parser.c',
't_grammar.c',
't_misc.c',
't_regression.c']
static_library_name = 'hammer'
build_shared_library=True
if env['PLATFORM'] == 'win32':
build_shared_library=False # symbols in hammer are not exported yet, this shared lib would be useless
static_library_name = 'hammer_s' # prevent collision between .lib from dll and .lib for static lib
2013-09-12 10:39:50 -07:00
libhammer_shared = env.SharedLibrary('hammer', parsers + backends + misc_hammer_parts)
libhammer_static = env.StaticLibrary(static_library_name, parsers + backends + misc_hammer_parts)
if build_shared_library:
Default(libhammer_shared, libhammer_static)
env.Install('$libpath', [libhammer_static, libhammer_shared])
else:
Default(libhammer_static)
env.Install('$libpath', [libhammer_static])
2013-09-12 10:39:50 -07:00
env.Install('$incpath', dist_headers)
env.Install('$parsersincpath', parsers_headers)
env.Install('$backendsincpath', backends_headers)
env.Install('$pkgconfigpath', '../../../libhammer.pc')
if GetOption('with_tests'):
testenv = env.Clone()
testenv.ParseConfig('pkg-config --cflags --libs glib-2.0')
testenv.Append(LIBS=['hammer'])
testenv.Prepend(LIBPATH=['.'])
ctestexec = testenv.Program('test_suite', ctests + ['test_suite.c'], LINKFLAGS='--coverage' if testenv.GetOption('coverage') else None)
ctest = Alias('testc', [ctestexec], ''.join(['env LD_LIBRARY_PATH=', os.path.dirname(ctestexec[0].path), ' ', ctestexec[0].path]))
AlwaysBuild(ctest)
testruns.append(ctest)
2013-10-29 17:35:37 -04:00
Export('libhammer_static libhammer_shared')
2013-09-12 10:39:50 -07:00
for b in env['bindings']:
env.SConscript(['bindings/%s/SConscript' % b])