
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
--------------------------------------------------------------

The addressed audience for this section is rather the developers
themselves than those people who build the FreeCAD sources.

* Salome SMESH

The Salome SMESH library needs some special steps in order to be built
because it contains some Fortran code.

1. First get the SMESH sources smesh-5.1.2.2.tar.gz from the Sourceforge download area
2. Make sure that the IDE can find the boost header files
3. Start compiling all the projects. The NETGENPlugin probably fails but this can simply
   be unloaded or removed because we don't need it.
   Except of MESFISTO2 all other projects should compile fine. For MEFISTO2 we get a couple
   of linker errors.
4. Get the f2c utility from http://netlib.sandia.gov/f2c/mswin/index.html
5. Get f2c.h from http://netlib.sandia.gov/f2c/f2c.h.gz
6. Convert the Fortran file trte.f into a C file trte.c using the f2c utility
7. Get the sources for the lib f2c from http://netlib.sandia.gov/f2c/libf2c.zip.
   Unpack the sources and add the compiler switch /MD to makefile.vc. This is needed to
   link against the shared C runtime, not the static one.
8. Remove the __WATCOM__ define from the list of the preprocessor macros of the MESFISTO2
   project.
9. Build the file vcf2c.lib with "nmake -f makefile.vc" and add it to the MEFISTO2 project as
   additional library. The linker errors should now go away.

* FreeType

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