
How to build and run FreeCAD under Windows
==========================================

Prerequisites
-------------

On Windows we use the IDE MS VisualStudio 9 with the highest service pack.
In case you don't want to use MS products you can also use the MinGW compiler,
alternatively. In this case continue on reading the manual README.MinGW.
You need cMake 2.6 or higher to generate the project files for VisualStudio.
Also you need all the 3rd party libraries to succsefully compile FreeCAD.

Using LibPack
-------------

To make it easier to get FreeCAD compiled, we provide a collection of all 
needed libraries. It's called the LibPack. You can find it on the download 
page on sourceforge.

Python needed
-------------

During the compilation some Python scripts get executed. So the Python interpreter 
has to function on the OS. Use a command box to check it. If the Python library is 
not properly installed you will get an error message like Cannot find python.exe. 
If you use the LibPack you can also use the python.exe in the bin directory.

Compile
-------

In order to build the FreeCAD sources start the GUI frontend of cmake. If
doesn't already find the header files and libraries of the LibPack you have to
define the path where you have unpacked it.

After you conform to all prerequisites the compilation is - hopefully - only 
a mouse click in VC ;-)

After Compiling
---------------

To get FreeCAD up and running from the compiler environment you need to move a 
few files from the LibPack to the "bin" folder where FreeCAD.exe is installed 
after a successfull build:

    * python.exe and python_d.exe from LIBPACK/bin
    * python26.dll and python26_d.dll from LIBPACK/bin
    * python26.zip from LIBPACK/bin
    * make a copy of python26.zip and rename it to python26_d.zip


Additional stuff
----------------

If you want to build the source code documentation you need DoxyGen.
To create an intstaller package you need WIX. 


Additional information on building special 3rd party libraries
--------------------------------------------------------------

* Mefisto2F

The Salome SMESH library needs the Mefisto2F library which contains some Fortran code.
The easiest way is to convert the Fortran code into C code and use the f2c library to
build a static library.

1. Get the f2c utility from http://netlib.sandia.gov/f2c/mswin/index.html
2. Convert the Fortran file trte.f into a C file trte.c using the f2c utility
   >>> f2c trte.f
3. Get the sources for the lib f2c from http://netlib.sandia.gov/f2c/libf2c.zip and
   unpack them.
4. Apply the patch 'mefisto2f.patch'
5. Run nmake -f makefile.vc

Alternatively, you can use the Watcom Fortran compiler. The needed project file can be get from
here: http://sourceforge.net/p/salomesmesh/code/HEAD/tree/trunk/adm/win32-watcom/
However, this doesn't work for x64 targets at the moment.

* FreeType

http://stackoverflow.com/questions/6207176/compiling-freetype-to-dll-as-opposed-to-static-library
