add actual wine-built code for VST support
[ardour.git] / SConstruct
index 19decf99b8ff5ac64f6c1fccebd823052c4503ef..94da428f2cbf16b24c993bcfa02eb19bd920e45d 100644 (file)
@@ -8,13 +8,14 @@ import glob
 import errno
 import time
 import platform
+import string
 from sets import Set
 import SCons.Node.FS
 
 SConsignFile()
 EnsureSConsVersion(0, 96)
 
-version = '2.0alpha2'
+version = '2.0beta2'
 
 subst_dict = { }
 
@@ -25,19 +26,21 @@ subst_dict = { }
 opts = Options('scache.conf')
 opts.AddOptions(
   ('ARCH', 'Set architecture-specific compilation flags by hand (all flags as 1 argument)',''),
-    BoolOption('SYSLIBS', 'USE AT YOUR OWN RISK: CANCELS ALL SUPPORT FROM ARDOUR AUTHORS: Use existing system versions of various libraries instead of internal ones', 0),
+    BoolOption('COREAUDIO', 'Compile with Apple\'s CoreAudio library', 0),
     BoolOption('DEBUG', 'Set to build with debugging information and no optimizations', 0),
     PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'),
-    BoolOption('NLS', 'Set to turn on i18n support', 1),
-    PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'),
-    BoolOption('VST', 'Compile with support for VST', 0),
-    BoolOption('VERSIONED', 'Add version information to ardour/gtk executable name inside the build directory', 0),
     EnumOption('DIST_TARGET', 'Build target for cross compiling packagers', 'auto', allowed_values=('auto', 'i386', 'i686', 'x86_64', 'powerpc', 'tiger', 'panther', 'none' ), ignorecase=2),
-    BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
+    BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0),
     BoolOption('FFT_ANALYSIS', 'Include FFT analysis window', 0),
+    BoolOption('FPU_OPTIMIZATION', 'Build runtime checked assembler code', 1),
+    BoolOption('LIBLO', 'Compile with support for liblo library', 1),
+    BoolOption('NLS', 'Set to turn on i18n support', 1),
+    PathOption('PREFIX', 'Set the install "prefix"', '/usr/local'),
     BoolOption('SURFACES', 'Build support for control surfaces', 0),
-    BoolOption('DMALLOC', 'Compile and link using the dmalloc library', 0)
-  )
+    BoolOption('SYSLIBS', 'USE AT YOUR OWN RISK: CANCELS ALL SUPPORT FROM ARDOUR AUTHORS: Use existing system versions of various libraries instead of internal ones', 0),
+    BoolOption('VERSIONED', 'Add version information to ardour/gtk executable name inside the build directory', 0),
+    BoolOption('VST', 'Compile with support for VST', 0)
+)
 
 #----------------------------------------------------------------------
 # a handy helper that provides a way to merge compile/link information
@@ -56,8 +59,8 @@ class LibraryInfo(Environment):
             self.Append (LINKFLAGS = other.get('LINKFLAGS', []))
        self.Replace(LIBPATH = list(Set(self.get('LIBPATH', []))))
        self.Replace(CPPPATH = list(Set(self.get('CPPPATH',[]))))
-       #doing LINKFLAGS breaks -framework
-    #doing LIBS break link order dependency
+        #doing LINKFLAGS breaks -framework
+        #doing LIBS break link order dependency
 
 
 env = LibraryInfo (options = opts,
@@ -343,6 +346,21 @@ tarball_bld = Builder (action = tarballer,
 env.Append (BUILDERS = {'Distribute' : dist_bld})
 env.Append (BUILDERS = {'Tarball' : tarball_bld})
 
+#
+# Make sure they know what they are doing
+#
+
+if env['VST']:
+    sys.stdout.write ("Are you building Ardour for personal use (rather than distributiont to others)? [no]: ")
+    answer = sys.stdin.readline ()
+    answer = string.strip (string.rstrip (answer));
+    if answer != "yes" and answer != "y":
+        print 'You cannot build Ardour with VST support for distribution to others.\nIt is a violation of several different licenses. VST support disabled.'
+        env['VST'] = 0;
+    else:
+        print "OK, VST support will be enabled"
+        
+
 # ----------------------------------------------------------------------
 # Construction environment setup
 # ----------------------------------------------------------------------
@@ -351,8 +369,8 @@ libraries = { }
 
 libraries['core'] = LibraryInfo (CCFLAGS = '-Ilibs')
 
-libraries['sndfile'] = LibraryInfo()
-libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile')
+#libraries['sndfile'] = LibraryInfo()
+#libraries['sndfile'].ParseConfig('pkg-config --cflags --libs sndfile')
 
 libraries['lrdf'] = LibraryInfo()
 libraries['lrdf'].ParseConfig('pkg-config --cflags --libs lrdf')
@@ -380,6 +398,7 @@ libraries['glib2'] = LibraryInfo()
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs glib-2.0')
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gobject-2.0')
 libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gmodule-2.0')
+libraries['glib2'].ParseConfig ('pkg-config --cflags --libs gthread-2.0')
 
 libraries['gtk2'] = LibraryInfo()
 libraries['gtk2'].ParseConfig ('pkg-config --cflags --libs gtk+-2.0')
@@ -392,16 +411,19 @@ libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomeca
 
 #libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
 
+# The Ardour Control Protocol Library
+
+libraries['ardour_cp'] = LibraryInfo (LIBS='ardour_cp', LIBPATH='#libs/surfaces/control_protocol',
+                                      CPPPATH='#libs/surfaces/control_protocol')
+
+# The Ardour backend/engine
+
 libraries['ardour'] = LibraryInfo (LIBS='ardour', LIBPATH='#libs/ardour', CPPPATH='#libs/ardour')
 libraries['midi++2'] = LibraryInfo (LIBS='midi++', LIBPATH='#libs/midi++2', CPPPATH='#libs/midi++2')
 libraries['pbd3']    = LibraryInfo (LIBS='pbd', LIBPATH='#libs/pbd3', CPPPATH='#libs/pbd3')
 libraries['gtkmm2ext'] = LibraryInfo (LIBS='gtkmm2ext', LIBPATH='#libs/gtkmm2ext', CPPPATH='#libs/gtkmm2ext')
 #libraries['cassowary'] = LibraryInfo(LIBS='cassowary', LIBPATH='#libs/cassowary', CPPPATH='#libs/cassowary')
 
-libraries['fst'] = LibraryInfo()
-if env['VST']:
-    libraries['fst'].ParseConfig('pkg-config --cflags --libs libfst')
-
 #
 # Check for libusb
 
@@ -415,17 +437,27 @@ else:
     
 libraries['usb'] = conf.Finish ()
 
+#
+# Check for FLAC
+
+libraries['flac'] = LibraryInfo ()
+
+conf = Configure (libraries['flac'])
+conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new')
+libraries['flac'] = conf.Finish ()
+
 #
 # Check for liblo
 
-libraries['lo'] = LibraryInfo ()
+if env['LIBLO']:
+    libraries['lo'] = LibraryInfo ()
 
-conf = Configure (libraries['lo'])
-if conf.CheckLib ('lo', 'lo_server_new') == False:
-    print "liblo does not appear to be installed."
-    exit (0)
+    conf = Configure (libraries['lo'])
+    if conf.CheckLib ('lo', 'lo_server_new') == False:
+        print "liblo does not appear to be installed."
+        sys.exit (1)
     
-libraries['lo'] = conf.Finish ()
+    libraries['lo'] = conf.Finish ()
 
 #
 # Check for dmalloc
@@ -463,7 +495,10 @@ elif conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/Co
     env['SYSMIDI'] = 'CoreMIDI'
     subst_dict['%MIDITAG%'] = "ardour"
     subst_dict['%MIDITYPE%'] = "coremidi"
-
+else:
+    print "It appears you don't have the required MIDI libraries installed."
+    sys.exit (1)
+        
 env = conf.Finish()
 
 if env['SYSLIBS']:
@@ -483,6 +518,14 @@ if env['SYSLIBS']:
     libraries['libgnomecanvasmm'] = LibraryInfo()
     libraries['libgnomecanvasmm'].ParseConfig ('pkg-config --cflags --libs libgnomecanvasmm-2.6')
 
+#
+# cannot use system one for the time being
+#
+
+    libraries['sndfile'] = LibraryInfo(LIBS='libsndfile',
+                                    LIBPATH='#libs/libsndfile',
+                                    CPPPATH=['#libs/libsndfile', '#libs/libsndfile/src'])
+
 #    libraries['libglademm'] = LibraryInfo()
 #    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
 
@@ -495,11 +538,15 @@ if env['SYSLIBS']:
     ]
 
     subdirs = [
+        'libs/libsndfile',
         'libs/pbd3',
         'libs/midi++2',
         'libs/ardour'
         ]
 
+    if env['VST']:
+        subdirs = ['libs/fst'] + subdirs + ['vst']
+
     gtk_subdirs = [
 #        'libs/flowcanvas',
         'libs/gtkmm2ext',
@@ -532,6 +579,9 @@ else:
     libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch',
                                           LIBPATH='#libs/soundtouch',
                                           CPPPATH=['#libs', '#libs/soundtouch'])
+    libraries['sndfile'] = LibraryInfo(LIBS='libsndfile',
+                                    LIBPATH='#libs/libsndfile',
+                                    CPPPATH=['#libs/libsndfile', '#libs/libsndfile/src'])
 #    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
 #                                          LIBPATH='#libs/libglademm',
 #                                          CPPPATH='#libs/libglademm')
@@ -544,11 +594,15 @@ else:
     subdirs = [
 #          'libs/cassowary',
         'libs/sigc++2',
+        'libs/libsndfile',
         'libs/pbd3',
         'libs/midi++2',
         'libs/ardour'
         ]
 
+    if env['VST']:
+        subdirs = ['libs/fst'] + subdirs + ['vst']
+
     gtk_subdirs = [
        'libs/glibmm2',
        'libs/gtkmm2/pango',
@@ -561,12 +615,18 @@ else:
     'gtk2_ardour'
         ]
 
-surface_subdirs = []
+#
+# always build the LGPL control protocol lib, since we link against it ourselves
+# ditto for generic MIDI
+#
+
+surface_subdirs = [ 'libs/surfaces/control_protocol', 'libs/surfaces/generic_midi' ]
 
 if env['SURFACES']:
-    surface_subdirs += [ 'libs/surfaces/generic_midi' ]
     if have_libusb:
         surface_subdirs += [ 'libs/surfaces/tranzport' ]
+    if os.access ('libs/surfaces/sony9pin', os.F_OK):
+        surface_subdirs += [ 'libs/surfaces/sony9pin' ]
     
 opts.Save('scache.conf', env)
 Help(opts.GenerateHelpText(env))
@@ -716,6 +776,12 @@ if env['FPU_OPTIMIZATION']:
             print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
 # end optimization section
 
+#
+# save off guessed arch element in an env
+#
+env.Append(CONFIG_ARCH=config[config_arch])
+
+
 #
 # ARCH="..." overrides all 
 #
@@ -739,10 +805,15 @@ if env['DEBUG'] == 1:
 else:
     env.Append(CCFLAGS=" ".join (opt_flags))
 
+#
+# warnings flags
+#
+
 env.Append(CCFLAGS="-Wall")
+env.Append(CXXFLAGS="-Woverloaded-virtual")
 
-if env['VST']:
-    env.Append(CCFLAGS="-DVST_SUPPORT")
+if env['LIBLO']:
+    env.Append(CCFLAGS="-DHAVE_LIBLO")
 
 #
 # everybody needs this
@@ -843,7 +914,7 @@ env.AddPostAction (srcdist, Action ('rm -rf ' + str (File (env['DISTTREE']))))
 for subdir in coredirs:
     SConscript (subdir + '/SConscript')
 
-for sublistdir in [subdirs, gtk_subdirs, surface_subdirs]:
+for sublistdir in [ subdirs, gtk_subdirs, surface_subdirs ]:
     for subdir in sublistdir:
         SConscript (subdir + '/SConscript')