Compiling PCL from source on Windows — Point Cloud Library 0.0 documentation (original) (raw)

This tutorial explains how to build the Point Cloud Library from source on Microsoft Windows platforms. In this tutorial, we assume that you have built and installed all the required dependencies, or that you have installed them using the dependencies installers provided on the downloads page.

Note

If you installed PCL using one of the all-in-one provided installers, then this tutorial is not for you. The all-in-one installer already contains prebuilt PCL binaries which are ready to be used without any compilation step.

Note

If there is no installers for your compiler, it is recommended that you build the dependencies out of source. The Building PCL’s dependencies from source on Windows tutorial should guide you through the download and the compilation of all the required dependencies.

Microsoft Windows logo

Requirements

we assume that you have built and installed all the required dependencies, or that you have installed them using the dependencies installers provided on the downloads page. Installing them to the default locations will make configuring PCL easier.

used for shared pointers, and threading. mandatory

used as the matrix backend for SSE optimized math. mandatory

used in kdtree for fast approximate nearest neighbors search. mandatory

used in visualization for 3D point cloud rendering and visualization. mandatory

used for applications with a graphical user interface (GUI) optional

used for convex/concave hull decompositions in surface. optional

used to grab point clouds from OpenNI compliant devices. optional

is needed only to build PCL tests. We do not provide GTest installers. optional

Note

Though not a dependency per se, don’t forget that you also need the CMake build system (http://www.cmake.org/), at least version 3.5.0. A Git client for Windows is also required to download the PCL source code.

Downloading PCL source code

To build the current official release, download the source archive fromhttp://pointclouds.org/downloads/ and extract it somewhere on your disk, say C:\PCL\PCL-1.5.1-Source. In this case, you can go directly to Configuring PCL section, and pay attention to adjust the paths accordingly.

Or, you might want to build an experimental version of PCL to test some new features not yet available in the official releases. For this, you will need git ( http://git-scm.com/download ).

The invocation to download the source code is thus, using a command line:

You could also use Github for Windows (https://windows.github.com/), but that is potentially more troublesome than setting up git on windows.

Configuring PCL

On Windows, we recommend to build shared PCL libraries with static dependencies. In this tutorial, we will use static dependencies when possible to build shared PCL. You can easily switch to using shared dependencies. Then, you need to make sure you put the dependencies’ dlls either in your PATH or in the same folder as PCL dlls and executables. You can also build static PCL libraries if you want.

Run the CMake-gui application and fill in the fields:

Where is the source code : C:/PCL/pcl Where to build the binaries: C:/PCL

Now hit the “Configure” button. You will be asked for a generator. A generator is simply a compiler.

Note

In this tutorial, we will be using Microsoft Visual C++ 2010 compiler. If you want to build 32bit PCL, then pick the “Visual Studio 10” generator. If you want to build 64bit PCL, then pick the “Visual Studio 10 Win64”.

Make sure you have installed the right third party dependencies. You cannot mix 32bit and 64bit code, and it is highly recommended to not mix codes compiled with different compilers.

Choosing a generator

In the remaining of this tutorial, we will be using “Visual Studio 10 Win64” generator. Once you picked your generator, hit finish to close the dialog window. CMake will start configuring PCL and looking for its dependencies. For example, we can get this output :

CMake configure result

The upper part of CMake window contains a list of CMake variables and its respective values. The lower part contains some logging output that can help figure out what is happening. We can see, for example, that VTK was not found, thus, the visualization module will not get built.

Before solving the VTK issue, let’s organize the CMake variables in groups by checking the Grouped checkbox in the top right of CMake window. Let’s check also the Advanced checkbox to show some advanced CMake variables. Now, if we want to look for a specific variable value, we can either browse the CMake variables to look for it, or we can use the Search: field to type the variable name.

CMake grouped and advanced variables

Let’s check whether CMake did actually find the needed third party dependencies or not :

Once CMake has found all the needed dependencies, let’s see the PCL specific CMake variables :

PCL

Once PCL configuration is ok, hit the Generate button. CMake will then generate Visual Studio project files (vcproj files) and the main solution file (PCL.sln) in C:\PCL directory.

Building PCL

Open that generated solution file (PCL.sln) to finally build the PCL libraries. This is how your solution will look like.

PCL solution with project folders

Building the “ALL_BUILD” project will build everything.

Build ALL_BUILD project

Note

Make sure to build the “ALL_BUILD” project in both debug and release mode.

Installing PCL

To install the built libraries and executables, you need to build the “INSTALL” project in the solution explorer. This utility project will copy PCL headers, libraries and executable to the directory defined by the CMAKE_INSTALL_PREFIXCMake variable.

Build INSTALL project

Note

Make sure to build the “INSTALL” project in both debug and release mode.

Note

It is highly recommended to add the bin folder in PCL installation tree (e.g. C:\Program Files\PCL\bin) to your PATH environment variable.

Advanced topics

Using PCL

We finally managed to compile the Point Cloud Library (PCL) as binaries for Windows. You can start using them in your project by following theUsing PCL in your own project tutorial.

Note

You may get errors when your program is linked if you use specific point types that are not used so often (so for example pcl::PointXYZ and pcl::PointXYZI are usually not affected). Of course, the first thing you should check is whether you correctly link to all PCL libraries (target_link_libraries(<my_executable> ${PCL_LIBRARIES}) in CMake). The next thing you can try is adding #define PCL_NO_PRECOMPILE before including any PCL headers. The background is that on Windows, PCL is always compiled with PCL_ONLY_CORE_POINT_TYPES enabled, otherwise some PCL modules (e.g. pcl_features) would fail to build due to limitations of the Windows linker. The effect is that the templated classes are only instantiated for some commonly used point types, not for all. For further explanations, see the Adding your own custom PointT type tutorial.