Compile HOWTO - GreatDevelopers/LibreCAD GitHub Wiki
-- 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 librecad.pro
makeNOTE: 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
- Visual Studio (as early as .NET 2003) and
- Qt 4.3 or 4.4 (I’m currently using 4.3.1)
A repository containing the necessary changes is at github
Using Qt with Visual Studio
It is possible to use Visual Studio with Qt 4.5 (Just follow the instructions from that blog over there or in the INSTALL file packed into qt-win-opensource-src-4.5.3.zip .)
If for whatever reason you want to use the older (smaller!) Qt 4.3.1 ( qt-win-opensource-src-4.3.1.zip ), it is still available from Nokia via ftp
It can be adapted to Visual Studio with the acs-4.3.x-patch3.zip patch file 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 what to do in short:
- Unpack Qt in a directory, eg C:\Qt-4.3.1\
- Unpack acs-4.3.x-patch3.zip into this same directory.
- This should give you, among other files, 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 ).
- Execute this batch file.
- After that, open a command shell set up for Visual Studio compilation (the Visual Studio .NET 2003 Command Prompt from the Start Menu).
- Change to the C:\Qt-4.3.1\ directory and execute qtconfigure msvc.net
- Reply “yes” to the question if you accept the open source license.
- Qt should now build.
Setting up Visual Studio project files
The repository includes *.vcproj and *.sln files, so this is not strictly necessary. However, the *.vcproj files can be (re-)created using
qmake -recursive -tp vc LibreCAD.proSummary 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
to include these where needed. This project file also adds the source files mentioned here.custom.pro
-
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(..). This workaround code is in another four files
emu_qt44.h emu_qt44.cpp emu_qt45.h emu_qt45.cpp
- 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_VERThe LibreCAD source code was cloned from the current LibreCAD Git repository git (around 2011-12-29T14:40+0100) and I’ll try to keep it up to date (For MSVC, probably not for Qt 4.3).
Of course, all modifications should automatically be ignored by means of preprocessor magic when building without EMU_C99 , and the same source builds with with Qt 4.5.