summaryrefslogtreecommitdiff
path: root/SConstruct
blob: a953bd897390c9864965ab2495ecee3c794ba2d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
AddOption('--release', action = 'store_true')

env = Environment(CPPPATH = ['.'], CCFLAGS = ['-pthread'], LINKFLAGS = ['-pthread'])

if env['PLATFORM'] == 'darwin':
	env.Append(LIBS = ['boost_system', 'boost_filesystem', 'boost_regex', 'boost_thread', 'boost_program_options', 'mp3lame', 'avformat', 'avcodec', 'soci_core'])
else:
	conf = Configure(env)
	boost_libs = ['boost_system', 'boost_filesystem', 'boost_regex','boost_thread', 'boost_program_options']
	if not all([conf.CheckLib(x + '-mt') for x in boost_libs]):
		print('Trying Boost libraries without -mt suffix...')
		if all([conf.CheckLib(x) for x in boost_libs]):
			print('Boost libraries without -mt suffix found, please make sure these are multithread aware.')
		else:
			Exit(1)
	for lib in ['mp3lame']:
		if not conf.CheckLib(lib):
			Exit(1)
	# scons' CheckLib doesn't seem to find soci_core
	if conf.CheckCXXHeader('soci/soci.h'):
		env.Append(LIBS = ['soci_core'])
	env = conf.Finish()
	env.ParseConfig('pkg-config --cflags --libs libavcodec')
	env.ParseConfig('pkg-config --cflags --libs libavformat')

if GetOption('release'):
	env.Append(CCFLAGS = ['-O2'])
else:
	env.Append(CCFLAGS = ['-Wall', '-g'])

env.ParseConfig('pkg-config --cflags --libs libmpg123')
env.ParseConfig('pkg-config --cflags --libs id3tag')
env.ParseConfig('pkg-config --cflags --libs vorbisenc')
env.ParseConfig('pkg-config --cflags --libs libssl')

env.Program('audistd', Glob('*.cpp') + Glob('decoders/*.cpp') + Glob('encoders/*.cpp'))

# vim: syn=python