Skip to content

02. Requirements and Building

Duncan Crutchley edited this page Apr 20, 2019 · 4 revisions

Compiler

To use this code you require a modern C++1x compiler with at least good C++11 support if not better.

Windows

I have used this code successfully in MSVC 2013, 2015 and 2017 (32bit and 64bit).

I also know that most of this code works in Embarcadero’s C++ Builder 10.x as long as you select the Clang compiler option.

I mainly use Qt Creator with MSVC 2017 providing the backend tool chain but am confident this code will also work in MinGW based on GCC 4.8 or greater.

Linux

This code has been compiled with GCC 4.8 and greater. It has also been compiled with Clang 3.4 and greater.

Again I have used this code in Qt Creator on Linux with no issues.

I have also successfully compiled much of this code for use on a build of Debian 9.8, with Linux Kernel 4.19 on Freescale i.MX6q ARM devices.

Mac OS

I have not tried building on Mac OS but as this code compiles fine with Clang on Windows and Linux it should be relatively straightforward to make it compile on Mac OS.

Dependencies

This code depends, in places, on a few third-party open source libraries. I have tried to minimise the use of such libraries and where possible stick to standard C++ but sometimes it is unavoidable.

Boost

Perhaps the biggest dependency in this project is Boost. I have built with versions of Boost 1.57 and greater. Currently I am using Boost 1.69. Boost is used for the underlying ASIO objects used by this libraries ASIO network classes. It also uses Boost Filesystem and some other useful Boost utilities.

Cereal

The serialisation code in this library makes use of Cereal, which is a library very similar to Boost’s serialisation library and is also API compatible. However, I chose Cereal as it is slightly more light-weight and has better performance and better built-in archive support than Boost. I am currently using version 1.2.1 of Cereal.

Loki

Loki is an open-source library that is quite old now but provides some nice code. In particular it has a very robust implementation of a singleton using template meta programming techniques and various other tricks. This gets used in CoreLibrary to help facilitate the debug log singleton.

Google Protocol Buffers

CoreLibrary also supports serialisation by way of Google Protocol Buffers . This is optional. If you don’t have the protobuf library and don’t make use of this code in my library then you won’t notice anything untoward. I am currently using protobuf 3.7.1.

Google Test

If you want to compile and run the unit tests you need Google Test. I have used version 1.7.0 and greater.

Building

First obtain the required dependencies listed above, following the provided links. Boost, Google Protocol Buffers and Google Test all have static and/or dynamic libraries that require being built for your chosen compiler and platform.

I use Manjaro Linux which always has the latest greatest builds of all of the above available in its package manager. In this case I just install the packages in Manjaro and I’m done. On Windows and other Linux distros I build suitable versions of the libraries for my chosen compiler and platform.

Using Qt Creator

If you want to use the provided Qt Creator project files and mkspecs then you’ll need to install Qt. Either download from the Qt website or if you are on Linux your distro may have it available in its package repositories.

I provide example mkspec .prf files for all of the above dependencies and for the CoreLibrary itself. You can edit the paths in these to be suitable for you installation then copy them into {path-to}/Qt/{path-to-kit}/mkspecs/features. Then anytime you run Qt Creator you can use any of the above dependencies in your project by doing, for example, CONFIGURE += boost or CONFIG += boost_libs. See my Qt project files for a proper example.

If using Qt Creator to build my project then I recommend turning off shadow builds as my project file causes output to be generated in debug or release folders for x86 or x64 for your chosen compiler.

Using Other Build Tools/IDEs

You can easily adapt my Qt projects and mkspecs to other build tools and IDEs’ projects. Project and mkspec files in Qt are simple text files so open them in a text editor and use this info to build projects or make files for other tools.

Clone this wiki locally