CMake C++ Installation

We recommend to use CMake for the installation since it is the most automated way to reach your needs. First of all make sure you have a sufficient version of CMake installed (3.9 minimum version required). The only external dependency of the C++ code is given by the Eigen3 library, therefore make sure to have already installed the library (however the CMake internally checks the presence of it). If you are working on a machine without root privileges and you need to upgrade your CMake version a valid solution to overcome your problems is provided shut.

For the C++ installation:

  1. Follow your system prerequisites (below)

  2. Clone the plasticity package from this repository, or download a stable release

3) plasticity could be built with CMake and Make or with the build scripts in the project. Example:

Unix OS: .. code-block:: bash

./build.sh

Windows OS: .. code-block:: Powershell

PS > ./build.ps1

Ubuntu

  1. Define a work folder, which we will call WORKSPACE in this tutorial: this could be a “Code” folder in our home, a “c++” folder on our desktop, whatever you want. Create it if you don’t already have, using your favourite method (mkdir in bash, or from the graphical interface of your distribution). We will now define an environment variable to tell the system where our folder is. Please note down the full path of this folder, which will look like /home/$(whoami)/code/

  1. Open a Bash terminal and type the following commands to install all the prerequisites.

  1. Install the Eigen library

  1. Build the project with CMake (enable or disable OMP with the define -DOMP; enable or disable Cython building with the define -DPYWRAP; enable or disable testing with the define -DBUILD_TEST):

macOS

  1. If not already installed, install the XCode Command Line Tools, typing this command in a terminal:

  1. If not already installed, install Homebrew following the official guide here: https://brew.sh/index_it.html.

  2. Open the terminal and type these commands

  1. Install the Eigen library

  1. Define a work folder, which we will call WORKSPACE in this tutorial: this could be a “Code” folder in our home, a “c++” folder on our desktop, whatever you want. Create it if you don’t already have, using your favourite method (mkdir in bash, or from the graphical interface in Finder). We will now define an environment variable to tell the system where our folder is. Please note down the full path of this folder, which will look like /home/$(whoami)/code/

  2. Open a Terminal and type the following command (replace /full/path/to/my/folder with the previous path noted down)

  1. Build the project with CMake (enable or disable OMP with the define -DOMP; enable or disable Cython building with the define -DPYWRAP; enable or disable testing with the define -DBUILD_TEST):

Windows (7+)

  1. Install Visual Studio 2017 from the official website here: https://www.visualstudio.com/

  2. Open your Powershell with Administrator privileges, type the following command and confirm it:

  1. If not already installed, please install chocolatey using the official guide here: http://chocolatey.org

  2. If you are not sure about having them updated, or even installed, please install git, cmake and an updated Powershell. To do so, open your Powershell with Administrator privileges and type

  1. Restart the PC if required by chocolatey after the latest step

  2. Install PGI 18.10 from the official website (https://www.pgroup.com/products/community.htm) (the community edition is enough and is free; NOTE: install included MS-MPI, but avoid JRE and Cygwin)

  3. Activate license for PGI 18.10 Community Edition (rename the file %PROGRAMFILES%PGIlicense.dat-COMMUNITY-18.10 to %PROGRAMFILES%PGIlicense.dat) if necessary, otherwise enable a Professional License if available

  4. Define a work folder, which we will call WORKSPACE in this tutorial: this could be a “Code” folder in our home, a “cpp” folder on our desktop, whatever you want. Create it if you don’t already have, using your favourite method (mkdir in Powershell, or from the graphical interface in explorer). We will now define an environment variable to tell the system where our folder is. Please note down its full path. Open a Powershell (as a standard user) and type

9) In the upper part of the window that pops-up, we have to create a new environment variable, with name WORKSPACE and value the full path noted down before. If it not already in the PATH (this is possible only if you did it before), we also need to modify the “Path” variable adding the following string (on Windows 10 you need to add a new line to insert it, on Windows 7/8 it is necessary to append it using a ; as a separator between other records):

  1. If vcpkg is not installed, please follow the next procedure, otherwise please jump to #12

  1. Open a Powershell with Administrator privileges and type

  1. Install the Eigen library

  1. Open a Powershell and build plasticity using the build.ps1 script