wscript 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. import os
  4. import sys
  5. APPNAME = 'nanomsgxx'
  6. VERSION = '0.1'
  7. def build(waf):
  8. cflags = ['-W', '-Wall', '-Wextra', '-fvisibility=hidden']
  9. cxxflags = ['-W', '-Wall', '-Wextra', '-std=c++11']
  10. defines = []
  11. includes = [os.path.join(waf.path.abspath(), 'src')]
  12. libpath = ['src/nanomsg/ext', 'src/nnxx']
  13. if waf.options.debug:
  14. cflags += ['-g3']
  15. cxxflags += ['-g3']
  16. else:
  17. cflags += ['-O3']
  18. cxxflags += ['-O3']
  19. defines += ['NDEBUG=1']
  20. waf.env.C_CONF_KWARGS = {
  21. 'includes': includes,
  22. 'libpath' : libpath,
  23. 'defines' : defines,
  24. 'cflags' : cflags,
  25. }
  26. waf.env.CXX_CONF_KWARGS = {
  27. 'includes': includes,
  28. 'libpath' : libpath,
  29. 'defines' : defines,
  30. 'cflags' : cflags,
  31. 'cxxflags': cxxflags,
  32. }
  33. waf.recurse('src/nanomsg/ext')
  34. waf.recurse('src/nnxx')
  35. if not waf.options.notests:
  36. waf.recurse('tests')
  37. if waf.env.with_doc:
  38. waf.recurse('doc')
  39. if waf.env.with_pkgconfig:
  40. waf(source='libnnxx.pc.in', install_path='${LIBDIR}/pkgconfig/')
  41. def configure(waf):
  42. waf.load('compiler_c compiler_cxx c_config waf_unit_test')
  43. waf.recurse('src/nanomsg/ext')
  44. waf.recurse('src/nnxx')
  45. if waf.options.nodoc:
  46. waf.env.with_doc = False
  47. else:
  48. waf.env.with_doc = True
  49. try:
  50. waf.recurse('doc')
  51. except Exception:
  52. sys.stderr.write('Disabling documentation build...\n')
  53. waf.env.with_doc = False
  54. waf.env.with_pkgconfig = not waf.options.nopkgconfig
  55. waf.env.with_strip = waf.options.strip
  56. waf.env.install_html_path = waf.options.install_html_path
  57. def dist(waf):
  58. waf.algo = 'tar.gz'
  59. waf.files = all_files(waf)
  60. def options(waf):
  61. def add_bool(name, help):
  62. waf.add_option(name, action='store_true', help=help)
  63. waf.load('compiler_c compiler_cxx waf_unit_test')
  64. add_bool('--debug', 'build in debug mode')
  65. add_bool('--static', 'build static library')
  66. add_bool('--shared', 'build shared library (default)')
  67. add_bool('--notests', 'turn off tests')
  68. add_bool('--nodoc', 'turn off documentation')
  69. add_bool('--nopkgconfig', 'turn off pkg-config support')
  70. add_bool('--strip', 'runs the \'strip\' utility on the build')
  71. waf.recurse('doc')