| 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 |
env.AppendUnique(SHLINKFLAGS="-Wl,-soname=%s.%d" % (soFile, Major)) |
| 16 |
|
| 17 |
# Create symlinks |
| 18 |
def symlink(env, target, source): |
| 19 |
trgt = str(target[0]) |
| 20 |
src = str(source[0]) |
| 21 |
if os.path.islink(trgt) or os.path.exists(trgt): |
| 22 |
os.remove(trgt) |
| 23 |
os.symlink(os.path.basename(src), trgt) |
| 24 |
lnk0 = env.Command(soFile + ".%d" % (Major), soFile + ".%d.%d.%d" % (Major, Minor, Micro), symlink) |
| 25 |
lnk1 = env.Command(soFile, soFile + ".%d" % (Major), symlink) |
| 26 |
sharedLibs.append(lnk0) |
| 27 |
sharedLibs.append(lnk1) |
| 28 |
|
| 29 |
src = [os.path.join("source", "portaudiocpp", "%s.cxx" % f) for f in ("BlockingStream", "CallbackInterface", \ |
| 30 |
"CallbackStream", "CFunCallbackStream","CppFunCallbackStream", "Device", |
| 31 |
"DirectionSpecificStreamParameters", "Exception", "HostApi", "InterfaceCallbackStream", |
| 32 |
"MemFunCallbackStream", "Stream", "StreamParameters", "System", "SystemDeviceIterator", |
| 33 |
"SystemHostApiIterator")] |
| 34 |
env.Append(LIBS="portaudio", LIBPATH=buildDir) |
| 35 |
sharedLib = env.SharedLibrary("portaudiocpp", src, LIBS=["portaudio"]) |
| 36 |
staticLib = env.Library("portaudiocpp", src, LIBS=["portaudio"]) |
| 37 |
sharedLibs.append(sharedLib) |
| 38 |
staticLibs.append(staticLib) |
| 39 |
from glob import glob |
| 40 |
headers = [File(f) for f in glob(os.path.join("include", "portaudiocpp", "*"))] |
| 41 |
Return("sharedLibs", "staticLibs", "headers") |