Spaghetti depends on the following software to build:
- A C++14 compiler (e.g. gcc, or MSVC 2015)
- libclang-c
- Qt 5.7
- Boost 1.60 (older version should work, but not tested)
- CMake 3.6 (any version >3 should be fine)
Spaghetti is mostly build by a Fedora 25 box, so the above versions are shipped with Fedora.
- Install the prerequisites above (i.e. compiler, libclang, Qt, Boost and cmake):
dnf install clang-devel qt5* boost-devel cmake
in Fedora Linux - Clone the repository:
git clone https://gitlab.com/nestal/spaghetti.git
- Create build directory:
mkdir /path/to/build_dir
- Generate makefiles:
cmake -G 'Unix Makefiles /path/to/source_dir
- Build:
make
(use-j8
to speed up the build)
Building in Win32 is much more complicated than in Linux, mainly because the required libraries are not available out-of-the-box. You need to download them and build them. Also, if you download pre-built binaries of the libraries, make sure to download the one that built from the same compiler you use.
Here is the instructions for downloading/building them:
- libclang: Pre-built binary available from LLVM official site. Download the Clang for Windows (64-bit). These works with MSVC 2015.
- Qt5: Pre-built binary available from Qt official site. Choose the "Desktop and Mobile Application" version. The installer will let you choose which compiler you use and download the corresponding binary.
- Boost: it's better to build from source instead of relying on pre-built binaries. Download the source from Boost official site. To build boost, I used the following commands:
booststrap
.\b2 address-model=64 install
After b2 finishes, the boost headers and libraries will be installed to
c:\Boost
, unless you chose a different location.
4. CMake: Just download from CMake official site
You need to tell cmake where to find the libraries you just built/downloaded.
By default, cmake searches the directories specified by the variable
CMAKE_PREFIX_PATH
. You can set use environment variables or specify
-DCMAKE_PREFIX_PATH=path
in the cmake command line. I prefer to use
environment variable to save some typing.
Assuming you use default locations for all the libraries above, your
CMAKE_PREFIX_PATH
should be like: C:\Program Files\LLVM;C:\Qt5.7\msvc2015_64;C:\Boost
.
CMake needs the -DCMAKE_GENERATOR_PLATFORM=x64
option to properly generate
project files for x64 platform. If Boost is compiled as static libraries, make
sure to pass -DBoost_USE_STATIC_LIBS=true
to use them.