wiki:CompilingGuide

Version 21 (modified by leo, 3 years ago) (diff)

--

Getting the source code

The source code is available as an archive from the downloads page or from the Subversion server at http://svn.leocad.org/. You can download the trunk version for the latest but unstable changes or the official releases using the leocad-0.78, leocad-0.79.3, etc tags. Please use one of the release tags unless you plan to be a developer.

Typing this would download the latest revision to a directory called 'leocad' on your computer:

C:\>svn co http://svn.leocad.org/trunk leocad

Or if you want to get the source code for version 0.79 you would type:

C:\>svn co http://svn.leocad.org/tags/leocad-0.79 leocad

If you are new to Subversion you may want to read Version Control with Subversion and download a free Subversion client from here.

You can receive notifications of source code changes by subscribing to the rss feed at the bottom of the Timeline page.

Required Libraries

Starting with version 0.80 LeoCAD requires Qt 4.8 or later to compile. You can download the Qt SDK for all platforms from http://qt-project.org.

Linux users may find it easier to just use their package manager instead:

$ sudo apt-get install qt-sdk

Compiling

The easiest way to compile on any platform is to open 'leocad.pro' in Qt Creator and build from there but if you prefer compiling from the command line you can generate a Makefile using qmake:

leocad$ qmake

And then compile:

leocad$ make

Linux users should also build the 'install' target as root to copy the executable and support files to the right places in their system:

leocad$ sudo make install

Windows users can also compile using Visual Studio. You just need to use qmake to generate the project files first:

C:\leocad> qmake -tp vc

And then open 'leocad.vcxproj' in Visual Studio and compile.


Compiling older versions (before 0.80)

Required Libraries

You'll need to download a copy of the zlib library to compile LeoCAD. Windows users should extract it to the leocad\win\zlib folder while Linux users should just install it like other libraries in their system.

Optional Libraries

LeoCAD can use a few Open Source libraries to add extra functionality to it, you can download them if you want or just compile LeoCAD without those features (see the next sections for instructions on how to install them).

Compiling the Linux Version

Make sure you have the GTK+ 2.0 header files and libraries installed in your system, you can check that by typing from a shell:

$ 'pkg-config --atleast-version=2.0 gtk+2.0'

The GTK+ 2.0 libraries are required to compile LeoCAD, they are available for download from the GTK+ Homepage. Debian and Ubuntu users can simply type:

$ sudo apt-get install libgtk2.0-dev

If you don't have the OpenGL headers installed in your computer you can get them from the Mesa package:

$ sudo apt-get install libgl1-mesa-dev

Next go to the leocad directory and run the auto-configuration:

$ make config

This will try to detect what libraries you have installed and what kind of computer you have. After that is done you're ready to build the executable:

$ make

If you don't get any errors you should have a new executable in the 'bin' directory. Finally, build the 'install' target as root to copy the support files to the right places in your system:

$ sudo make install

Compiling the Windows Version

If you downloaded the optional libraries extract them to the leocad\win folder, or open lc_config.h in that same folder and comment out the #define LC_HAVE_XXX at the bottom of the file for the libraries that you don't have installed.

LeoCAD 0.77 requires Visual Studio 2010 to compile.