Building some open source libraries with VS 2012

Today, after upgrading from VS 2010 to Visual Studio  2012 (with VS 2012 Update 4), I build some open source libraries (Boost 1.55, OpenCV 3.0.0-dev, FLANN 1.8.4, and Point Cloud Library 1.7.1-PCL) and here are some notes for ones who may find them useful.

0. Some thoughts on VS 2012: much bigger than VS 2010, without blend and other options, I just checked the MFC option but the memory required was more than 7 Gbs. The installation has less option as compared with VS 2010 (no option to exclude VB, Web support or C#, SQL Server … like in VS 2010). After update to Update 4, there is another option for MFC or Win32 project with targeting to v110-xp, this is due to the fact that VS 2012 compiled programs (before Update 4) could not run on XP. And the folder C:\ProgramData\Package Cache contains all the packages from VS 2012 installation (about 1.7 Gb, I wonders if this can be deleted). In my feelings, VS 2012 is not slower than VS 2010, it may be faster on stronger machine with 4 or 8 CPU cores. It’s a suprise that VS 2012 include the DirectX library in the C:\Program Files\Windows Kits\8.0 folder, so you can write DirectX based program without any further installation. One of the big improvement of VS 2012 is it is a true multicore compiler which can uses multicore for compiling a project, not a parallel compiler as VS 2010 (see more details from this address).

1. Hardware and software platform: Windows 7 SP1 32 bit on a laptop Core 2 Duo 2.4 Ghz with 3 Gb Ram, VS 2012 Update 4. Some required libraries are: Eigen 3.2 (for PCL), TBB 4.2 Update 2 (for OpenCV) and CMake 2.8.12.1, CUDA 5.5.2 32 bit. For details of building OpenCV with TBB, please read ref 1 or ref 2. The path to CMake’s bin directory is mandatory added to the PATH environment variable.

2. Building OpenCV 3.0.0-dev. I remove matlab, python and java building options from the file CMakeLists.txt of OpenCV and keep only the CUDA code version >=2.0 (in the file OpenCVDetectCUDA.cmake) to make the process faster. Then cmake-gui is used to generate the VS 2012’s solution and project files. On my machine, this ran for 4 hours and a folder of about 7 GBs was generated, but the install folder was only about 330 Mbs (other files and folders from the build folder can be delete after). The reason for the 4 hours duration may be caused by the /GL building option which was set for all the OpenCV projects.

3. Building Boost 1.55(which is also required by PCL): just run the bootstrap.bat from the command line and .\b2 command after but remember to add the VS 2012 path to the PATH environment variable.

4. Building FLANN 1.8.4: I used cmake-gui to create the solution file and build with VS 2012 without any problem (some python projects were not built, but I don’t need them).

5. Building PCL 1.7.1: Again, cmake-gui was used to generate the solution file, I had to set variables manually for boost and FLANN. Be careful with /GL building option because the whole optimization can caused failed build even your machine (64 bit) may have up to 16 GB of RAM, especially with pcl_feature project. This process took about 2 hours with 2.5 Gb build folder and no error was raised.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: