wscript 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2006 (ita)
  4. """
  5. Note: the #warning will come once when the .h is compiled, it should not not come when the .cpp is compiled when precompiled headers are enabled
  6. Compare:
  7. waf configure clean build
  8. and
  9. waf configure clean build --without-pch
  10. """
  11. VERSION='0.0.2'
  12. APPNAME='pch_test'
  13. top = '.'
  14. out = 'build'
  15. from waflib import Errors
  16. # to include <boost/asio.hpp> to slow down compilation of precompiled headers
  17. LOAD_BOOST = False
  18. def options(opt):
  19. opt.load('compiler_cxx')
  20. opt.load('pch')
  21. if LOAD_BOOST:
  22. opt.load('boost', mt=True)
  23. def configure(conf):
  24. conf.load('compiler_cxx pch')
  25. if LOAD_BOOST:
  26. conf.load('boost')
  27. conf.check_boost('thread system', mt=True)
  28. #conf.env.append_value('LIB_BOOST', 'pthread') #?
  29. conf.env.append_value('DEFINES_BOOST', ['HAS_MY_BOOST=1'])
  30. def build(bld):
  31. # Simple way, when precompiled header is used in a single build task
  32. bld.program(
  33. target = 'test',
  34. features = 'pch',
  35. source = 'a.cpp b.cpp c.cpp main.cpp',
  36. headers = 'a.h b.h c.h',
  37. use = 'BOOST')
  38. # More complex way, where precompiled header is reused by several build tasks
  39. bld(features ='cxx pch',
  40. name = 'base-with-pch',
  41. target = 'pch-header',
  42. headers = 'a.h b.h c.h',
  43. source = 'a.cpp',
  44. use = 'BOOST')
  45. bld.program(
  46. target = 'test1',
  47. source = 'b.cpp c.cpp main.cpp',
  48. use = 'base-with-pch')