# Installation of meshalyzer Meshalyzer is regularly used on Linux and Mac machines. It has worked under Windows as well. ## Prerequisities 1. [libpng](http://libpng.org) 2. [OpenMP](http://openmp.org) is recommended too improve certain operations. For all compilers, except *clang* supplied by Apple, it is standard. A simple way to include it on Apple machines is with homebrew: `brew install libomp` 2. [FLTK 1.3.x](http://www.fltk.org/) or higher. Manually downloadad and installed is better since the prepackaged versions often have issues with fltk-config. 3. [glew](http://glew.sourceforge.net) for Linux and Windows only. 2. [glut](https://www.opengl.org/resources/libraries/glut/) for Linux and Windows only. 3. [cmake](https://cmake.org) if you want to make compiling easier. 3. To make the "windowless" rendering version, [OSMesa](https://www.mesa3d.org/osmesa.html) 4. To read in VTK/VTU format meshes, install [VTK](https://www.vtk.org/) development files Except for fltk, using your package manager is recommended for installing these packages if possible. On *MacOS*, [homebrew](https://brew.sh/) works for us. ## Compiling Clone the repository and enter the codebase folder `meshalyzer`. ``` git clone https://git.opencarp.org/openCARP/meshalyzer.git cd meshalyzer ``` We provide Makefiles and CMake files for compiling the code, choose the one that fits your workflow. ### Makefile 1. If VTK is installed, edit the **make.conf** to set the `VTK_INC` and `VTK_DIR` variables to point to the directories containing the VTK header files and libraries, respectively. Comment them out otherwise. 2. If you have an Apple machine, edit **make.conf** to make sure that *HAVE_RETINA* is correct. 3. Type `make -j` 4. For the windowless version, type `make mesalyzer` 5. The compiled executables will be found in the directory. 6. Copy the binaries to a suitable location ### CMake 1. We suggest to run CMake by out-of-source builds, which means all the compiled code goes into a `_build` directory separate to the source code. 2. If VTK is installed, type `cmake -S. -B_build`. Otherwise type `cmake -S. -B_build -DUSE_VTK=OFF` 3. Compile the code via `cmake --build _build` 4. In the main meshalyzer directory, you will find a link to the compiled executalbe. ### ccmake For those who are familiar with [ccmake](https://cmake.org/cmake/help/v3.0/manual/ccmake.1.html): 1. `ccmake .` 2. configure, edit and generate 3. make -j ## Documentation To compile the manual (LaTeX required) 1. `cd manual` 2. `pdflatex manual` 3. `pdflatex manual` ## MacOS First of all, the [command line tools](https://developer.apple.com/download/more/?=command%20line%20tools) or [Xcode](https://developer.apple.com/xcode/) must be installed. Next, install the [prerequisities](#prerequisities) using your package manager. We use [homebrew](https://brew.sh/) as an example. ``` brew install libpng brew install fltk brew install git brew install cmake ``` Follow the steps in the [Compiling](#compiling) to build the code. ## Ubuntu/Debian: For installing meshalyzer first you need to install the ["Prerequisites"](#prerequisities). In Ubuntu you can use: ``` apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ fluid \ freeglut3-dev \ g++ \ git \ libfltk1.3-dev \ libglew-dev \ libglu1-mesa-dev \ libpng-dev \ make ``` Follow the steps in [Compiling](#compiling) to build the code. ## Post-compilation You can execute meshalyzer by typing `./meshalyzer` See README.md for an example. To make meshalyzer available from anywhere on your machine, you need to copy it to your *bin* directory, or add the meshalyzer directory to **PATH** by editing your *.bashrc* (or *.bash_profile*). Using the nano editor as an example, type the following command into the terminal: ``` nano ~/.bashrc ``` This will open an editor, scroll all the way down and add the following line, replacing '/home/somefolder/anotherfolder/meshalyzer' with the path of your meshalyzer folder: ``` export PATH=$PATH:/home/somefolder/anotherfolder/meshalyzer ``` press Control+X, then type Y and Enter to save the changes. Close all terminal instances! open a terminal and type `meshalyzer`