This page describes how to build MRPT from sources. If you want instead to install the binaries and getting quickly into developing your MRPT-based applications, go to the download page and grab the binaries for your system or install via apt-get in Ubuntu.
- 1. Prerequisites
- 1.1. On Windows
- 1.1.1 CMake (Mandatory)
- 1.1.2 wxWidgets (Optional, but recommended)
- 1.1.3 OpenCV (Optional, but strongly recommended)
- 1.1.4 FFmpeg for Win32 (Optional)
- 1.1.5 OpenKinect’s freenect (Optional, only if want to use Kinect)
- 1.1.6 PCL, the Point Cloud Library (Optional)
- 1.1.7 SuiteSparse (Optional)
- 1.1.8 WinPCap (libpcap for Windows)
- 1.2. On GNU/Linux
- 1.3. Ubuntu / Debian
- 1.4. Fedora
- 1.5. OpenSUSE (updated to OpenSUSE 13)
- 1.6. On Mac
- 1.1. On Windows
- 2. CMake build options
- 3. Generate Makefiles/IDE Projects
- 4. Compile
- 5. Special instructions for other compilers
See this table for a summary of what external libraries MRPT needs and what are they used for, so you can decide which ones are really needed for your application.
2. CMake build options
2.3. Interesting build options
For all platforms/compilers:
BUILD_APPLICATIONS: By default ON, if unchecked the applications won’t be built. Useful if you only want to build MRPT libraries. Notice that you can also always use the
MRPT_BUILD_DIR/libs/MRPT_ALL_LIB.*solution (or Makefile) to achieve the same.
BUILD_ARIA: Whether to build or not the embedded ARIA library for interfacing Activemedia Robots. Default is ON. Disable it to save build time if you don’t plan to use those robots.
BUILD_xSENS: Whether to use the CMT library for interfacing xSens inertial sensors. Default is ON.
BUILD_EXAMPLES: Whether you want to compile all the examples in the “/samples” directory. Default is OFF.
BUILD_KINECT: By default ON. Uncheck if you don’t have the required dependencies (read above for your OS).
BUILD_SHARED_LIBS: Build static libraries if set to OFF, or dynamic libraries (.so/.dll) otherwise. Default is ON, and it’s strongly recommended to always use shared libs unless you have special need for static ones.
EIGEN_USE_EMBEDDED_VERSION: By default ON, instructs MRPT to use the Eigen headers in
MRPT/otherlibs/eigen3/. Uncheck if you have Eigen installed in the system and it’s visible through pkg-config. It’s recommended to uncheck this option if you have eigen3 installed in your system (today, eigen3 it’s not yet in any distro repository, that’s why it’s ON by default).
MRPT_ALWAYS_CHECKS_DEBUG: If set to ON, additional security checks will be performed at run-time in many classes. Default is OFF.
MRPT_ALWAYS_CHECKS_DEBUG_MATRICES: If set to ON, additional security checks will be performed at run-time in several Matrix operations. Default is ON.
MRPT_ENABLE_EMBEDDED_ENABLED_PROFILER: If enabled, all code blocks within macros "MRPT_BEGIN/MRPT_END" will be profiled and the statistics dumped to the console at the end of execution of any program. Default is OFF.
MRPT_HAS_ASIAN_FONTS: Enables Asian fonts in mrpt::utils::CCanvas (see this page), but increases library size by 1.5Mb. Default is ON.
MRPT_HAS_SVS: To enable integration of the Videre SVS libraries to interface their stereo cameras. You’ll need the vendor libraries installed in the system before to enable this option. After setting this option to “ON”, the new configuration fields “SVS_ROOT_DIR” will appear and will be tried to be set pointing to the directory where the library is (As of Aug/2010, this option only works in GNU/Linux).
MRPT_OCCUPANCY_GRID_CELLSIZE: Can be either 8 or 16 (bits). The size of each cell in the class mrpt::slam::COccupancyGridMap2D. Default is 8 bits. More on this here.
PCL_DIR: If you have the Point Cloud Library installed in your system, set this variable to the path to your
PCLConfig.cmakefile to enable its integration from MRPT.
USER_EXTRA_CPP_FLAGS: You can add here whatever additional flags to be passed to the compiler.
For Windows only:
MRPT_HAS_FFMPEG_WIN32: Enable this and (after running “Configure”) then set FFMPEG_WIN32_ROOT_DIR to the directory where FFmpeg binaries have been uncompressed (e.g. “c:\ffmpeg-r16537-gpl-lshared-win32”).
MRPT_HAS_BUMBLEBEE: To enable integration of the Bumblebee stereo camera SDK. You’ll need the vendor provided “Triclops” and “Digiclops” libraries. After setting this option to “ON”, the new configuration fields “BUMBLEBEE_DIGICLOPS_ROOT_DIR” and “BUMBLEBEE_TRICLOPS_ROOT_DIR” will appear where the correct corresponding paths must be entered.
For GNU GCC compiler only:
MRPT_ENABLE_LIBSTD_PARALLEL_MODE: Enables the GNU libstdc++ parallel mode (See http://gcc.gnu.org/onlinedocs/libstdc++/manual/parallel_mode.html. Default is OFF.
MRPT_ENABLE_PROFILING: Enables generation of information required for profiling. Default is OFF.
MRPT_OPTIMIZE_NATIVE: Enables optimization for the current architecture (-mtune=native). Default is OFF for old GCC versions, ON for 4.2+. If you have an old version of GCC (<4.2), this option cannot be set since it’s not recognized by the compiler. Instead, set USER_EXTRA_CPP_FLAGS to the optimization flags for your platform, for example: -march=pentium4.
3. Generate Makefiles/IDE Projects
Just select your preferred Makefile/IDE system with CMake. Supported targets are 32/64 bit Visual Studio projects, Unix Makefiles, Codeblocks projects with MinGW, MinGW Makefiles, etc… For the Eclipse IDE, there exist several ways of integration with CMake.
- First, make sure to have installed the C/C++ plugin!
- Menu File -> New Project…: C/C++ -> C/C++ Project with Existing Sources.
- Click next and select the MRPT root dir which contains the CMakeList.txt file.
- In “Select Configuration Mode”, choose Automatic and “cmake” should appear as autodetected.
Just build as usual: from Visual Studio click on “Build all” for the targets you want to build (Debug or Release), for Unix Makefiles invoke:
$ make -j2
After building everything, it’s a good idea to run the tests by building the “test” target under Visual Studio or by “make test” in Unix/MacOS.