interfaces/python/py-cvec.c: write setters for norm and phas
[aubio.git] / wscript
diff --git a/wscript b/wscript
index f2e3eaf1341d6beed6687708117e0a62ec84599e..eb09721004ed496b38089deb5657382b8f69d544 100644 (file)
--- a/wscript
+++ b/wscript
@@ -12,8 +12,6 @@ LIB_VERSION = '2.1.1'
 srcdir = '.'
 blddir = 'build'
 
-import UnitTest
-
 def init(opt):
   pass
 
@@ -26,8 +24,6 @@ def set_options(opt):
       help='compile without C99 complex')
   opt.add_option('--disable-jack', action='store_true', default=False,
       help='compile without jack support')
-  opt.add_option('--disable-alsa', action='store_true', default=False,
-      help='compile without alsa support')
   opt.add_option('--disable-lash', action='store_true', default=False,
       help='compile without lash support')
   opt.add_option('--enable-java', action='store_true', default=False,
@@ -37,7 +33,7 @@ def set_options(opt):
   opt.tool_options('compiler_cc')
   opt.tool_options('compiler_cxx')
   opt.tool_options('gnu_dirs')
-  #opt.tool_options('UnitTest')
+  opt.tool_options('UnitTest')
 
 def configure(conf):
   import Options
@@ -57,6 +53,7 @@ def configure(conf):
   conf.check(header_name='stdio.h')
   conf.check(header_name='math.h')
   conf.check(header_name='string.h')
+  conf.check(header_name='limits.h')
 
   # optionally use complex.h
   if (Options.options.disable_complex == False):
@@ -91,9 +88,6 @@ def configure(conf):
   if (Options.options.disable_jack == False):
     conf.check_cfg(package = 'jack', atleast_version = '0.15.0',
     args = '--cflags --libs')
-  if (Options.options.disable_alsa == False):
-    conf.check_cfg(package = 'alsa', atleast_version = '0.0.9',
-    args = '--cflags --libs')
   if (Options.options.disable_lash == False):
     conf.check_cfg(package = 'lash-1.0', atleast_version = '0.5.0',
     args = '--cflags --libs', uselib_store = 'LASH')
@@ -142,7 +136,7 @@ def build(bld):
   bld.env['LIB_VERSION'] = LIB_VERSION 
 
   # add sub directories
-  bld.add_subdirs('src ext examples cpp tests/src')
+  bld.add_subdirs('src examples interfaces/cpp')
   if bld.env['SWIG']:
     if bld.env['PYTHON']:
       bld.add_subdirs('python/aubio python')
@@ -176,11 +170,28 @@ def build(bld):
   bld.install_files('${PREFIX}/share/sounds/aubio/', 
       'sounds/woodblock.aiff')
 
+  # build and run the unit tests
+  build_tests(bld)
+  import UnitTest
+  bld.add_post_fun(UnitTest.summary)
+
 def shutdown(bld):
   pass
 
-def check(bld):
-  ut = UnitTest.unit_test()
-  ut.change_to_testfile_dir = True
-  ut.run()
-  ut.print_results()
+# loop over all *.c filenames in tests/src to build them all
+# target name is filename.c without the .c
+def build_tests(bld):
+  for target_name in bld.path.ant_glob('tests/src/**/*.c').split():
+    this_target = bld.new_task_gen(
+        features = 'cc cprogram test',
+        source = target_name,
+        target = target_name.split('.')[0],
+        includes = 'src',
+        defines = 'AUBIO_UNSTABLE_API=1',
+        uselib_local = 'aubio')
+    # phasevoc-jack also needs jack 
+    if target_name.endswith('test-phasevoc-jack.c'):
+      this_target.includes = ['src', 'examples']
+      this_target.uselib_local = ['aubio']
+      this_target.uselib = ['JACK']
+      this_target.source += ' examples/jackio.c'