wscript 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2006-2010 (ita)
  4. # the following two variables are used by the target "waf dist"
  5. VERSION='0.0.1'
  6. APPNAME='cxx_test'
  7. # these variables are mandatory ('/' are converted automatically)
  8. top = '.'
  9. out = 'debug'
  10. from functools import partial
  11. from pathlib import Path
  12. def get_sub_files(obj, suffixes=(".c", ".cpp", ".cxx"), max_depth=None):
  13. root = Path(str(obj.path))
  14. if root.is_file():
  15. root = root.parent
  16. queue = [(0, root)]
  17. ret = []
  18. while queue:
  19. depth, curr = queue.pop()
  20. if max_depth is not None and depth>max_depth: continue
  21. for file in curr.iterdir():
  22. if file.is_file():
  23. if not suffixes or file.name.endswith(suffixes):
  24. ret.append(str(file.relative_to(root)))
  25. elif file.is_dir():
  26. queue.append((depth+1, file))
  27. return ret
  28. def options(opt):
  29. opt.load('compiler_cxx')
  30. def configure(conf):
  31. conf.load('compiler_cxx')
  32. conf.env.append_value('CXXFLAGS', '-g')
  33. conf.check(header_name='stdio.h', features='cxx cxxprogram', mandatory=False)
  34. def build(bld):
  35. bld.get_sub_files = partial(get_sub_files, bld)
  36. bld.recurse("src/common")
  37. bld.recurse("src/core")
  38. bld.recurse("src/fft")
  39. bld.recurse("src/io")
  40. bld.recurse("src/plugins")
  41. bld.program(target=APPNAME,
  42. features='cxx cxxprogram',
  43. lib=['fftw3', "sndfile"],
  44. use=["common", "fft", "io"])