Skip to content
tin-pot edited this page Dec 29, 2011 · 13 revisions

-- UNIX and OSX users --
Unzip or checkout a version of LibreCAD into a directory.
CD into that directory and follow these instructions:

Build makefile and compile LibreCAD

qmake
make

NOTE: On Fedora and perhaps other systems (Ubuntu?) You
need to run “qmake-qt4” instead of just “qmake”.

-- Windows Users --

Download a copy of QT SDk from http://qt.nokia.com/downloads/

After installation, start qtCreator and load LibreCAD.pro,
from the the build menu select ‘Build All’

-- Users of MS Visual Studio and/or Qt 4.3/4.4 --

(tin-pot 2011-12-29)
While LibreCAD “officially” needs Qt 4.5 and QtCreator/gcc to build,
it can be tweaked to be build with

  1. Visual Studio (as early as .NET 2003) and
  2. Qt 4.3 or 4.4 (I’m currently using 4.3.1)

A repository containing the necessary changes is at github

It should be possible to use Visual Studio with Qt 4.5

The older (smaller!) Qt 4.3.1 (qt-win-opensource-src-4.3.1.zip) is available from Nokia via ftp

It can be adapted to Visual Studio with acs-4.3.x-patch3.zip from the SourceForge QtWin project.

Details are described in Volker Wiendls paper “Qt 4.x unter Windows und Visual Studio .NET 2003” (PDF, in german), here is it in short:

  1. Unpack Qt in a directory, eg C:\Qt-4.3.1\
  2. Unpack the acs-4.3.x-patch3.zip into this same directory.
  3. This should give you, among others, a batch file C:\Qt-4.3.1\installpatch43.bat (in the same
    directory as Qt’s C:\Qt-4.3.1\changes-4.3.1.txt ).
  4. Execute this batch file.
  5. After that, open a command shell set up for Visual Studio (the Visual Studio .NET 2003 Command Prompt from the Start Menu).
  6. Change to the C:\Qt-4.3.1\ directory and execute qtconfigure msvc.net
  7. Reply “yes” to the question if you accept the open source license.
  8. Qt should now build.

Summary of modifications in LibreCAD:

  • Emulate some C99 functions: LibreCAD uses remainder()
    and friends form <math.h>, which MSVC does not have and possibly never will. Two files
    emu_c99.h
    emu_c99.cpp

    are added to provide replacements using inline assembler code for the x87 FPU, and
    a macro EMU_C99 is defined in the customization Qt project file
    custom.pro
    to include these where needed.
  • Work around missing Qt 4.4 and 4.5 features: LibreCAD uses some
    stuff of Qt which was first introduced in versions 4.4 rsp 4.5. Most of this
    is benign and can trivially be emulated, eg QList<T>::removeOne(..);
    some can (hopefully) be simply omitted, eg QMdiArea::setViewMode(..).
  • Use Qt 4.3 help system: Version 4.4 of Qt introduced a comprehensive
    help system (QHelpEngine and others) and deprecated QAssistantClient.
    Code ressurected from older LibreCAD/QCad versions which is planted into
    qc_applicatonwindow.cpp allows to use this older help technique.

All changes can be found by searching for the symbols

EMU_C99
QT_VERSION 0x040400
QT_VERSION 0x040500
_MSC_VER

The code was cloned from the current LibreCAD git (around 2011-12-29T14:40+0100)
and I’ll try to keep it up to date.

Of course, all modifications should automatically be ignored by means of preprocessor
magic when building without
EMU_C99 rsp with Qt 4.5 – but this needs testing …

Clone this wiki locally