Skip to content

Compiling

Angelos Mantzaflaris (Άγγελος Μαντζαφλάρης) edited this page Dec 8, 2020 · 15 revisions

In this section we assume that you have successfully acquired the sources as described in the downloads section.

The compilation is tested daily on several systems (Linux, Windows, macOS). However, if you experience a problem please report it at GitHub issues.

You can review the daily compilation results on:

The current status of the compilation on Linux, macOS and MS Windows is:

Short version: Go to the source directory and type make. G+Smo will build in the ./build subfolder. Alternatively call cmake [path to gismo source] from the build-folder of your choice. Afterward you can start the build with make or cmake --build . (Last one works also under Windows with Visual Studio, no call of nmake is needed, and the setting of the compiler still works from cmake).

Prerequisites

The library uses standard C++ code and has minimal requirements. These are a C++ compiler and the CMake configuration tools. In detail:

As an example, on a clean Ubuntu installation, the packages g++, libstdc++ and libstdc++-dev are needed (as well as cmake, and possibly svn or git).

Note: On Windows, it is recommended that during installation you choose to have the CMake tools added to your PATH environmental variable.
If you use Visual Studio 2017/2019 (or newer) or CLion, you can skip the installation of CMake because it is bundled with these IDEs - select the UNIX Build Tools target in the Visual Studio Installer.

  • Compilers tested include recent versions of:

  • Recommended:

    • Paraview for visualization: G+Smo can produce Paraview files for visualization of geometric objects. These can be opened as soon as Paraview is installed on your system.
    • An IDE with CMake support like:
      • CLion (free for students), all major systems
      • Visual Studio Community 2017, Windows and macOS
      • Qt Creator
      • ...

Note: if your IDE supports CMake, let it do the base configuration for you

Configuring and building

The compilation requires configuration using CMake at a new, empty folder (in-source builds are disabled).

Xcode Command line tools for macOS:

On macOS Xcode command line tools should be installed. Use

 xcode-select --install

to start the installation wizard.

CMake for Linux/macOS:

A Unix makefile exists in the root source folder. Running make creates a sub folder named build and executes CMake and compilation inside that folder. Alternatively, choose your own build folder and execute CMake pointing to the sources by cmake [path to source].

If your source folder is named "gismo" then the sequence of commands

$ cd gismo
$ make
  ...
  [100%] Built
$ cd build
$ ./bin/gsView

will compile the library and execute an example program.

If you wish to have a build folder other than gismo/build, create a folder and execute (take a short coffee break after typing make, you can also increase number of processers that are used for compiling with -j# where # is the number of threads)

$ mkdir my-build-folder
$ cd my-build-folder
$ cmake ../path-to/gismo
  -- Build files have been written to: /path-to/my-build-folder
$ make -j4
  ...
  [100%] Built

After successful compilation a dynamic library is created in ./lib and executable example programs are output at the ./bin subdirectory of the build folder.

If Doxygen is available on your system, you can compile and open the Doxygen HTML pages by executing

$ cd my-build-folder
$ make doc
  ...
  Built target doc
$ firefox doc/html/index.html

Visual Studio Community 2017 for Windows and macOS:

Click on File, Open -> Open from Source Control, the Team Explorer - Connect Window will be shown. Under Local Git Repositories click on Clone, enter https://github.com/gismo/gismo.git for the URL to the Git repo, disable Recursively Clone Submodules and you can clone the repositorie to your local machine. After this, Visual Studio opens the project and starts with the CMake process.

In the CMake menuitem, that will be shown now, you can select what you want to build and change the settings. On the first run of Change CMake Settings -> gismo you will be asked for what machine target you want to build.

Platform Targets

This dialog creates a CMakeSettings.json file that contain your CMake configure options.

CMakeSettings.json

The compiler itself is selected trough the generator tag. Build type (CMAKE_BUILD_TYPE) refers to configurationType. All other configuration options can be given to the cmakeCommandArgs string.

MS Windows:

Run cmake-gui tool (from an environment that is configured with your compiler) to generate makefiles (or Visual Studio project). Then execute the make tool to launch compilation. Alternatively, use the QtCreator GUI and open the CMakeLists.txt file on the root folder to create a QtCreator project.

In more detail, after installation of MS Visual C++ compiler, open the Visual C++ command prompt (which is configured with the vcvarsall.bat script) and

> mkdir build-gismo
> cd build-gismo
> cmake ../path-to/gismo
  ** - Build files have been written to: /path-to/build-gismo
> nmake
  ...
  [100%] Built

The procedure can also be carried out in the graphical environment of !QtCreator as outlined here.

After successful compilation a dynamic library is created in \lib and executable example programs are output at the \bin subdirectory of the build folder.

Configuration options

Upon configuration, G+Smo presents a set of basic configuration options:

Configuration:
  CMAKE_BUILD_TYPE        RelWithDebInfo
  GISMO_COEFF_TYPE        double
  GISMO_EXTRA_DEBUG       OFF
  GISMO_BUILD_LIB         ON
  GISMO_BUILD_EXAMPLES    ON
  GISMO_BUILD_AXL         OFF
  GISMO_WITH_PSOLID       OFF
  GISMO_WITH_ONURBS       OFF
  CMAKE_INSTALL_PREFIX    /usr/local
-- Number of examples to compile:      12

The default value of each option is shown in the column on the right. A short description of each option follows:

  • CMAKE_BUILD_TYPE: Available values are the standard CMake build configurations: Debug, Release, RelWithDebInfo, MinSizeRel.

  • GISMO_COEFF_TYPE: The arithmetic type to be used for all computations. Available options include double, long double, float.

  • GISMO_EXTRA_DEBUG: If set to ON additional debugging tools are enabled during compilation. These include checked iterators for GCC and MSVC compilers and call stack back-trace printout when a runtime exception occurs.

  • GISMO_BUILD_LIB: If enabled a dynamic library is created using GISMO_COEFF_TYPE arithmetic. A target for a static library named gismo_static is also created but not compiled by default.

  • GISMO_BUILD_EXAMPLES: If enabled the programs in the examples folder are compiled, and executables are created in build-folder/bin.

  • GISMO_BUILD_AXL: If enabled the plugin for Axel modeler is compiled (requires Axel).

  • GISMO_WITH_PSOLID: If enabled the extensions using functionalities of Parasolid geometric kernel are compiled.(requires Parasolid).

  • GISMO_WITH_ONURBS: If enabled the extension for reading and writing of Rhinoceros' 3DM is compiled.

  • CMAKE_INSTALL_PREFIX: The location for installation of the library, e.g. /usr/local on some Linux systems.

  • NOSNIPPTES: Turn to ON if you want to build doxygen documentation without building snippets - fastens up doxygen build.

  • GISMO_WARNINGS: Turn to ON if you want see more warnings. This is useful to clean up the code during development.

Source directory tree

The source tree consists of the following sub-folders:

  • src Contains all source files. Code is partitioned into modules. Here are some modules which are present as sub-folders:
  • examples Examples of usage, small programs and tutorials.
  • filedata Data files in the XML format the G+Smo can read and write.
  • extensions Optional additional features that can be compiled along G+Smo.
  • plugins Plugins for exporting functionality of G+Smo to third party software.
  • cmake Cmake configuration files
  • doc Files related to doxygen documentation.

Clone this wiki locally