tn0001.txt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. How to add a new sample to wxWidgets.
  2. =====================================
  3. To add a new sample "foo" under directory "samples/foo" you need to do
  4. the following: (note that all this applies also to demos: just replace
  5. samples/ with demos/ where needed).
  6. 1. Create the directory samples/foo locally and "svn add" it.
  7. 2. "svn add" the sample sources (usually based on minimal.cpp) as well.
  8. Note that unless your sample requires something special you shouldn't
  9. add foo.rc, foo.ico, ... any more, please just reuse the generic sample.*
  10. files in the samples subdirectory.
  11. 3. Create the makefiles:
  12. a) modify samples/samples.bkl (just copy an existing line)
  13. b) create foo.bkl (sed 's/minimal/foo/g' minimal.bkl > foo.bkl is usually
  14. enough, but you may need to add more <wx-lib> lines if your sample uses
  15. anything not in the core lib)
  16. c) generate the makefiles for your sample using bakefile. For this you
  17. need to:
  18. (i) install bakefile (see http://bakefile.sf.net/)
  19. (ii) run bakefile_gen in build/bakefiles which will regenerate all
  20. makefiles which are not up to date
  21. You may also use "bakefile_gen -b ../../samples/foo/foo.bkl" to
  22. regenerate only the makefiles for this sample (path must be relative!)
  23. or even add a "-f<compiler>" to generate just the makefiles for the given
  24. compiler (run 'bakefile --help' to get the list of possible values).
  25. See Technote #16 for more information.
  26. d) currently samples/samples.dsw needs to be updated manually as it's not
  27. generated by bakefile.
  28. 4. Modify configure.in Unix compilation:
  29. a) if the sample should only be built if "wxUSE_FOO" is enabled, locate
  30. the test for "wxUSE_FOO = yes" in configure.in and add a line
  31. SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS foo" under it
  32. b) if it should be always built, locate the line "if test $wxUSE_GUI = yes"
  33. near the end of configure.in and modify the assignment to
  34. SAMPLES_SUBDIRS to include "foo" (put in alphabetical order)
  35. After this, regenerate configure from configure.in
  36. by running "autoconf" on a Unix system in the corresponding directory.
  37. 5. Add a short description of what the sample does and how does it work
  38. to the "samples overview" section in the wxWidgets manual. That section
  39. lives in docs/doxygen/mainpages/samples.h; look at the descriptions for
  40. other samples, if you are not familiar with Doxygen.
  41. 6. Add any non-standard sample's files to build/bakefiles/make_dist.mk (the
  42. makefiles copies all bmp, cpp, h, ico, png, rc, xpm and makefiles by
  43. default, you only need to update it if the sample uses some other files)
  44. and run the ./update-manifests.sh script in distrib/scripts (don't forget
  45. to check the changes to manifests/*.rsp files in).
  46. === EOF ===
  47. Author: VZ