tn0021.txt 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. How to add a new wxUSE_XXX preprocessor constant
  2. ================================================
  3. 0. Purpose
  4. ----------
  5. Detailed description of what needs to be done when you want to add a new
  6. wxUSE_XXX compilation flag. The text below assumes you need new wxUSE_FOO.
  7. 1. Overview
  8. -----------
  9. wxWidgets uses wxUSE_XXX macros for conditionally compiling in (or not)
  10. optional components. In general, whenever a new non critical (i.e. not
  11. absolutely required by important parts of the library) class Foo is added it
  12. should use its own wxUSE_FOO compilation flag.
  13. wxUSE_FOO must be always defined and have value of 0 or 1. Be careful with
  14. testing for it in wx/foo.h: don't do it at the very beginning of the file
  15. because then wxUSE_FOO would be not defined at all if the user directly
  16. includes wx/foo.h, include "wx/defs.h" before testing for wxUSE_FOO.
  17. 2. Required files update
  18. ------------------------
  19. Assuming wxUSE_FOO is used on all platforms, the following must be done:
  20. a) update include/wx/setup_inc.h
  21. This file contains all common wxUSE_XXXs, and is used to update wxMSW, wxMac
  22. setup.h and Unix setup.h.in using build/update-setup-h. Please try to add
  23. the new define in a logical place (i.e. near any related ones) and write a
  24. detailed comment explaining what does it do and why would you want to turn
  25. it on/off. Choose the appropriate default value: this should be usually 1
  26. but can be 0 if there are some problems preventing the use of Foo by default
  27. (e.g. it requires installation of some non standard 3rd party libraries).
  28. After changing this file, run the update-setup-h script (this is probably
  29. better done on a Unix machine although it should work under Cygwin too).
  30. b) update other setup.h files
  31. Currently include/wx/univ/setup.h and setup.h_vms are not automatically
  32. updated so please update them manually (or modify the update-setup-h script
  33. to take care of them...).
  34. c) update configure.in
  35. Here you need to add DEFAULT_wxUSE_FOO define. It should be added in the
  36. block beginning after WX_ARG_CACHE_INIT line and should default to "no" for
  37. "if DEBUG_CONFIGURE = 1" branch (this is used for absolutely minimal builds)
  38. and the same as default value in setup_inc.h in the "else" branch.
  39. You also need to add a WX_ARG_ENABLE (or, if new functionality can be
  40. reasonably described as support for a 3rd party library, WX_ARG_WITH)
  41. line togetherw with all the existing WX_ARG_ENABLEs.
  42. If you have a sample/foo which should be only built when wxUSE_FOO==1,
  43. then only add it to the SAMPLES_SUBDIRS if wxUSE_FOO=yes in configure.
  44. 3. Documentation
  45. ----------------
  46. Currently wxUSE_XXXs are documented in docs/latex/wx/wxusedef.tex and a few
  47. important global ones are in docs/latex/wx/cppconst.tex.
  48. === EOF ===
  49. Author: VZ