wscript 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2010
  4. from waflib import Logs
  5. APPNAME = 'wafcython'
  6. VERSION = '1.0'
  7. top = '.'
  8. out = 'build'
  9. def options(ctx):
  10. ctx.load('compiler_c')
  11. ctx.load('compiler_cxx')
  12. ctx.load('python')
  13. ctx.load('cython')
  14. ctx.load('cython_cache', tooldir='.')
  15. def configure(ctx):
  16. ctx.load('compiler_c')
  17. ctx.load('compiler_cxx')
  18. ctx.load('python')
  19. ctx.check_python_headers()
  20. try:
  21. ctx.load('cython')
  22. except ctx.errors.ConfigurationError:
  23. Logs.warn('Cython was not found, using the cache')
  24. def build(ctx):
  25. # a C library
  26. ctx(features = 'c cshlib',
  27. source = 'c_lib/lib.c',
  28. target = 'c_lib',
  29. includes = 'c_lib')
  30. # a C++ library
  31. ctx(features = 'cxx cxxshlib',
  32. source = 'cxx_lib/lib.cxx',
  33. target = 'cxx_lib',
  34. includes = 'cxx_lib')
  35. # first try to build a C-based cython extension
  36. ctx(
  37. features = 'c cshlib pyext',
  38. source = 'src/cy_ctest.pyx',
  39. target = 'cy_ctest',
  40. includes = 'c_lib',
  41. use = 'c_lib')
  42. # then a C++-based one
  43. ctx(
  44. features = 'cxx cxxshlib pyext',
  45. source = 'src/cy_cxxtest.pyx',
  46. target = 'cy_cxxtest',
  47. includes = 'cxx_lib',
  48. use = 'cxx_lib')
  49. # a C++ application which uses a C function from a cython module
  50. ctx(
  51. features = 'cxx cxxprogram pyembed',
  52. source = 'cxx_lib/app.cxx',
  53. target = 'cy-app',
  54. includes = 'cxx_lib src',
  55. use = 'cxx_lib'
  56. )