Compiling qcadlib
Unix / Linux
Qt

Since the QCad libraries make extensive use of the Qt library, you first need to install Qt. You can download the latest Qt version from:
http://www.trolltech.com/download/qt/x11.html
The Qt package you need to download is about 14MB big.

Configuring and compiling Qt is not difficult but the compilation requires a lot of time (hours).

Of course you can also install and use the Qt that comes with your Linux distribution. However, I recommend to install your own version. This will allow you to use the latest Qt version and to compile it for your needs.
In this documentation I will assume that you install Qt into your home directory. Your whole Qt installation will reside in the directory you choose. There's no need to install or copy any files into /usr or /usr/local. In fact that would not even be a good idea because you might mess up an existing installation of Qt that is used by your system.

- Download and extract the tar.gz file from the location above:
  `cd
  tar xvzf qt-x11-free-3.x.x.tar.gz`
- Create a 'qt' link to the folder that was created in the last step:
  `ln -s qt-x11-free-3.x.x qt`
  This is not absulutely necessary but it will allow you to have multiple installations of Qt and switch between them more easely by just changing the link.
- Set the QTDIR environment variable to point to that directory (this command might be different if you're not using a bash shell):
  `export QTDIR=/home/tux/qt`
- Change to the Qt directory and configure Qt. Of course you can try different options but I've made the best experiences with those:
  `cd $QTDIR
  ./configure --static -no-sm -no-xinerama -no-exceptions -xrender`
  This will take a couple of minutes. There is already a lot of compilation required in the configuration process of Qt.
- Compile the Qt library. This can easely take hours depending on your machine. The library itself however, should be ready in less than an hour.
  `make`
- Once the compilation has finished, you should see the library file in the lib directory:
  `ls $QTDIR/lib
  libqt.a`

The QCad Libraries

Under Unix and Linux Systems, compiling qcadlib is as simple as running one script that does it all for you. Please download the latest source distribution from:
http://www.ribbonsoft.com/qcad_downloads.html

- Extract the file into a directory of your choice:
  mkdir ~/qcad
  cd ~/qcad
  mv qcad-2.x.x.x-1.src.tar.gz ~/qcad/
  tar xvzf qcad-2.x.x.x-1.src.tar.gz
- Run the build script:
  `cd scripts
  ./build_qcad.sh`
- After the build has completed, you can find the libraries in the 'lib' directories and the QCad binary in directory 'qcad'.

Windows

For this manual I only describe the process of compiling the QCad libraries using cygwin [CYGWIN] as a console and the free Borland C++ command line tools [BCC]. There are other ways that you might prefer but this is the way that comes the closest to the Unix approach.

- Launch a cygwin console
- Set the environment variable BCB to point to your installation directory of the Borland C++ compiler (Windows style). E.g.:
  `export BCB=c:\\Borland\\BCC55`
- Check if bcc32 can be found:
  `bcc32`
  If that is not the case, please add the path where the bcc32.exe binary is located to your PATH variable (Unix style):
  `export PATH=/cygdrive/c/Borland/BCC55/Bin:$PATH`
- Set the QTDIR environment variable and the PATH:
  `set QTDIR=c:\\qt\\3.2.1
  set PATH=$QTDIR/bin:$PATH`

- Because Windows doesn't support links, you need to copy the header files to the include directories:
  `cd dxflib/src
  cp `find . -name "*.h"` ../include/
  cd ../..
  cd fparser/src
  cp `find . -name "*.h"` ../include/
  cd ../..
  cd qcadlib/src
  cp `find . -name "*.h"` ../include/
  cd ../..
  cd qcadcmd/src
  cp `find . -name "*.h"` ../include/
  cd ../..
  cd qcadactions/src
  cp `find . -name "*.h"` ../include/
  cd ../..
  cd qcadguiqt/src
  cp `find . -name "*.h"` ../include/
  cd ../..
  `

- Compile the libraries using the makefiles that come with the package:
  `cd dxflib
  /cygdrive/c/Borland/BCC55/Bin/make.exe -f makefile_win_bcc55
  cd ..
  cd fparser
  /cygdrive/c/Borland/BCC55/Bin/make.exe -f makefile_win_bcc55
  cd ..
  cd qcadlib/src
  qmake -o makefile_win_bcc55 qcadlib.pro
  /cygdrive/c/Borland/BCC55/Bin/make.exe -f makefile_win_bcc55
  cd ../..
  cd qcadcmd/src
  qmake -o makefile_win_bcc55 qcadcmd.pro
  /cygdrive/c/Borland/BCC55/Bin/make.exe -f makefile_win_bcc55
  cd ../..
  cd qcadactions/src
  qmake -o makefile_win_bcc55 qcadactions.pro
  /cygdrive/c/Borland/BCC55/Bin/make.exe -f makefile_win_bcc55
  cd ../..
  cd qcadguiqt/src
  qmake -o makefile_win_bcc55 qcadguiqt.pro
  /cygdrive/c/Borland/BCC55/Bin/make.exe -f makefile_win_bcc55
  cp `find . -name "*.h"` ../include/
  cd ../..
  `
- Check if the QCad binary qcad.exe was created in ./qcad:
  `ls -la ./qcad`