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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#!/usr/bin/python
import os
import glob
import sys
options = Variables('options.cache', ARGUMENTS)
options.Add(PathVariable('prefix', 'The prefix where the application will be installed', '/usr/local'))
options.Add(PathVariable('clam_prefix', 'The prefix where CLAM was installed', '/usr/local'))
options.Add(BoolVariable('release', 'Enabling compiler optimizations', 'no') )
options.Add(PathVariable('vstsdk_path', 'The path to vstsdk (root dir)', ''))
options.Add(BoolVariable('verbose', 'Display the full command line instead a short command description', 'no') )
if sys.platform=="linux2" :
options.Add(BoolVariable('crossmingw', 'Using MinGW crosscompiler mode', 'no') )
def scanFiles(pattern, paths) :
files = []
for path in paths :
files+=glob.glob(os.path.join(path,pattern))
return files
def recursiveDirs(root) :
return filter( (lambda a : a.rfind( ".svn")==-1 ), [ a[0] for a in os.walk(root)] )
toolchain='default'
if sys.platform == 'win32': toolchain = 'mingw'
env = Environment(ENV=os.environ, tools=[toolchain], options=options)
options.Save('options.cache', env)
Help(options.GenerateHelpText(env))
env.SConsignFile() # Single signature file
crosscompiling = env.has_key("crossmingw") and env["crossmingw"]
isWindowsPlatform = sys.platform=='win32' or crosscompiling
isLinuxPlatform = sys.platform=='linux2' and not crosscompiling
isDarwinPlatform = sys.platform=='darwin'
CLAMInstallDir = env['clam_prefix']
clam_sconstoolspath = os.path.join(CLAMInstallDir,'share','clam','sconstools')
env.Tool('qt4', toolpath=[clam_sconstoolspath])
env.Tool('clam', toolpath=[clam_sconstoolspath])
env.Tool('nsis', toolpath=[clam_sconstoolspath])
if sys.platform=='darwin' : env.Tool('bundle', toolpath=[clam_sconstoolspath])
env.Tool('dmg', toolpath=[clam_sconstoolspath])
if crosscompiling :
env.Tool('crossmingw', toolpath=[clam_sconstoolspath])
sys.path.append(clam_sconstoolspath)
env['CXXFILESUFFIX'] = ['.cxx']
env['QT4_UICDECLSUFFIX'] = '.hxx'
env['QT4_MOCHPREFIX'] = os.path.join('generated','moc_')
env['QT4_UICDECLPREFIX'] = os.path.join('generated','uic_')
env['QT4_QRCCXXPREFIX'] = os.path.join('generated','qrc_')
if not env['verbose']:
env['CXXCOMSTR'] = '== Compiling $SOURCE'
env['SHCXXCOMSTR'] = '== Compiling shared $SOURCE'
env['LINKCOMSTR'] = '== Linking $TARGET'
env['SHLINKCOMSTR'] = '== Linking library $TARGET'
env['QT4_RCCCOMSTR'] = '== Embeding resources $SOURCE'
env['QT4_UICCOMSTR'] = '== Compiling interface $SOURCE'
env['QT4_LRELEASECOMSTR'] = '== Compiling translation $TARGET'
env['QT4_MOCFROMHCOMSTR'] = '== Generating metaobjects for $SOURCE'
env['QT4_MOCFROMCXXCOMSTR'] = '== Generating metaobjects for $SOURCE'
env.EnableClamModules([
'clam_core',
'clam_audioio',
'clam_processing',
], CLAMInstallDir)
env.EnableQt4Modules([
'QtCore',
'QtGui',
'QtOpenGL',
'QtXml',
'QtSvg',
'QtUiTools',
],
debug=False,
crosscompiling=crosscompiling,
)
vstsdk_common_path = os.path.join( env['vstsdk_path'], 'public.sdk', 'source', 'vst2.x' )
vstgui_path = os.path.join( env['vstsdk_path'], 'vstgui.sf', 'vstgui' )
sourcePaths = [
os.path.join('.'),
os.path.join( vstsdk_common_path )
]
extraPaths = [
env['vstsdk_path'],
vstgui_path,
vstsdk_common_path,
CLAMInstallDir+'/include',
CLAMInstallDir+'/include/CLAM', # KLUDGE to keep old style includes
]
includePaths = sourcePaths + extraPaths
commonSources = scanFiles("*.cpp", [vstsdk_common_path])
vstguiSources = scanFiles("*.cpp", [vstgui_path])
#env.Append(LIBS=['vstgui'])
env.Append(CPPPATH=includePaths)
env.Append(CPPFLAGS='-DRESOURCES_BASE="\\"' + env['prefix'] + '/share/networkeditor\\""')
env.Append(CPPFLAGS=['-D_USE_MATH_DEFINES']) # to have M_PI defined TESTING - bug-fix: Load Simple Clam Networks
env.AppendUnique(LIBS = [
'ole32',
'gdi32',
'uuid',
'comdlg32',
])
if env['release'] :
env.Append(CPPDEFINES=['NDEBUG'])
env.Append( CCFLAGS=['-g','-O3','-fomit-frame-pointer','-Wall','-pipe'] )
else :
env.Append(CPPDEFINES=['_DEBUG'])
env.Append( CCFLAGS=['-g','-O3','-Wall','-pipe'] )
plugins = [
env.SharedLibrary("CLAMVstPlugin", source = commonSources + [
"CLAMVstPlugin.cxx",
"VstNetworkExporter.cxx",
"QClamVstEditor.cxx",
"Files.s",
]),
# # A VstGui based plugin would need that
# env.SharedLibrary("CLAMVstPlugin", source = commonSources + vstguiSources [
# "CLAMVstGuiPlugin.cxx",
# "CLAMVstGuiEditor.cxx",
# env.RES("CLAMVstGuiEditor.rc"),
# # A Vst Qt based plugin would need that
# env.SharedLibrary("CLAMVstPlugin", source = commonSources + [
# "CLAMVstQtlugin.cxx",
# "CLAMVstQtditor.cxx",
# env.Qrc("CLAMVstQtEditor.qrc"),
# ]),
]
installation = {
'/bin' : plugins,
}
installTargets = [
env.Install( env['prefix']+path, files ) for path, files in installation.items() ]
env.Alias('install', installTargets )
env.Default([plugins])
|