# What you need

To compile MeshLab you need a C++ compiling environment, (we regularly compile meshlab under VisualStudio 2005, gcc and xcode) and the following libraries:

• Qt 4.4 (note that Qt 4.4 are required, Qt versions < 4.4 could not compile). Current version of MeshLab compiles well against Qt 4.4.3.
• the VCG libraries; http://vcg.sf.net, this library is not distributed by means of easy-to-download packages, but it is only accessible through anonymous svn (svn string: svn co https://vcg.svn.sourceforge.net/svnroot/vcg vcg ). If you get the current version of the VCG library we suggest you to also get the current version of MeshLab. If you want to compile the distributed sources check out from the repository the VCG lib with the same date of the release of MeshLab.
• MeshLab's source code version 1.2.1. Now you have two different options:

## External Dependencies

MeshLab and MeshLab's plugins invokes functions exported by external libraries. The code of all these libraries is normally included in the MeshLab's source code package. You can find it in the folder external in the MeshLab source tree.

• glew ( http://glew.sourceforge.net/ ), strongly required. You just need the sources (.h and .c), (not the compiled libs), glew is statically compiled into meshlab, so no dynamic libraries are required.
• lib3ds-1.3.0 ( http://lib3ds.sourceforge.net/ ) This one is needed only for the io_3ds plugin. Without this plugin the 3ds file formats will not be parsed.
• bzip2-1.0.3 this one is required only for the epoch format import plugins; if you do not have datasets produced with the arc3D web reconstruction service, you do not need this plugin.
• muParser 1.30 ( http://muparser.sourceforge.net/ ) This library is needed for filter_func plugin.

In order to successfully compile a MeshLab's plugin with external dependency you have before to compile the referred library and put it into the folder meshlab/src/external/lib/YOUR_OS where YOUR_OS is a string related to your operating system and compiler according to QMAKESPEC definition (like for example macx or win32-msvc2005).
Into the folder external a .pro file, external.pro, has been provided to easily compile all the external libraries. To do this you can either:

• use a Qt-friendly IDE, like Qt Creator, Visual Studio or Eclipse (the last two with the IDE's Qt integration provided by Trolltech)
• use command line.
qmake -recursive external.pro
make



A note: when we say that a library is needed only for a specific plugin we mean that if you do not have that library you should not try to compile that specific plugin otherwise the compilation of that plugin could fail on that plugin and, depending on your compiling environment, the whole compilation could stop. To avoid the compilation of problematic plugins simply comments the relative line (adding a # at the beginning of the line) in the src/meshlabplugins/meshlabpluginsv12.pro.

## Code tree structure

The meshlab sources and the vcg library must be at the same level and the vcg library root should be named 'vcglib'. The external compiled libraries should be placed in a dir named ~/devel/meshlab/external/lib/YOUR_OS (see the above section).
You should have setup your directories in a way that should be similar to the following ones (obviously you are not forced to call your base dir devel or to put it under your home dir):

~/devel/vcglib/vcg/space/
~/devel/meshlab/src/meshlab/interfaces.h
~/devel/meshlab/external/lib/YOUR_OS



If you put things in dirs with different relations, you have to manually change the .pro. Please note that if you are a developer that will soon or later submit back its work, it is strongly deprecated that you use your own version of .pro files: use the standard setup.

## Compiling

The compiling step depends on the compiling environment. Using GCC (both under linux and using the mingw gcc provided with the free Qt distribution) you should just type, from the devel/meshlab/src directory:

qmake -recursive meshlabv12.pro
make


the devel/meshlab/src directory contains also the meshlab_mini.pro project that contains a much smaller set of the meshlab plugins, easier (no need for lib3ds and bzip) and faster to be compiled.

Under windows the suggested platform is the one formed by the open source version of Qt with the mingw gcc compiler that is kindly included in the open source Qt distribution available from TrollTech.

If you want to use Visual Studio, please buy the commercial version of Qt that offers a nice integration of the Qt tools into the Visual Studio IDE. In that case you simply have to import the top level pro ( ~/devel/meshlab/src/meshlab.pro ) into VisualStudio.

### Using Microsoft Visual Studio 8 express edition and QT

It is possible to use the Visual Studio 8 express edition (the one free from MS). Simple steps for the lazy ones:

• download and install Microsoft Visual Studio 8 express edition
• download from trolltech QT 4.4.3 , the zip with the sources not the precompiled bin for mingw.
• unzip it and rename the created folder to c:/Qt/4.4.3 (or something different if you already have installed the qt distribution with mingw.
• Now open the visual studio console (program files->visual studio 2008-> vs 2008 tools-> vs 2008 command promt). Go to the directory where you unzipped qt and type configure -debug-and-release. Wait a few mins (it compiles qmake and runs it, creating the makefiles for vs2008)
• type nmake. Wait a few hours (it recompiles the whole Qt).
• last step: prepare the environment; you have to add to the environment of vs8 command prompt:
set QTDIR=C:/Qtvs/4.4.3
set PATH=C:/Qtvs/4.4.3/bin
set PATH=%PATH%;%SystemRoot%/System32
set QMAKESPEC=win32-msvc2008

• after that just start that enhanced vs8 command prompt, go in the appropriate dir, type
qmake -tp vc -recursive meshlabv12.pro

• and magically a solution that contains meshlab and all the plugins will appear.
• In some cases it could help also to configure visual C++, so it can see always Qt: (tools->options) and add: $(QTDIR)/include to the include directories and$(QTDIR)/lib to the lib directories, but it should not be required (and perhaps a bit dangerous if you upgrade qt).