← Back to team overview

cuneiform team mailing list archive

Re: Patch to build in MSVC++ (MSK export definitions)

 

Hey, Dmitry & Jussi!

I was finally able to get it running (Microsoft Windows Vista SP1)! Yay!
I've got it to compile with both Microsoft Visual Studio Express 2008
(didn't try with SP1 yet, still have to download the ISO which is really
HUGE!) and MinGW bundled with the latest version of Code::Blocks.

I attach the build scripts based on Dmitry's approach for MSVC 8 & 9 and
MinGW. I feel that if they can be included in the root of the trunk they
will be of great help for the Windows developers.

The MinGW script is a bit tricky, because you have to edit the variable
pointing to the MinGW installation, but I have not found a way around
it, because the problem is that Joe Random Windows Hacker might have
lots of different potentially interfering things installed. For
instance, I had gcc from Free Pascal and make from Borland Delphi on my
PATH so cmake initially didn't work.

I documented the whole process, please find the patch for the readme.txt
enclosed.

The "Debug" build in MSVC is completely unusable, because it keeps
showing the warnings all along the way (see screenshot at
http://bayimg.com/GANKDaabe), but the Release build works fine. I have
attached the build log (Release) in case anyone is interested.

By the way, building on Windows is REALLY slow. It take an eternity to
build it with MSVC and with MinGW it's even slower! On the very same
hardware it takes me half a minute on Linux, and several painful minutes
on Windows.

I have just downloaded MSVC 2008 Express SP1 so probably I would be able
to provide SP1-builds in future (unless it screws my system up... it's
Windows stuff after all).

Cheers!
 
-- 
Sincerely yours,
Yury V. Zaytsev
rem Makefile generator for MingW

set MINGW=C:\Program Files\CodeBlocks\MinGW\bin

if not exist build.mingw mkdir build.mingw
cd build.mingw

set PATH=%MINGW%;%PATH%

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=release ..

mingw32-make
rem Solution generator for Microsoft Visual C++ Express 2005
if not exist build.msvc8 mkdir build.msvc8
cd build.msvc8
cmake -G "Visual Studio 8 2005" -DCMAKE_BUILD_TYPE=release ..
rem Solution generator for Microsoft Visual C++ Express 2008
if not exist build.msvc9 mkdir build.msvc9
cd build.msvc9
cmake -G "Visual Studio 9 2008" -DCMAKE_BUILD_TYPE=release ..
=== modified file 'readme.txt'
--- readme.txt	2008-12-30 14:43:36 +0000
+++ readme.txt	2009-01-28 20:07:55 +0000
@@ -1,8 +1,9 @@
 Cuneiform for Linux 0.5.0
+=========================
 
 Cuneiform is an multi-language OCR system originally developed
 and open sourced by Cognitive Technologies. Cuneiform was
-originally a Windows program, which was ported to Linux
+initially a Windows program, which was ported to Linux
 by Jussi Pakkanen. 
 
 This version of Cuneiform has been tested to work on the following
@@ -10,8 +11,8 @@
 
 Linux
 FreeBSD
-OS X
-Windows XP
+MacOS X
+Windows XP/Vista
 
 The following people have sent patches or have otherwise helped the
 project. If someone is missing, please let me know, so I can add them.
@@ -29,27 +30,28 @@
 Mike Ladwig
 Dmitri Polevoy
 Steven Van Ingelgem
-
+Yury V. Zaytsev
 
 Caveats
+=======
 
 This port is has several limitations. Among the biggest ones are:
 
-- Windows version compiles only with MinGW
-- it only works on x86 and amd64 processors
-- there is no table recognition, because of
+- It only works on x86 and amd64 processors
+- There is no table recognition, because of
   https://bugs.launchpad.net/cuneiform-linux/+bug/260327
 
 Patches to fix any of these issues are gladly accepted.
 
 
 Compiling
+=========
 
 Extract the source and go to the root folder (the one this file is in).
 Then type the following commands:
 
-mkdir builddir
-cd builddir
+mkdir build.gcc
+cd build.gcc
 cmake -DCMAKE_BUILD_TYPE=debug ..
 make
 make install 
@@ -65,15 +67,46 @@
 If you want to run Cuneiform without installing it on your system, you
 have to point the CF_DATADIR environment variable to a directory
 containing the .dat files. These can be found in the "datafiles"
-directory of the source package.
-
-WINDOWS NOTE: Cuneiform tries to access its data files in the
+directory of the source package. E.g.:
+
+CF_DATADIR=/path/to/datafiles cuneiform -l rus -o test.txt test.bmp
+
+Platform-specific notes
+-----------------------
+
+Microsoft Windows
+
+In order to compile Cuneiform under Windows you have to use either
+Microsoft Visual Studio (Express editions ARE supported) or MinGW.
+First download and install latest CMake for Windows bundle from 
+the KitWare's website:
+
+http://www.cmake.org/cmake/resources/software.html
+
+Then run build.msvc*.cmd or build.mingw.cmd depending on which
+compiler you are going to use for CMake to configure the build 
+environment.
+
+Please be sure to correctly set the MINGW variable which should
+point to your MinGW installation! By default, it assumes that
+you are using the distribution bundled with Code::Blocks, but
+you are free to use whichever distribution you want, provided
+that you set the correct path.
+
+If you have chosen MinGW, the compilation will start right away,
+otherwise, open build.msvc*/cuneiform.sln in Microsoft Visual 
+Studio and proceed with the compilation as usual (choose 
+Build -> Build solution or hit F7).
+
+NOTE: Cuneiform tries to access its data files in the
 directory that contains the DLLs. You can place Cuneiform
 anywhere you want on your hard drive, just put the .dat files
 in the same directory. This works also when using Cuneiform
 as a library.
 
+
 Running
+=======
 
 After install you simply run.
 
@@ -91,8 +124,8 @@
 To get a list run the command "cuneiform -f".
 
 
-
 Contact information
+===================
 
 Project home page: https://launchpad.net/cuneiform-linux
 Mailing list: https://launchpad.net/~cuneiform

Attachment: buildlog.msvc.txt.bz2
Description: application/bzip


References