Skip to content

Becoming a developer

ravas edited this page May 29, 2017 · 22 revisions

LibreCAD is written in C++11 and now requires at least Qt 5.2.1.

Git... the source

Requirements

Other than Qt the only requirement is boost;
although you need freetype for the tff2lff command line tool.

Windows Specific
On Windows you will need to add the boost path to librecad/src/custom.pro (or .pri):

BOOST_DIR = C:/boost/boost_1_60_0/
BOOST_LIBDIR = C:/boost/boost_1_60_0/

OS X Specific
On OS X you also need to download XCode to build with Qt Creator / Clang.
After installing you need to accept the license by opening the OS X terminal and inputing:

$ sudo xcode-select -switch /Applications/Xcode-beta.app/Contents/Developer
$ sudo xcodebuild -license

Remove -beta if you are not using a beta version.

You can get the latest version of Boost by using Homebrew.

brew install boost

You will need to run macdeployqt after building to complete the App.
http://doc.qt.io/qt-5/osx-deployment.html

Qt

Download an appropriate offline installer from http://www.qt.io/download-open-source/ (hint: look for the "view all downloads" link). Windows users will want to get the MinGW version.

Open librecad.pro in Qt Creator.
It's easiest to just accept the default configuration,
and then go to the 'Projects' side tab, and uncheck 'Shadow build'.
You can improve build speed by adding -j to the make arguments.
Using -j3 on a quad core i5 builds in a little under 3 minutes with clang.

Qt Assistant also comes with the package and is documentation in the form of a program.

Essential concepts

Essential classes

Code navigation

http://doc.qt.io/qtcreator/creator-editor-locator.html

Useful in the text area's context menu:

  • Switch Header/Source
  • Follow symbol under cursor
  • Find usages

Ctrl+F has an "Advanced" section that can search all files in the project.

The bar above the text area drops down and has sorted symbols;
and the Outline in the sidebar shows them in order of appearance.

It can be helpful to use bookmarks. http://doc.qt.io/qtcreator/creator-coding-navigating.html

Doxygen: http://wiki.librecad.org/lc2doc/main.html

Automatic code quality checking

We have a clang static analyzer build running during travis checks. See the below link for annotated hints of possible memory leaks and other bugs: http://librecad.github.io/static-analyzer-reports/

Check for updates