Build from source

From LibreCAD wiki
Revision as of 03:47, 2 June 2013 by Dli (Talk | contribs)

Jump to: navigation, search

Building LibreCAD 2.0 on Windows

To build LibreCAD from the lastest development version, you will need tools: git , Qt, boost, and muParser.

The ways to get LibreCAD source code in Windows are described at [1].


Download Qt from : [2]. Qt-5.0.1 for Windows 32 bit (MinGW 4.7) is used as an example in this article.

Install Qt (including Qt-Creator) to \Qt\Qt5.0.1\ (Assuming you install everything to C:\ , the same assumption thereafter)

Install the MinGW tools are at: \Qt\Qt5.0.1\Tools\MinGW\bin\


Introduction for boost can be found here boost introduction.

Download boost from: boost download.

unzip the boost files to the directory: \boost\ , and for the version boost-1.53.0, the boost files will be located in \boost\boost_1_53_0\ .

Verify that you have the file \boost\boost_1_53_0\booststrap.bat. You don't have build boost in order to build LibreCAD, as LibreCAD uses header only part of boost currently.

within the LibreCAD source folder, edit the file accordingly,

   BOOST_DIR = /boost/boost_1_53_0/
   BOOST_LIBDIR = /boost/boost_1_53_0/


muParser is at muParser.

Download muParser source from: muParser Download

unzip the muParser source files to \muparser\muparser_v2_2_3 (for muParser-2.2.3).

Steps to build muParser with MinGW:

run DOS prompt as Administrator (Start->All Programs->Accessories->Command Prompt , right click and choose "Run as administrator") in DOS prompt, type in:

   set PATH=C:\Qt\Qt5.0.1\Tools\MinGW\bin;%PATH%
   cd \muparser\muparser_v2_2_3\build
   C:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe -f makefile.mingw

muParser should build smoothly.

within the LibreCAD source folder, edit the file accordingly,

   MUPARSER_DIR = /muparser/muparser_v2_2_3

Building LibreCAD in Qt-Creator

Launch Qt-Creator and open the project file within the LibreCAD source folder. Accept Qt path detected by Qt-Creator by clicking "Configure Project" button, if the project is not configured yet.

If everything is good up to this point, you can build and run LibreCAD within Qt-Creator.

Building Windows by command line

A command line building script file is added as scripts/build-windows.bat To be able to use this batch file, you need to have your Qt directories set up first. In the file scripts/build-windows.bat, Qt_Dir is set:

   set Qt_DIR=C:\Qt\Qt5.0.2\5.0.2

and if you point Qt_DIR to the folder where you have installed your Qt to. You should have the Qt/MinGW tools at:


To start building, go to the scripts/ folder within the LibreCAD source folder from Windows command prompt

   cd scripts

run the build-windows.bat


Building Windows Installer by NSIS

If you would like to build an installer for Windows, you will need the tool NSIS.

You need to setup Qt_Dir and Qt_Version in the scripts\postprocess-windowsnsis-5.0.nsi file.

   !define Qt_Dir "C:\Qt"
   !define Qt_Version "5.0.2"

These settings indicate Qt-5.0.2 is installed at C:\Qt\Qt5.0.2\5.0.2\ and it comes with Qt-Creator at C:\Qt\Qt5.0.2\Tools\QtCreator\

To start building of windows installer, start windows command prompt, go to the scripts/ folder within LibreCAD source folder, and run the batch file build-windows.bat as in the previous section.

If everything runs smoothly, you should have the installer file as,