1
:version: $RCSfile: index.rst,v $ $Revision: 76e0bf38aaba $ $Date: 2011/03/22 00:48:41 $
5
==================================
6
Maintaining the VS2008 directory
7
==================================
9
This section is geared towards project maintainers of the
10
`tesseract-3.0x\\vs2008` directory, rather than users of it.
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>`_.
18
The `tesshelper.py` Python script
19
=================================
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.
26
Then entering the following command::
28
python tesshelper.py --help
30
displays the following help message::
32
usage: tesshelper.py [-h] [--version] tessDir {compare,report,copy,clean} ...
35
tessDir tesseract installation directory
38
-h, --help show this help message and exit
39
--version show program's version number and exit
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
50
Assume that tesshelper.py is in c:\buildfolder\tesseract-3.01\vs2008,
51
which is also the current directory. Then,
53
python tesshelper .. compare
55
will compare c:\buildfolder\tesseract-3.01 "library" directories to the
57
(c:\buildfolder\tesseract-3.01\vs2008\libtesseract\libtesseract.vcproj).
59
python tesshelper .. report
61
will display summary stats for c:\buildfolder\tesseract-3.01 "library"
62
directories and the libtesseract Project.
64
python tesshelper .. copy ..\..\include
66
will copy all "public" libtesseract header files to
67
c:\buildfolder\include.
69
python tesshelper .. clean
71
will clean the vs2008 folder of all build directories, and .user, .suo,
72
.ncb, and other temp files.
74
Generating the documentation
75
============================
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>`_.
83
To install Sphinx, go to your `<python.2.7.x install dir>\\scripts`
84
directory and just do::
86
easy_install -U Sphinx
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/>`__.]
93
To generate this |Tesseractocr| VS2008 documentation go to
94
`tesseract-3.0x\\vs2008\\Sphinx` and do::
99
Which will create a number of items in
100
`tesseract-3.0x\\vs2008\\Sphinx\\_build\\html`.
102
Copy everything there to the distribution's `tesseract-3.0x\\vs2008\\doc`
103
folder, :bi:`except` for::
108
.. _updating-vs2008-directory:
110
Updating the VS2008 directory for new releases of |Tesseractocr|
111
================================================================
113
1. Change the version number strings in
114
`tesseract-3.0x\\vs2008\\include\\tesseract_versionnumbers.vsprops`.
116
#. Change the version number in
117
`tesseract-3.0x\\vs2008\\port\\version.h`.
119
#. Open up a Command Prompt window, and do the following::
121
cd <tesseract-3.0x install dir>\vs2008
122
python tesshelper .. compare
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::
128
api\tesseractmain.cpp
133
and for the newly missing items ignore::
135
training\commontraining.cpp
136
training\commontraining.h
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).
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.
148
#. Remove the missing items from the :guilabel:`libtesseract-3.0x` Project.
150
#. Add the new items to the :guilabel:`libtesseract-3.0x` Project.
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
160
#. With the Solution closed, use a text editor to change all the
161
Project's `.rc` files to reflect the new version.
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.
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.
172
.. _copying_a_project:
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
180
For example, assuming the new training application is
181
called `new_trainer.exe`, with the Solution closed:
183
a. Copy the `ambiguous_words` directory to a new directory called
186
#. Change the `new_trainer\\ambiguous_words.rc` filename to
187
`new_trainer\\new_trainer.rc`.
189
#. Change the `new_trainer\\ambiguous_words.vcproj` filename to
190
`new_trainer\\new_trainer.vcproj`.
192
#. Edit `new_trainer\\new_trainer.rc` and change all occurrences of
193
``ambiguous_words`` to ``new_trainer``.
195
Also change ``FileDescription`` to describe the new application.
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
203
#. Right-click the newly added Project, and choose
204
:menuselection:`Project Dependencie&s...`.
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.
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.
214
#. (Optional?) Edit `vs2008\\Sphinx\\versions.rst` and add a new entry
215
describing the changes made for this new version.
217
#. To make your working directory suitable for reposting back to the
218
|Tesseractocr| SVN repository, you need to ignore all the following:
220
+ All `LIB_Release`, `LIB_Debug`, `DLL_Release`, `DLL_Debug`
225
+ `vs2008\\newheaders.txt`
226
+ `vs2008\\newsources.txt`
228
Optionally, the `tesshelper.py` script has the ``clean`` command
229
which will remove the above items. To run it, open a Command Prompt
232
cd <tesseract-3.0x install dir>\vs2008
233
python tesshelper .. clean
235
The script will respond with the following::
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
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).
250
indent-tabs-mode: nil
251
sentence-end-double-space: t
255
tab-stop-list: (3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60)