Compiling Feel++ from sources
| 
Difficulty:  | 
| For beginners, you can skip this section and go directly to containers section. | 
Before starting compiling Feel++, you need first to
- 
understand the Feel++ programming environment.
 - 
install the required and suggested compilers, libraries and tools for Linux or MacOsX to build Feel++ for these architectures.
 
1. For the impatient
To follow these steps, make sure that you first follow programming environment prerequisites steps.
First retrieve the source
$ git clone https://github.com/feelpp/feelpp.git
Feel++ does not allow in-source cmake, the build must be done in separate directory.
$ cmake --preset default (1)
| 1 | configure the default preset in build/default. | 
$ cmake --build --preset default  (1)
$ make --build --preset default -t install (2)
| 1 | compile Feel++: library, tools and quickstart examples | 
| 2 | compile and install Feel++, the option -t allows to set a target to build | 
| 
 You can speed up the make process by passing the option  $ cmake --build --preset default -j4  | 
| Be aware that Feel++ consumes memory. The Feel++ library compile with 2Go of RAM. But to be more comfortable, 4Go or more would be best. | 
$ ./feelpp_qs_laplacian_2d --case laplacian/feelpp2d
$ cd feelpp/quickstart
$ mpirun -np 4 feelpp_qs_laplacian_2d --case laplacian/feelpp2d
1.1. Targets
Here is a list of targets you might be interested in
To compile a specific target use the following command line
$ cmake --build --preset default -t <target>
Target  | 
Description  | 
feelpp  | 
Feel++ core library  | 
feelpp_mesh_partitioner  | 
see > documentation  | 
feelpp_toolbox_coefficientformpdes  | 
see > documentation  | 
feelpp_toolbox_electric  | 
see > documentation  | 
feelpp_toolbox_fluid  | 
see > documentation  | 
feelpp_toolbox_fsi  | 
see > documentation  | 
feelpp_toolbox_hdg_coupledpoisson  | 
see > documentation  | 
feelpp_toolbox_hdg_elasticity  | 
see > documentation  | 
feelpp_toolbox_hdg_poisson  | 
see > documentation  | 
feelpp_toolbox_heat  | 
see > documentation  | 
feelpp_toolbox_heatfluid  | 
see > documentation  | 
feelpp_toolbox_solid  | 
see > documentation  | 
feelpp_toolbox_thermoelectric  | 
see > documentation  | 
2. Downloading sources
2.1. Using Tarballs
Feel++ is distributed as tarballs following each major release. The tarballs are available on the Feel++ Releases web page.
Download the latest tarball, then uncompress it with:
$ tar -xzf feelpp-X.YY.0.tar.gz
$ cd feelpp-X.YY.0
You can now move to the section Using cmake.
2.2. Using Git
Alternatively, you can download the sources of Feel++ directly from the Git repository.
$ git clone  https://github.com/feelpp/feelpp.git
You should read something like
Cloning into 'feelpp'...
remote: Counting objects: 129304, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 129304 (delta 6), reused 0 (delta 0), pack-reused 129283
Receiving objects: 100% (129304/129304), 150.52 MiB | 1.69 MiB/s, done.
Resolving deltas: 100% (94184/94184), done.
Checking out files: 100% (7237/7237), done.
$ cd feelpp
The first level directory tree is as follows
$ tree -L 1 -d
.
├── benchmarks
├── cmake
├── data
├── databases
├── doc
├── feelpp
├── mor
├── ports
├── research
├── testsuite
└── toolboxes
3. Configuring Feel++
For now on, we assume that clang++ has been installed in /usr/bin. Yor mileage
may vary depending on your installation of course.
| It is not allowed to build the library in the top source directory. | 
| 
 It is recommended  to have a directory (e.g.  
  | 
the components Feel++ toolboxes and mor are not configured and compiled by default, you have to enable them either using cmake or convenience script configure
 | 
3.1. Using cmake
The configuration step with cmake is as follows
$ cd FEEL/feel.opt
$ cmake ../feelpp (1)
| 1 | Run cmake with default configuration flags from toplevel Feel++ source directory in ../feelpp | 
Use ccmake to configure Feel++ using a graphical or text interface.
 | 
$ cd FEEL/feel.opt
$ cmake ../feelpp
 -DCMAKE_CXX_COMPILER=/usr/bin/clang++  (1)
 -DCMAKE_C_COMPILER=/usr/bin/clang  (2)
 -DCMAKE_BUILD_TYPE=RelWithDebInfo (3)
| 1 | set the C++ compiler to /usr/bin/clang++ | 
| 2 | set the C compiler to /usr/bin/clang | 
| 3 | set the cmake build type to RelWithDebInfo | 
| 
 Feel++ supports different cmake build types that you can set with  
  | 
cmake ../feelpp ... -DFEELPP_ENABLE_TOOLBOXES=ON -DFEELPP_ENABLE_MOR=ON
3.2. Using configure
Alternatively you can use the configure script which calls cmake.
configure --help provides the following help.
./configure [options...]
Options:
 -b, --build                         build type: Debug, Release, RelWithDebInfo
 -d, --debug                         debug mode
-rd, --relwithdebinfo                relwithdebinfo mode
 -r, --release                       release mode
     --std=c++xx                     c++ standard c++14, c++1z (default: c++14)
     --stdlib=libxx                  c++ standard library libstdc++, libc++ (default: libstdc++)
     --max-order=x                   maximum polynomial order to instantiate(default: 3)
     --cxxflags                      override cxxflags
     --cmakeflags                    add extra cmake flags
     --prefix=PATH                   define install path
     --root=PATH                     define root path
     --enable-pch                    enable precompiled headers (default)
     --disable-pch                   disable precompiled headers
     --enable-python                 enable python
     --enable-cling                  enable cling
     --disable-cling                 disable cling (default)
     --enable-toolboxes              enable Feel++ toolboxes and PyFeel++ toolboxes
     --disable-toolboxes             disable Feel++ toolboxes and PyFeel++ toolboxes (by default)
     --enable-mor                    enable Feel++ mor and PyFeel++ mor
     --disable-mor                   disable Feel++ mor and PyFeel++ mor (by default)
 -v, --verbose                       enable verbose output
 -h, --help                          help page
     --<package>-dir=PACKAGE_PATH    define <package> install directory
     --disable-<package>             disable <package>
     --generator=GENERATOR           cmake generator
We display below a set of possible configurations:
- Compile using Release build type, default c compiler and libstdc
 - 
Listing compiling using default compilers
$ ../feelpp/configure -r - Setup and compile Feel++, the Feel++ toolboxes and Feel++ mor
 - 
Listing to compile Feel++, the Feel++ toolboxes and Feel++ mor
../feelpp/configure -r --enable-toolboxes --enable-mor - Compile using Release build type, clang compiler and libstdc
 - 
Listing compiling using clang++
$ CXX=clang++ ../feelpp/configure -r - Compile using Debug build type, clang compiler and libc
 - 
Listing compiling using clang/libc in Debug mode
CXX=clang++ ../feelpp/configure -d -stdlib=c++ 
4. Compiling Feel++
Once cmake or configure have done their work successfully, you are ready to compile Feel++
$ make
$ make install
| 
 Parallel compilation 
You can speed up the compilation process, if you have a multicore processor by specifying the number of parallel jobs  Listing build Feel++ library using 4 concurrent jobs 
 | 
From now on, all commands should be typed in build directory (e.g feel.opt) or its subdirectories.
 |