1import os, sys
2
3env = Environment()
4debug = False
5
6sdl_cflags = env.ParseFlags('!pkg-config --cflags sdl')
7sdl_libs = env.ParseFlags('!pkg-config --libs sdl')
8
9env.MergeFlags(sdl_cflags)
10env.MergeFlags(sdl_libs)
11
12lib_dir = '.'
13have_sse = False
14#have_sse = True
15#debug = True
16debug = False
17prefix = ''
18
19Export('sdl_cflags')
20Export('sdl_libs')
21Export('lib_dir')
22Export('have_sse')
23Export('env')
24Export('debug')
25env['prefix'] = ''
26
27env.Append(LIBPATH=['.'])
28env.Append(CPPDEFINES=['DEBUG', '_REENTRANT'])
29if have_sse:
30	env.Append(CPPDEFINES=['CLUNK_USES_SSE'])
31
32if debug:
33	buildmode = 'debug'
34	env.Append(CXXFLAGS=['-ggdb'])
35else:
36	buildmode = 'release'
37	env.Append(CXXFLAGS=['-O3', '-mtune=native', '-march=native'])
38
39clunk_src = [
40	'context.cpp', 'sample.cpp', 'object.cpp', 'source.cpp', 'sdl_ex.cpp', 'stream.cpp',
41	'kemar.c', 'buffer.cpp', 'distance_model.cpp', 'logger.cpp', 'clunk_ex.cpp', 'clunk_c.cpp'
42]
43if have_sse:
44	clunk_src.append('sse_fft_context.cpp')
45
46clunk = env.SharedLibrary('clunk',
47	clunk_src,
48	LIBS=['SDL'])
49
50
51if sys.platform != 'win32':
52	env.Append(CFLAGS=['-Wall', '-pedantic'])
53	env.Append(CXXFLAGS=['-Wall', '-pedantic'])
54	env.Append(LINKFLAGS=['-Wl,-rpath,'+ lib_dir])
55	env.Append(LINKFLAGS=['-Wl,-rpath-link,.'])
56
57env.Program('clunk_test', ['test.cpp'], LIBS=['clunk'])
58env.Program('clunk_c_test', ['test_c.c'], LIBS=['clunk'])
59