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