~vcs-imports/tesseract-ocr/trunk

« back to all changes in this revision

Viewing changes to vs2008/doc/_sources/maintenance.txt

  • Committer: zdenop at gmail
  • Date: 2012-02-26 15:30:05 UTC
  • Revision ID: svn-v4:d0cd1f9f-072b-0410-8dd7-cf729c803f20:trunk:681
vs2008 and vs2010 replaced with Tom Powers solution

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
:version: $RCSfile: index.rst,v $ $Revision: 76e0bf38aaba $ $Date: 2011/03/22 00:48:41 $
 
2
 
 
3
.. default-role:: fs
 
4
 
 
5
==================================
 
6
 Maintaining the VS2008 directory
 
7
==================================
 
8
 
 
9
This section is geared towards project maintainers of the
 
10
`tesseract-3.0x\\vs2008` directory, rather than users of it.
 
11
 
 
12
Python 2.7.x (*not* 3.x) is required for this section. The recommended
 
13
version is the `latest from ActiveState
 
14
<http://www.activestate.com/activepython/downloads>`_.
 
15
 
 
16
.. _tesshelper:
 
17
 
 
18
The `tesshelper.py` Python script
 
19
=================================
 
20
 
 
21
`tesshelper.py` performs a number of useful maintenance related
 
22
operations on the `tesseract-3.0x\\vs2008` directory. To run it, first
 
23
open a Command Prompt window and navigate to the `<tesseract install
 
24
dir>\\vs2008` directory.
 
25
 
 
26
Then entering the following command::
 
27
 
 
28
   python tesshelper.py --help
 
29
 
 
30
displays the following help message::
 
31
 
 
32
   usage: tesshelper.py [-h] [--version] tessDir {compare,report,copy,clean} ...
 
33
 
 
34
   positional arguments:
 
35
     tessDir               tesseract installation directory
 
36
 
 
37
   optional arguments:
 
38
     -h, --help            show this help message and exit
 
39
     --version             show program's version number and exit
 
40
 
 
41
   Commands:
 
42
     {compare,report,copy,clean}
 
43
       compare             compare libtesseract Project with tessDir
 
44
       report              report libtesseract summary stats
 
45
       copy                copy public libtesseract header files to includeDir
 
46
       clean               clean vs2008 folder of build folders and .user files
 
47
 
 
48
   Examples:
 
49
 
 
50
   Assume that tesshelper.py is in c:\buildfolder\tesseract-3.01\vs2008,
 
51
   which is also the current directory. Then,
 
52
 
 
53
       python tesshelper .. compare
 
54
 
 
55
   will compare c:\buildfolder\tesseract-3.01 "library" directories to the
 
56
   libtesseract Project
 
57
   (c:\buildfolder\tesseract-3.01\vs2008\libtesseract\libtesseract.vcproj).
 
58
 
 
59
       python tesshelper ..  report
 
60
 
 
61
   will display summary stats for c:\buildfolder\tesseract-3.01 "library"
 
62
   directories and the libtesseract Project.
 
63
 
 
64
       python tesshelper .. copy ..\..\include
 
65
 
 
66
   will copy all "public" libtesseract header files to
 
67
   c:\buildfolder\include.
 
68
 
 
69
       python tesshelper .. clean
 
70
 
 
71
   will clean the vs2008 folder of all build directories, and .user, .suo,
 
72
   .ncb, and other temp files.
 
73
 
 
74
Generating the documentation
 
75
============================
 
76
 
 
77
The source files for the documentation you are currently reading are
 
78
written in `reStructuredText
 
79
<http://docutils.sourceforge.net/rst.html>`_ and processed with the
 
80
`Sphinx Python Documentation Generator
 
81
<http://sphinx.pocoo.org/index.html>`_.
 
82
 
 
83
To install Sphinx, go to your `<python.2.7.x install dir>\\scripts`
 
84
directory and just do::
 
85
 
 
86
   easy_install -U Sphinx
 
87
 
 
88
which will download Sphinx and all its dependencies. [Note: This might
 
89
*not* install the Python Imaging Library. If not, then also do
 
90
``easy_install -U PIL`` or download it from `here
 
91
<http://www.pythonware.com/products/pil/>`__.]
 
92
 
 
93
To generate this |Tesseractocr| VS2008 documentation go to
 
94
`tesseract-3.0x\\vs2008\\Sphinx` and do::
 
95
 
 
96
   make clean
 
97
   make html
 
98
 
 
99
Which will create a number of items in
 
100
`tesseract-3.0x\\vs2008\\Sphinx\\_build\\html`.
 
101
 
 
102
Copy everything there to the distribution's `tesseract-3.0x\\vs2008\\doc`
 
103
folder, :bi:`except` for::
 
104
 
 
105
   .buildinfo
 
106
   objects.inv
 
107
 
 
108
.. _updating-vs2008-directory:
 
109
 
 
110
Updating the VS2008 directory for new releases of |Tesseractocr|
 
111
================================================================
 
112
 
 
113
1. Change the version number strings in
 
114
   `tesseract-3.0x\\vs2008\\include\\tesseract_versionnumbers.vsprops`.
 
115
 
 
116
#. Change the version number in
 
117
   `tesseract-3.0x\\vs2008\\port\\version.h`.
 
118
 
 
119
#. Open up a Command Prompt window, and do the following::
 
120
 
 
121
      cd <tesseract-3.0x install dir>\vs2008
 
122
      python tesshelper .. compare
 
123
 
 
124
   This will list all added and missing items in the `<tesseract-3.0x install
 
125
   dir>` directories that are used to build `libtesseract`. For the
 
126
   newly added items ignore::
 
127
 
 
128
      api\tesseractmain.cpp 
 
129
      api\tesseractmain.h 
 
130
      ccutil\scanutils.cpp 
 
131
      ccutil\scanutils.h 
 
132
 
 
133
   and for the newly missing items ignore::
 
134
 
 
135
      training\commontraining.cpp 
 
136
      training\commontraining.h 
 
137
      training\tessopt.cpp 
 
138
      training\tessopt.h 
 
139
 
 
140
#. Open up the `tesseract.sln` in Visual Studio 2008 (or Visual C++ 2008
 
141
   Express Edition but see :ref:`this 
 
142
   <building-with-vc2008-express>` first).
 
143
 
 
144
   a. In the Solution Explorer, rename the :guilabel:`libtesseract-3.0x`
 
145
      Project to the correct version number to make it obvious which
 
146
      version of |Tesseractocr| this Solution is for.
 
147
 
 
148
   #. Remove the missing items from the :guilabel:`libtesseract-3.0x` Project.
 
149
 
 
150
   #. Add the new items to the :guilabel:`libtesseract-3.0x` Project.
 
151
 
 
152
      If there were a lot of new items, you can use the `newheaders.txt`
 
153
      and `newsources.txt` files generated by running the
 
154
      `tesshelper.py` script with the ``compare`` command. Close the
 
155
      Solution, and then you can directly edit
 
156
      `libtesseract\\libtesseract.vcproj` to add them to the appropriate
 
157
      ``<Filter> ... </Filter>`` section (either ``Header Files`` or
 
158
      ``Source Files``).
 
159
 
 
160
#. With the Solution closed, use a text editor to change all the
 
161
   Project's `.rc` files to reflect the new version.
 
162
 
 
163
   If you have a program like the *non-free* `PowerGrep
 
164
   <http://www.powergrep.com/>`_, you can use it to change all the
 
165
   `.rc` files in one fell swoop.
 
166
 
 
167
   Alternatively, you can edit the Version resources within Visual
 
168
   Studio 2008 (but *not* Visual C++ 2008 Express Edition) and then
 
169
   manually make the changes mentioned :ref:`here
 
170
   <building-with-vc2008-express>` afterwards.
 
171
 
 
172
   .. _copying_a_project:
 
173
 
 
174
#. If a new training application was added (edit
 
175
   `tesseract-3.0x\\training\\Makefile.am` and look at the
 
176
   ``bin_PROGRAMS`` variable to see the list), the easiest thing to do
 
177
   is copy another existing training application Project and manually
 
178
   change it.
 
179
 
 
180
   For example, assuming the new training application is
 
181
   called `new_trainer.exe`, with the Solution closed:
 
182
 
 
183
   a. Copy the `ambiguous_words` directory to a new directory called
 
184
      `new_trainer`.
 
185
 
 
186
   #. Change the `new_trainer\\ambiguous_words.rc` filename to
 
187
      `new_trainer\\new_trainer.rc`.
 
188
 
 
189
   #. Change the `new_trainer\\ambiguous_words.vcproj` filename to
 
190
      `new_trainer\\new_trainer.vcproj`.
 
191
 
 
192
   #. Edit `new_trainer\\new_trainer.rc` and change all occurrences of
 
193
      ``ambiguous_words`` to ``new_trainer``.
 
194
 
 
195
      Also change ``FileDescription`` to describe the new application.
 
196
 
 
197
   #. Open up the |Tesseractocr| Solution file and right-click the
 
198
      :guilabel:`Solution:'tesseract'` in the Solution Explorer. Choose
 
199
      :menuselection:`A&dd --> &Existing Project...` from the context
 
200
      menu and add the `new_trainer\\new_trainer.vcproj` you just
 
201
      created.
 
202
 
 
203
   #. Right-click the newly added Project, and choose
 
204
      :menuselection:`Project Dependencie&s...`.
 
205
 
 
206
      The :guilabel:`Project Dependencies` Dialog will open. Make sure
 
207
      that `libtesseract30x` is checked. If you forget this step, Visual
 
208
      Studio will not automatically link with `libtesseract` and
 
209
      you'll get lots of "unresolved external symbol" errors.
 
210
 
 
211
   This actually goes pretty fast. It should only take you a minute or
 
212
   so to add a new application to the |Tesseractocr| Solution.
 
213
 
 
214
#. (Optional?) Edit `vs2008\\Sphinx\\versions.rst` and add a new entry
 
215
   describing the changes made for this new version.
 
216
   
 
217
#. To make your working directory suitable for reposting back to the
 
218
   |Tesseractocr| SVN repository, you need to ignore all the following:
 
219
 
 
220
   + All `LIB_Release`, `LIB_Debug`, `DLL_Release`, `DLL_Debug`
 
221
     directories
 
222
   + All `.suo` files
 
223
   + All `.user` files
 
224
   + All `.ncb` files
 
225
   + `vs2008\\newheaders.txt`
 
226
   + `vs2008\\newsources.txt`
 
227
 
 
228
   Optionally, the `tesshelper.py` script has the ``clean`` command
 
229
   which will remove the above items. To run it, open a Command Prompt
 
230
   window and then do::
 
231
 
 
232
      cd <tesseract-3.0x install dir>\vs2008
 
233
      python tesshelper .. clean
 
234
 
 
235
   The script will respond with the following::
 
236
 
 
237
      Are you sure you want to clean the
 
238
       "C:\BuildFolder\tesseract-3.0x\vs2008" folder (Yes/No) [No]? yes
 
239
      Only list the items to be deleted (Yes/No) [Yes]? no
 
240
 
 
241
   You have to answer ``yes`` and then ``no`` to the prompts. Otherwise
 
242
   either the script will just exit, or only list the items that will be
 
243
   removed instead of actually removing them (which is a good thing to
 
244
   try first just in case).
 
245
 
 
246
..         
 
247
   Local Variables:
 
248
   coding: utf-8
 
249
   mode: rst
 
250
   indent-tabs-mode: nil
 
251
   sentence-end-double-space: t
 
252
   fill-column: 72
 
253
   mode: auto-fill
 
254
   standard-indent: 3
 
255
   tab-stop-list: (3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60)
 
256
   End: