File: SConstruct

package info (click to toggle)
sndobj 2.6.7%2Bds1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,952 kB
  • sloc: ansic: 55,663; cpp: 21,625; python: 391; makefile: 130; java: 22; sh: 21
file content (95 lines) | stat: -rw-r--r-- 4,216 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import sys
import os

env = Environment(ENV = {'PATH' : os.environ['PATH']})
env.SConsignFile()

def getVersion():
    return sys.version[:3]

def getPlatform():
    if sys.platform[:5] == 'linux':
        return 'linux'
    elif sys.platform[:3] == 'win':
        if env['PLATFORM'] == 'win32':
                return 'win'
        else:
                return 'cygwin'
    elif sys.platform[:6] == 'darwin':
        return 'e'
    else:
        return 'unsupported'

print "Building The Trane Thing instrument"
configure = env.Configure()
env.Append(LIBS=['sndobj', 'fltk'])

if getPlatform() == 'linux':
        print "OS is Linux..."
        alsaFound = configure.CheckHeader("alsa/asoundlib.h", language = "C")
        ossFound = configure.CheckHeader("soundcard.h", language="C")
        env.Append(CPPPATH=['/usr/local/include', '../include'])
        env.Append(LIBPATH=['/usr/local/lib', '../lib'])
        if alsaFound:
          env.Append(CPPDEFINES="ALSA")
          env.Append(LIBS=['asound'])
          print "using ALSA"
        elif ossFound:
          env.Append(CPPDEFINES="OSS")
          print "using OSS"
        fltkFound = configure.CheckHeader("Fl/Fl.H", language = "C++")
        sources = Split("""main.cpp Instrument.cpp""")
        if not fltkFound:
            print "No FLTK... exiting"
            sys.exit(0)

elif getPlatform() == 'win':
        print "OS is Windows, environment is win32..."
        env.Append(CPPDEFINES="WIN")
        if 'msvc'in env['TOOLS']: # MSVC
          includes = "C:\\Program Files\\Microsoft Visual Studio\\VC98\\include"
          libs = "C:\\Program Files\\Microsoft Visual Studio\\VC98\\lib"
          env.Append(CPPPATH=['msvc6.0'])
          env.Append(LIBS=['pthreadVC'])
          sources = Split("""main.cpp Instrument.cpp""")
        else: # mingw
          print 'using MINGW...'
          env.Append(CPPDEFINES=['GCC', 'USE_WIN32THREADS'])
          includes = 'c:/msys/1.0/local/include'
          libs     = 'c:/msys/1.0/local/lib'
          env.Append(LINKFLAGS='-mwindows')
          env.Append(LIBS=['pthreadVC', 'uuid', 'wsock32', 'comctl32', 'ole32'])
          res = env.Command("trane_res.o", "trane.rc", "windres -o trane_res.o trane.rc")
          sources = Split("""main.cpp Instrument.cpp trane_res.o""")
        env.Append(CPPPATH=[includes, '../include'])
        env.Append(LIBPATH=[libs])
        env.Append(LIBPATH=['../lib'])
        env.Append(LIBS=['winmm'])
        fltkFound = configure.CheckHeader("FL/Fl.H", language = "C++")
        if not fltkFound:
            print "No FLTK... exiting"
            sys.exit(0)

elif getPlatform() == 'macosx':
        print "OS is MacOSX"
        env.Append(CPPDEFINES="MACOSX")
        swigdef = ['-DMACOSX']
        env.Append(CPPPATH=['/usr/local/include', '../include'])
        env.Append(LIBPATH=['/usr/local/lib', '../lib'])
        env.Append(CPPPATH=["/system/library/Frameworks/CoreAudio.framework/Headers"])
        env.Append(LINKFLAGS= ['-framework', 'coreaudio'])
        fltkFound = configure.CheckHeader("Fl/Fl.H", language = "C++")
        sources = Split("""main.cpp Instrument.cpp""")
        if not fltkFound:
            print "No FLTK... exiting"
            sys.exit(0)
else:
       print "Unsupported platform..."
       sys.exit(0)


trane = env.Program('trane', sources)
if getPlatform() == 'macosx':
   env.Command('trane.app/Contents/MacOS/trane', 'trane', 'cp -f trane trane.app/Contents/MacOS/;install_name_tool -change lib/libsndobj.dylib @executable_path/../Resources/libsndobj.dylib trane.app/Contents/MacOS/trane; install_name_tool -change /usr/local/lib/libfltk1.1.dylib @executable_path/../Resources/libfltk1.1.dylib trane.app/Contents/MacOS/trane')
   env.Command('trane.app/Contents/Resources/libsndobj.dylib', '../lib/libsndobj.dylib', 'cp -f ../lib/libsndobj.dylib trane.app/Contents/Resources;install_name_tool -id libsndobj.dylib trane.app/Contents/Resources/libsndobj.dylib')
   env.Command('trane.app/Contents/Resources/libfltk.1.1.dylib', '/usr/local/lib/libfltk.1.1.dylib', 'cp -f /usr/local/lib/libfltk.1.1.dylib trane.app/Contents/Resources;install_name_tool -id libfltk.1.1.dylib trane.app/Contents/Resources/libfltk.1.1.dylib')