# Compile on Windows with VS2013

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Other languages:
English • ‎français • ‎italiano • ‎română
Important Note:

The following procedure will work for compiling on Windows Vista/7/8, for XP an alternate VS tool set is required for VS 2012 and 2013, which has not been tested successfully with the current Libpacks. To target XP(both x32 and x64) it is recommended to use VS2008 and Libpack FreeCADLibs_11.0_x86_VC9.7z

## Prerequisites

### Windows Libpack

FreeCAD is built upon a number of third party libraries. For the users convenience FreeCAD supplies Libpacks that contain all the necessary dependencies so you don't have to compile them yourself.

Libpacks are available for x32 and x64 for VC12(Visual Studio 2013) The Libpacks will work with both the Professional and Express/Community Editions of Visual Studio. Choose the Libpack relevant to your system architecture and Compiler.

Assuming that your Win 7 or later, x64, and planning to use VS2013 Community Edition choose:

Extract the Libpack to a directory on your hard drive.

### Source Code

#### Using Git(Preferred)

Some information how to set-up a local tracking branch and a working branch can be found here:

To create a local tracking branch and download the source code you need to open a terminal(command prompt) and cd to the directory you want the source, then type:

Now you have the source code and the tools you'll need to compile FreeCAD on Windows.

Note:

This is Source Cade Snapshot not Development Snapshot pre-compiled binaries.

You will need to extract this to a directory using 7zip or Window's default .zip extractor.

### Visual Studio

Lastly you will need the C-compiler. MS VS 12 2013 Community Edition Update 4 is Free for personal and Open Source Projects. It can be downloaded here:

## Configuring and Generating with Cmake

### First Pass

Start the CMake GUI by double-clicking on the desktop icon created during installation.

Specify source folder (This is where you cloned or extracted the source code)

Specify build folder (This is where you want to build the source, if it doesn't exist Cmake will prompt you to create it)

Click Configure

Specify the generator as Visual Studio 12 x64(or the alternate C-Compiler you are using)

This will begin configuration and should fail because the location of FREECAD_LIBPACK_DIR is unset.

Expand the FREECAD category and set:

FREECAD_LIBPACK_DIR          "...\Path\to\Libpack" (Ex: C:\user\USERNAME\FreeCADLibs_11.0_x64_VC12)
FREECAD_USE_FREETYPE         (Check)

FREETYPE is optional. It is necessary to take advantage of the DRAFT Work Bench's Shape String functionality. Under normal situations it is a desirable option.

### Configure and Generate

Click Configure again (There should be no errors)

Click Generate (missing doxgen is OK, unless you are a developer and need the source documentation)

Close Cmake

## Dependencies

Copy The Libpack\bin folder into the new build folder CMake created.

You could put the Libpack in your system PATH environment variable. but you still are required to copy some files?

## Building with Visual Studio

Start Visual Studio 12 2013 by clicking on the desktop icon created at installation.

Open the project by: File -> Open -> Project/Solution

Open FreeCAD_Trunk.sln from the build folder CMake created

Switch the Solutions Configuration drop down at the top to Release X64

Build -> Build Solution

This will take a long time...

If you don't get any errors your done. Exit Visual Studio and start FreeCAD by double clicking the FreeCAD icon in the bin folder of the build directory.