Attempt to fix the IPv4/IPv6 problems once and for all
[deb_shairplay.git] / src / SConscript
CommitLineData
112f0c66
JVH
1Import('env')
2
3files = [Glob('lib/*.c'),Glob('lib/alac/*.c'),Glob('lib/crypto/*.c')]
4
5env.Append(CPPPATH = ['include'])
6
7# Set up the environment for compiling the libraries
8libenv = env.Clone()
9libenv.Append(CPPPATH = ['lib'])
10
11# Make sure libraries are compiled with DLL_EXPORT on windows
12if libenv['PLATFORM'] == 'win32' or GetOption('mingw32') or GetOption('mingw64'):
13 libenv.Append(CPPDEFINES = ['DLL_EXPORT'])
14
15# Prepare the libobj and shlibobj object files
16libobj = libenv.Object(files)
17if libenv['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME']:
18 shlibobj = libobj
19else:
20 shlibobj = libenv.SharedObject(files)
21
22# Compile the static library into lib directory and shared library
23# for the bindings
24if not libenv['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME']:
4a381420
JVH
25 libenv.Library('shairplay', libobj, install=False)
26libenv.SharedLibrary('shairplay', shlibobj, install=False)
112f0c66
JVH
27
28# If we want to create universal binaries of the dynamic library on Mac, do it here
29if GetOption('universal'):
30 libenv["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = "10.4"
31 libenv.Append(CFLAGS = ['-arch', 'i386', '-arch', 'x86_64'])
32 libenv32 = libenv.Clone()
33 libenv64 = libenv.Clone()
34
35 libenv32.Append(LINKFLAGS = ['-undefined', 'dynamic_lookup'])
36 libenv32.Append(LINKFLAGS = ['-arch', 'i386'])
4a381420
JVH
37 libenv32.Append(LINKFLAGS = ['-install_name', 'libshairplay32.dylib'])
38 libenv32.SharedLibrary('shairplay32', shlibobj, install=False)
112f0c66
JVH
39
40 libenv64.Append(LINKFLAGS = ['-undefined', 'dynamic_lookup'])
41 libenv64.Append(LINKFLAGS = ['-arch', 'x86_64'])
4a381420
JVH
42 libenv64.Append(LINKFLAGS = ['-install_name', 'libshairplay64.dylib'])
43 libenv64.SharedLibrary('shairplay64', shlibobj, install=False)
112f0c66
JVH
44
45 libenv.Append(LINKFLAGS = ['-undefined', 'dynamic_lookup'])
46 libenv.Append(LINKFLAGS = ['-arch', 'i386', '-arch', 'x86_64'])
4a381420 47 libenv.Append(LINKFLAGS = ['-install_name', 'libshairplay.dylib'])
112f0c66
JVH
48
49# Set up the environment for compiling the examples
50appenv = env.Clone()
51conf = Configure(appenv)
52conf.CheckLib('pthread')
4375a240 53conf.CheckLib('dns_sd')
112f0c66
JVH
54appenv = conf.Finish()
55appenv.Append(LIBPATH = ['.'])
4a381420 56appenv.Prepend(LIBS = ['shairplay'])
112f0c66
JVH
57
58exampleobj = appenv.Object(['test/example.c'])
59appenv.Program('example', exampleobj, install=False)