open session patch from Doug McLain
[ardour.git] / SConstruct
index 7ab8fc10ce7c2d541dd48bd206b80b88a0bf3428..093b6f4085e2bec9b9e490e70b5c54b0c58586f6 100644 (file)
@@ -7,6 +7,7 @@ import shutil
 import glob
 import errno
 import time
+from sets import Set
 import SCons.Node.FS
 
 SConsignFile()
@@ -28,17 +29,16 @@ opts.AddOptions(
     BoolOption('DEBUG', 'Set to build with debugging information and no optimizations', 0),
     PathOption('DESTDIR', 'Set the intermediate install "prefix"', '/'),
     BoolOption('DEVBUILD', 'Use shared libardour (developers only)', 0),
-    BoolOption('SIGCCVSBUILD', 'Use if building sigc++ with a new configure.ac (developers only)', 0),
     BoolOption('NLS', 'Set to turn on i18n support', 1),
     BoolOption('NOARCH', 'Do not use architecture-specific compilation flags', 0),
     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),
     BoolOption('USE_SSE_EVERYWHERE', 'Ask the compiler to use x86/SSE instructions and also our hand-written x86/SSE optimizations when possible (off by default)', 0),
-    BoolOption('BUILD_SSE_OPTIMIZATIONS', 'Use our hand-written x86/SSE optimizations when possible (off by default)', 0)
+    BoolOption('BUILD_SSE_OPTIMIZATIONS', 'Use our hand-written x86/SSE optimizations when possible (off by default)', 0),
+    BoolOption('BUILD_VECLIB_OPTIMIZATIONS', 'Build with Apple Accelerate/vecLib optimizations when possible (off by default)', 0)
   )
 
-
 #----------------------------------------------------------------------
 # a handy helper that provides a way to merge compile/link information
 # from multiple different "environments"
@@ -54,6 +54,10 @@ class LibraryInfo(Environment):
             self.Append (LIBPATH = other.get ('LIBPATH', []))  
             self.Append (CPPPATH = other.get('CPPPATH', []))
             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
 
 
 env = LibraryInfo (options = opts,
@@ -379,6 +383,11 @@ libraries['pango'].ParseConfig ('pkg-config --cflags --libs pango')
 libraries['libgnomecanvas2'] = LibraryInfo()
 libraries['libgnomecanvas2'].ParseConfig ('pkg-config --cflags --libs libgnomecanvas-2.0')
 
+libraries['glade2'] = LibraryInfo()
+libraries['glade2'].ParseConfig ('pkg-config --cflags --libs libglade-2.0')
+
+libraries['flowcanvas'] = LibraryInfo(LIBS='flowcanvas', LIBPATH='#/libs/flowcanvas', CPPPATH='#libs/flowcanvas')
+
 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')
@@ -416,7 +425,10 @@ if env['SYSLIBS']:
 
     libraries['gtkmm2'] = LibraryInfo()
     libraries['gtkmm2'].ParseConfig ('pkg-config --cflags --libs gtkmm-2.0')
-
+    
+    libraries['libglademm'] = LibraryInfo()
+    libraries['libglademm'].ParseConfig ('pkg-config --cflags --libs libglademm-2.4')
+    
     libraries['soundtouch'] = LibraryInfo(LIBS='SoundTouch')
 
     coredirs = [
@@ -462,6 +474,9 @@ else:
     libraries['soundtouch'] = LibraryInfo(LIBS='soundtouch',
                                           LIBPATH='#libs/soundtouch',
                                           CPPPATH=['#libs', '#libs/soundtouch'])
+    libraries['libglademm'] = LibraryInfo(LIBS='libglademm',
+                                          LIBPATH='#libs/libglademm',
+                                          CPPPATH='#libs/libglademm')
 
     coredirs = [
         'libs/soundtouch',
@@ -482,9 +497,11 @@ else:
        'libs/gtkmm2/atk',
        'libs/gtkmm2/gdk',
        'libs/gtkmm2/gtk',
+        'libs/libglademm',
        'libs/libgnomecanvasmm',
+       'libs/flowcanvas',
         'libs/gtkmm2ext',
-        'gtk2_ardour',
+        'gtk2_ardour'
         ]
 
 opts.Save('scache.conf', env)
@@ -516,6 +533,20 @@ else:
 
 config_prefix = '$DESTDIR' + final_config_prefix
 
+
+# SCons should really do this for us
+
+conf = Configure (env)
+
+have_cxx = conf.TryAction (Action (env['CXX'] + ' --version'));
+if have_cxx[0] != 1:
+    print "This system has no functional C++ compiler. You cannot build Ardour from source without one."
+    exit (1);
+else:
+    print "Congratulations, you have a functioning C++ compiler."
+    
+env = conf.Finish()
+
 #
 # Compiler flags and other system-dependent stuff
 #
@@ -541,6 +572,12 @@ if config[config_arch] == 'apple':
         libraries['core'].Append (LIBPATH = [ '/opt/local/lib' ])
     if os.path.isdir('/opt/local/include'):
         libraries['core'].Append (CPPPATH = [ '/opt/local/include' ])
+
+    if env['BUILD_VECLIB_OPTIMIZATIONS'] == 1:
+        opt_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS")
+        debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS")
+        libraries['core'].Append(LINKFLAGS= '-framework Accelerate')
+
 if config[config_cpu] == 'powerpc':
     #
     # Apple/PowerPC optimization options
@@ -626,6 +663,14 @@ if env['VST']:
     env.Append(CCFLAGS="-DVST_SUPPORT")
 
 
+# check endianness
+if sys.byteorder == "big":
+    print "Host is big endian"
+    env.Append(CCFLAGS="-DWORDS_BIGENDIAN")
+else:
+    print "Host is little endian"
+
+
 #
 # everybody needs this
 #