| cannam@140 | 1 import os.path | 
| cannam@140 | 2 | 
| cannam@140 | 3 Import("env", "buildDir") | 
| cannam@140 | 4 env.Append(CPPPATH="include") | 
| cannam@140 | 5 | 
| cannam@140 | 6 ApiVer = "0.0.12" | 
| cannam@140 | 7 Major, Minor, Micro = [int(c) for c in ApiVer.split(".")] | 
| cannam@140 | 8 | 
| cannam@140 | 9 sharedLibs = [] | 
| cannam@140 | 10 staticLibs = [] | 
| cannam@140 | 11 Import("Platform", "Posix") | 
| cannam@140 | 12 if Platform in Posix: | 
| cannam@140 | 13     env["SHLIBSUFFIX"] = ".so.%d.%d.%d" % (Major, Minor, Micro) | 
| cannam@140 | 14     soFile = "libportaudiocpp.so" | 
| cannam@140 | 15     if Platform != 'darwin': | 
| cannam@140 | 16         env.AppendUnique(SHLINKFLAGS="-Wl,-soname=%s.%d" % (soFile, Major)) | 
| cannam@140 | 17 | 
| cannam@140 | 18     # Create symlinks | 
| cannam@140 | 19     def symlink(env, target, source): | 
| cannam@140 | 20         trgt = str(target[0]) | 
| cannam@140 | 21         src = str(source[0]) | 
| cannam@140 | 22         if os.path.islink(trgt) or os.path.exists(trgt): | 
| cannam@140 | 23             os.remove(trgt) | 
| cannam@140 | 24         os.symlink(os.path.basename(src), trgt) | 
| cannam@140 | 25     lnk0 = env.Command(soFile + ".%d" % (Major), soFile + ".%d.%d.%d" % (Major, Minor, Micro), symlink) | 
| cannam@140 | 26     lnk1 = env.Command(soFile, soFile + ".%d" % (Major), symlink) | 
| cannam@140 | 27     sharedLibs.append(lnk0) | 
| cannam@140 | 28     sharedLibs.append(lnk1) | 
| cannam@140 | 29 | 
| cannam@140 | 30 src = [os.path.join("source", "portaudiocpp", "%s.cxx" % f) for f in ("BlockingStream", "CallbackInterface", \ | 
| cannam@140 | 31     "CallbackStream", "CFunCallbackStream","CppFunCallbackStream", "Device", | 
| cannam@140 | 32     "DirectionSpecificStreamParameters", "Exception", "HostApi", "InterfaceCallbackStream", | 
| cannam@140 | 33     "MemFunCallbackStream", "Stream", "StreamParameters", "System", "SystemDeviceIterator", | 
| cannam@140 | 34     "SystemHostApiIterator")] | 
| cannam@140 | 35 env.Append(LIBS="portaudio", LIBPATH=buildDir) | 
| cannam@140 | 36 sharedLib = env.SharedLibrary("portaudiocpp", src, LIBS=["portaudio"]) | 
| cannam@140 | 37 staticLib = env.Library("portaudiocpp", src, LIBS=["portaudio"]) | 
| cannam@140 | 38 sharedLibs.append(sharedLib) | 
| cannam@140 | 39 staticLibs.append(staticLib) | 
| cannam@140 | 40 | 
| cannam@140 | 41 headers = Split("""AutoSystem.hxx | 
| cannam@140 | 42                    BlockingStream.hxx | 
| cannam@140 | 43                    CallbackInterface.hxx | 
| cannam@140 | 44                    CallbackStream.hxx | 
| cannam@140 | 45                    CFunCallbackStream.hxx | 
| cannam@140 | 46                    CppFunCallbackStream.hxx | 
| cannam@140 | 47                    Device.hxx | 
| cannam@140 | 48                    DirectionSpecificStreamParameters.hxx | 
| cannam@140 | 49                    Exception.hxx | 
| cannam@140 | 50                    HostApi.hxx | 
| cannam@140 | 51                    InterfaceCallbackStream.hxx | 
| cannam@140 | 52                    MemFunCallbackStream.hxx | 
| cannam@140 | 53                    PortAudioCpp.hxx | 
| cannam@140 | 54                    SampleDataFormat.hxx | 
| cannam@140 | 55                    Stream.hxx | 
| cannam@140 | 56                    StreamParameters.hxx | 
| cannam@140 | 57                    SystemDeviceIterator.hxx | 
| cannam@140 | 58                    SystemHostApiIterator.hxx | 
| cannam@140 | 59                    System.hxx | 
| cannam@140 | 60                    """) | 
| cannam@140 | 61 if env["PLATFORM"] == "win32": | 
| cannam@140 | 62     headers.append("AsioDeviceAdapter.hxx") | 
| cannam@140 | 63 headers = [File(os.path.join("include", "portaudiocpp", h)) for h in headers] | 
| cannam@140 | 64 | 
| cannam@140 | 65 Return("sharedLibs", "staticLibs", "headers") |