finish unfinished work at basing all install paths on the program name
[ardour.git] / libs / audiographer / wscript
index ed8388f580aa5b26c512c6431c7662314ea0119a..d7f4eda0d19669fcd64aca47b9e42fc912aef967 100644 (file)
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-import autowaf
+from waflib.extras import autowaf as autowaf
+import os
 
 # Version of this package (even if built as a child)
 AUDIOGRAPHER_VERSION = '0.0.0'
@@ -18,101 +19,108 @@ APPNAME = 'audiographer'
 VERSION = AUDIOGRAPHER_VERSION
 
 # Mandatory variables
-srcdir = '.'
-blddir = 'build'
+top = '.'
+out = 'build'
 
-def set_options(opt):
-       autowaf.set_options(opt)
+def options(opt):
+    autowaf.set_options(opt)
 
 def configure(conf):
-       autowaf.configure(conf)
-       
-       conf.check_tool('compiler_cxx')
-       
-       autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
-       autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0', mandatory=False)
-       autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2', mandatory=False)
-       autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=False)
-       autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.14.0', mandatory=False)
-       autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.7', mandatory=False)
-       autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=False)
-       
-       # Boost headers
-       autowaf.check_header(conf, 'boost/shared_ptr.hpp')
-       autowaf.check_header(conf, 'boost/format.hpp')
+    conf.load('compiler_cxx')
+    autowaf.configure(conf)
+
+    autowaf.check_pkg(conf, 'cppunit', uselib_store='CPPUNIT', atleast_version='1.12.0', mandatory=False)
+    autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0', mandatory=False)
+    autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2', mandatory=False)
+    autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.14.0', mandatory=False)
+    autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.14.0', mandatory=False)
+    autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE', atleast_version='0.1.7', mandatory=False)
+    autowaf.check_pkg(conf, 'sndfile', uselib_store='SNDFILE', atleast_version='1.0.18', mandatory=False)
+
+    # Boost headers
+    autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
+    autowaf.check_header(conf, 'cxx', 'boost/format.hpp')
 
 def build(bld):
 
-       # Headers
-       #bld.install_files('${INCLUDEDIR}/audiographer', 'audiographer/*.h')
-       
-       bld.env['HAVE_ALL_GTHREAD'] = bld.env['HAVE_GLIB'] and bld.env['HAVE_GLIBMM'] and bld.env['HAVE_GTHREAD']
-
-       audiographer = bld.new_task_gen('cxx', 'shlib')
-       audiographer.source = '''
-               src/gdither/gdither.cc
-               src/sample_format_converter.cc
-               src/routines.cc
-               src/utils.cc
-       '''
-       
-       if bld.env['HAVE_SNDFILE']:
-               audiographer.source += '''
-                       src/sndfile_base.cc
-                       src/sndfile_writer.cc
-                       src/sndfile_reader.cc
-               '''
-       
-       if bld.env['HAVE_SAMPLERATE']:
-               audiographer.source += '''
-                       src/sr_converter.cc
-               '''
-       
-       audiographer.name           = 'libaudiographer'
-       audiographer.target         = 'audiographer'
-       audiographer.export_incdirs = ['.', './src']
-       audiographer.includes       = ['.', './src']
-       audiographer.uselib         = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE'
-       audiographer.vnum           = AUDIOGRAPHER_LIB_VERSION
-       audiographer.install_path   = '${LIBDIR}'
-       
-
-       if bld.env['BUILD_TESTS'] and bld.env['HAVE_CPPUNIT']:
-               # Unit tests
-               obj              = bld.new_task_gen('cxx', 'program')
-               obj.source       = '''
-                       tests/identity_vertex_test.cc
-                       tests/interleaver_test.cc
-                       tests/deinterleaver_test.cc
-                       tests/interleaver_deinterleaver_test.cc
-                       tests/chunker_test.cc
-                       tests/sample_format_converter_test.cc
-                       tests/test_runner.cc
-                       tests/peak_reader_test.cc
-                       tests/normalizer_test.cc
-                       tests/silence_trimmer_test.cc
-               '''
-               
-               if bld.env['HAVE_ALL_GTHREAD']:
-                       obj.source += '''
-                               tests/threader_test.cc
-                       '''
-               
-               if bld.env['HAVE_SNDFILE']:
-                       obj.source += '''
-                               tests/sndfile_writer_test.cc
-                       '''
-
-               if bld.env['HAVE_SAMPLERATE']:
-                       obj.source += '''
-                               tests/sr_converter_test.cc
-                       '''
-               
-               obj.uselib_local = 'libaudiographer'
-               obj.uselib       = 'CPPUNIT GLIBMM'
-               obj.target       = 'run-tests'
-               obj.install_path = ''
+    # Headers
+    #bld.install_files('${INCLUDEDIR}/audiographer', bld.path.ant_glob('audiographer/*.h'))
+    #bld.install_files('${INCLUDEDIR}/audiographer/general', bld.path.ant_glob('audiographer/general/*.h'))
+    #bld.install_files('${INCLUDEDIR}/audiographer/sndfile', bld.path.ant_glob('audiographer/sndfile/*.h'))
+    #bld.install_files('${INCLUDEDIR}/audiographer/utils', bld.path.ant_glob('audiographer/utils/*.h'))
+
+    #bld.env['BUILD_TESTS'] = True
+    bld.env['HAVE_ALL_GTHREAD'] = (bld.is_defined('HAVE_GLIB')
+                                   and bld.is_defined('HAVE_GLIBMM')
+                                   and bld.is_defined('HAVE_GTHREAD'))
+
+    audiographer_sources = [
+        'private/gdither/gdither.cc',
+        'src/general/sample_format_converter.cc',
+        'src/routines.cc',
+        'src/debug_utils.cc',
+        'src/general/broadcast_info.cc',
+        'src/general/normalizer.cc'
+        ]
+    if bld.is_defined('HAVE_SAMPLERATE'):
+        audiographer_sources += [ 'src/general/sr_converter.cc' ]
+
+    if bld.is_defined ('INTERNAL_SHARED_LIBS'):
+        audiographer              = bld.shlib(features = 'c cxx cshlib cxxshlib', source=audiographer_sources)
+        # macros for this shared library
+        audiographer.defines      = [ 'LIBAUDIOGRAPHER_DLL_EXPORTS=1' ]
+    else:
+        audiographer              = bld.stlib(features = 'c cxx cstlib cxxstlib', source=libardour_sources)
+        audiographer.cxxflags     = [ '-fPIC' ]
+        audiographer.cflags       = [ '-fPIC' ]
+        audiographer.defines      = []
+
+    audiographer.name           = 'libaudiographer'
+    audiographer.target         = 'audiographer'
+    audiographer.export_includes = ['.', './src']
+    audiographer.includes       = ['.', './src']
+    audiographer.uselib         = 'GLIB GLIBMM GTHREAD SAMPLERATE SNDFILE'
+    audiographer.use            = 'libpbd'
+    audiographer.vnum           = AUDIOGRAPHER_LIB_VERSION
+    audiographer.install_path   = os.path.join(bld.env['LIBDIR'])
 
-def shutdown():
-       autowaf.shutdown()
 
+    if bld.env['BUILD_TESTS'] and bld.is_defined('HAVE_CPPUNIT'):
+        # Unit tests
+        obj              = bld(features = 'cxx cxxprogram')
+        obj.source       = '''
+                tests/test_runner.cc
+                tests/type_utils_test.cc
+                tests/utils/identity_vertex_test.cc
+                tests/general/interleaver_test.cc
+                tests/general/deinterleaver_test.cc
+                tests/general/interleaver_deinterleaver_test.cc
+                tests/general/chunker_test.cc
+                tests/general/sample_format_converter_test.cc
+                tests/general/peak_reader_test.cc
+                tests/general/normalizer_test.cc
+                tests/general/silence_trimmer_test.cc
+        '''
+
+        if bld.is_defined('HAVE_ALL_GTHREAD'):
+            obj.source += '''
+                    tests/general/threader_test.cc
+            '''
+
+        if bld.is_defined('HAVE_SNDFILE'):
+            obj.source += '''
+                    tests/sndfile/tmp_file_test.cc
+            '''
+
+        if bld.is_defined('HAVE_SAMPLERATE'):
+            obj.source += '''
+                    tests/general/sr_converter_test.cc
+            '''
+
+        obj.use          = 'libaudiographer'
+        obj.uselib       = 'CPPUNIT GLIBMM'
+        obj.target       = 'run-tests'
+        obj.install_path = ''
+
+def shutdown():
+    autowaf.shutdown()