Difference between revisions of "Apertium on Windows"

From Apertium
Jump to navigation Jump to search
(Added lttoolbox section)
Line 63: Line 63:
 
=== Installing flex ===
 
=== Installing flex ===
 
If you have downloaded the binary archive, unzip them into something like C:\Program Files\Flex. If you downloaded the Windows installer, then just follow the installation wizard :).
 
If you have downloaded the binary archive, unzip them into something like C:\Program Files\Flex. If you downloaded the Windows installer, then just follow the installation wizard :).
  +
  +
== Building lttoolbox ==
  +
  +
Before you can build lttoolbox, you need to tell CMake where to find the libxml files (under Linux, CMake will use pkg-config to find where the packages are installed). Open lttoolbox-unicode\CMakeLists.txt and modify the lines
  +
<pre>
  +
SET(LIBXML2_INCLUDE_DIR E:\\home\\wynand\\libxml2-2.6.30.win32\\include)
  +
SET(LIBXML2_LIBRARIES E:\\home\\wynand\\libxml2-2.6.30.win32\\lib\\libxml2.lib)
  +
</pre>
  +
to match your installtion. If you have followed the previous instructions, you would likely change these to:
  +
<pre>
  +
SET(LIBXML2_INCLUDE_DIR C:\\Program\ Files\\libxml2\\include)
  +
SET(LIBXML2_LIBRARIES C:\\Program\ Files\\libxml2\\lib\\libxml2.lib)
  +
</pre>
  +
  +
Now, in the Visual Studio command prompt change the directory to lttoolbox-unicode and execute
  +
<pre>
  +
cmakesetup .
  +
</pre>
  +
  +
Click on the configure button. Then click OK. If all is well, CMake should generate NMake files. To compile, simply execute:
  +
<pre>
  +
nmake
  +
</pre>
  +
  +
   
 
[[Category:Installation]]
 
[[Category:Installation]]

Revision as of 15:39, 8 January 2008

We are in the process of porting Apertium to Windows. Lttoolbox has already been compiled successfully, but has not been tested extensively. We are now working on porting Apertium.

Getting the code

The Windows branch is currently in the unofficial GIT repository under the "windows" branch. To contribute, first follow the steps on Using the Apertium GIT repository. Now, we'll create a branch called "windows", which will track the "windows" branch in the remote repository:

  git branch --track windows origin/windows

To switch to the "windows" branch, issue:

  git checkout windows

Dependencies

You will need to get Windows versions of the following tools and libraries to compile the code under Windows:

  • Microsoft's C++ compiler - the compiler is part of Visual Studio 2008 Express, which is available free of charge.
  • CMake - a cross platform build tool
  • libxml - the Windows binaries are at http://xmlsoft.org/sources/win32/; you will need:
    • libxml2
    • zlib
    • libiconv
    • libxslt
  • libpcre - there are no Windows binaries available and you will have to build this from the source code.
  • flex for Windows - it's probably easiest if you just download the Windows installer version.

Setting up the required tools and libraries

Installing Visual Studio

Be sure to start downloading Visual Studio 2008 first, since it is a fairly big download.

Installing CMake

Next, download and install the Windows version of CMake. Let the installer place CMake in your path, since it will be much easier to run CMake from the command line if you do this.

Installing the libxml libraries

The zip files of libxml2, zlib, libiconv and libxslt all have the familiar UNIX layout:

|- bin
|- include
|- lib
|- share

Unzip each of these archives and copy the bin, include, lib and share directories in each package into a common directory (for example C:\Program Files\libxml2).

Building and installing libpcre

Now, unzip the libpcre archive to a temporary folder. To compile libpcre, you will need have Visual Studio AND CMake already installed on your system. Now, open the Visual Studio 8.0 Command Prompt (Start -> Visual C++ 9.0 Express Edition -> Visual Studio Tools -> Visual Studio 8.0 Command Prompt). In this command prompt, go to the directory where you unpacked libpcre. Execute:

cmakesetup .

Click the button labelled "Configure". After CMake has gone through its motions, click OK. To compile libpcre, run:

nmake

After the compilation has succeeded, run:

nmake install

Provided that you haven't changed any setting when you ran the cmakesetup program, libpcre should install to C:\Program Files\PCRE.

Installing flex

If you have downloaded the binary archive, unzip them into something like C:\Program Files\Flex. If you downloaded the Windows installer, then just follow the installation wizard :).

Building lttoolbox

Before you can build lttoolbox, you need to tell CMake where to find the libxml files (under Linux, CMake will use pkg-config to find where the packages are installed). Open lttoolbox-unicode\CMakeLists.txt and modify the lines

SET(LIBXML2_INCLUDE_DIR E:\\home\\wynand\\libxml2-2.6.30.win32\\include)
SET(LIBXML2_LIBRARIES E:\\home\\wynand\\libxml2-2.6.30.win32\\lib\\libxml2.lib)

to match your installtion. If you have followed the previous instructions, you would likely change these to:

SET(LIBXML2_INCLUDE_DIR C:\\Program\ Files\\libxml2\\include)
SET(LIBXML2_LIBRARIES C:\\Program\ Files\\libxml2\\lib\\libxml2.lib)

Now, in the Visual Studio command prompt change the directory to lttoolbox-unicode and execute

cmakesetup .

Click on the configure button. Then click OK. If all is well, CMake should generate NMake files. To compile, simply execute:

nmake