# Compiling Guide | LeoCAD

## Getting the Source Code

Users that need to compile their own binaries should get the source code for the latest release from the Download Page.

If you are a programmer and plan to contribute with code fixes, or if you are a user that wants to use the latest version and accepts the risks of doing that, then you should download the source from the GitHub server at https://github.com/leozide/leocad.git.

Typing the following will download the latest revision to a directory called “leocad” on your computer:

`$ git clone https://github.com/leozide/leocad.git`

Note: You can receive notifications of source code changes by watching the project on the Github Page.

## Required Libraries

LeoCAD requires Qt 5.4 or later to compile. You can download the Qt SDK for all platforms from the Qt Project Homepage.

Linux users may find it easier to use their package manager instead with the following command:

`$ sudo apt-get install qtbase5-dev qttools5-dev-tools libqt5opengl5-dev zlib1g-dev`

Although it is not required, it is recommended to also download and install a parts library, otherwise only a very small set of basic parts will be available.

## Compiling

The easiest way to compile on any platform is to open “leocad.pro” in Qt Creator and build it from there.

#### Linux

If you are not using Qt Creator, or if you prefer to compile from the command line, you can generate a makefile by using “qmake”, then build and install the application with the following commands:

`leocad$ qmake leocad.pro
leocad$ make
leocad$ make install`

Here are two options that can be utilized by “qmake” to customize LeoCAD builds that will interest distribution maintainers:

- “DISABLE_UPDATE_CHECK=1”: disables update checks at startup and removes that option from the menu. This is recommended to be set for distributions that have their own way of updating applications to avoid confusing users.
- “LDRAW_LIBRARY_PATH=path”: adds an extra path to be searched at startup for the LDraw library. The path should be the root folder of the LDraw library. For example, “/usr/share/ldraw”.

#### Windows

Windows users also have the option to compile with Visual Studio, but you need to use “qmake” to generate the project files first with the following command:

`C:\leocad> qmake -tp vc`

This will generate a file called “leocad.vcxproj” that can be opened in Visual Studio.

If you are using the precompiled Qt binaries, make sure to install the libraries that correspond to your compiler and the Qt source code.

#### macOS

To compile for macOS, you will need to add a parts library to the folder where you downloaded the source code. You can download the Linux library and unzip it there with the following command:

`leocad$ unzip Library-Linux-7931.zip`

You'll also need to include the POV-Ray executable in the package, you can download a pre-built one from here.

#### iOS

To compile for iOS, you will need to add a parts library to the folder where you downloaded the source code. You can download the Linux library and unzip it there with the following command:

`leocad$ unzip Library-Linux-7931.zip`

Generate an Xcode project by using “qmake” for iOS with the following command:

`leocad$ ~/Qt5.8.0/5.8/ios/bin/qmake`

Now open the project in Xcode and build it. An Apple Developer account (free) is required to install the app on a device.