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