Wednesday, February 17, 2010

Building MRPT under Windows with MSVC

These are brief instructions on building MRPT under Windows.
  1. Download CMake, and install it. (You need a recent version, > 2.6)
  2. Download OpenCV, and install it. (I used the source package)
  3. Download wxWidgets, and install it. (Again, I used source.) [Note: wxWidgets is in my opinion one of the worst packages I've ever had to deal with - its build is notoriously unstable]
  4. Find the wxWidgets 'include/wx/msw/setup.h' file, and enable the use of OpenGL widgets:

    #define wxUSE_GLCANVAS       1
  5. Open (and convert) the VC6 build solution (build/msw: wx.dsw), and perform a batch build (select all, and go!). You will need to do this three or four times. (wx does not have the dependencies correct!)
  6. Close Visual Studio, and add an environment variable (right click on my computer, properties, advanced). Set wxWidgets_ROOT_DIR to C:\wxWidgets-2.8.10\lib\vc_lib (or your equivalent).

    We are now done with wxWidgets - you may wish to try some samples to make sure it works. (Pick ones that use OpenGL)

  7. Now run CMake with OpenCV. Set the Source and Bin directories to your OpenCV directory, eg:

    source: C:/OpenCV2.0
    bin: C:/OpenCV2.0
    
    . Press Configure a few times and generate the solution files.
  8. Compile OpenCV from the generated solution (Should be in C:/OpenCV2.0). Try some of the examples. Many of them require a webcam, so try plugging one to make sure DirectShow works.

  9. Set your visual studio library directory (Projects and Solutions/ VC++ Directories) to include the OpenCV lib directory. Close visual studio.
  10. Run the MRPT makefile 'win32_rebuild_MSVC9_GUI.bat' (not sure why?), and then start CMake again, clear the cache, and point CMake to MRPT. eg:




    source: C:/lib/MRPT/mrpt-0.8.0
    binaries: C:/lib/MRPT/mrpt-0.8.0/makefiles/MSVC9
    
  11. Build MRPT, all done!
Before running the examples you will probably need to copy all openCV dll's from the OpenCV bin directory, and copy all the wx widgets dll's from lib/vc_dll directory into the MRPT bin directories.

No comments: