Visual Servoing Platform  version 3.1.0 under development (2017-06-22)
Tutorial: Installation from source for Universal Windows Platform (UWP)

In this tutorial you will learn how to build ViSP framework for Universal Windows Platform (UWP) to include ViSP functionalities in apps developments that target a wide range of devices including PC, mobile, Xbox, HoloLens, IoT, and Surface Hub.

This tutorial has been tested on Windows 10 (64 bit), with CMake 3.7.1 and Visual Studio Community 2015 and is only working since ViSP 3.0.1.

Note
Concerning ViSP installation, we provide also other Tutorials.

Install required software

  • CMake last version that could be download at http://www.cmake.org
  • Visual Studio Community 2015. Make sure that the Universal Windows App Development Tools are selected from the optional features list. Without these tools, you won't be able to create your universal apps. After the installation, start Visual Studio and create an empty C++ project to install the common tools for Visual C++ 2015.
Note
If you have already Visual Stodio 2015 installed and don't know if the Universal Windows App Development Tools are enabled see How to add Universal Windows App Development Tools support.

After installing Visual Studio software, you need to enable your Windows 10 device for development.

Get ViSP source code

There are different ways to get ViSP source code.

  • You can download the latest release as a zip or a tarball. Once visp-x.y.z.tar.gz or visp-x.y.z.zip is downloaded, uncompress the file.
  • You can also download a daily snapshot. Once visp-snapshot-yyyy-mm-dd.tar.gz is downloaded, uncompress the file.
  • Or you get the cutting-edge ViSP from GitHub repository using the git command line (see How to install Git):
    C:\ViSP> git clone https://github.com/lagadic/visp.git

We suppose now that ViSP source is in a directory denoted <source_dir>, for example C:\ViSP\visp.

Next we suggest to first build ViSP without OpenCV.

Build ViSP without OpenCV

Build for Windows Store 10.0

  • Configure ViSP build for Windows Store 10 targeting a x86 platform, by opening a cmd terminal and running:
    $ cd C:\ViSP
    $ md visp-build-msvc14-uwp-ws-10
    $ cd visp-build-msvc14-uwp-ws-10
    $ cmake.exe -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME:String=WindowsStore -DCMAKE_SYSTEM_VERSION:String="10.0" -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=x86 ../visp
  • To build ViSP just double click on C:/ViSP/visp-build-msvc14-uwp-ws-10/VISP.sln solution file. This action will open ViSP project in Visual Studio C++.
  • With Visual Studio build and install the solution. If everything goes right you will find ViSP libraries and headers in C:\ViSP\visp-build-msvc14-uwp-ws-10\install folder.

Build for Windows Store 8.1

  • Configure ViSP build for Windows Store 8.1 targeting a x86 platform, by opening a cmd terminal and running:
    $ cd C:\ViSP
    $ md visp-build-msvc14-uwp-ws-8.1
    $ cd visp-build-msvc14-uwp-ws-8.1
    $ cmake.exe -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME:String=WindowsStore -DCMAKE_SYSTEM_VERSION:String="8.1" -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=x86 ../visp
  • To build ViSP just double click on C:/ViSP/visp-build-msvc14-uwp-ws-8.1/VISP.sln solution file. This action will open ViSP project in Visual Studio C++.
  • With Visual Studio build and install the solution. If everything goes right you will find ViSP libraries and headers in C:\ViSP\visp-build-msvc14-uwp-ws-8.1\install folder.

Build for Windows Phone 8.1

  • Configure ViSP build for Windows Phone 8.1 targeting a x86 platform, by opening a cmd terminal and running:
    $ cd C:\ViSP
    $ md visp-build-msvc14-uwp-wp-8.1
    $ cd visp-build-msvc14-uwp-wp-8.1
    $ cmake.exe -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME:String=WindowsPhone -DCMAKE_SYSTEM_VERSION:String="8.1" -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=x86 ../visp
  • To build ViSP just double click on C:/ViSP/visp-build-msvc14-uwp-wp-8.1/VISP.sln solution file. This action will open ViSP project in Visual Studio C++.
  • With Visual Studio build and install the solution. If everything goes right you will find ViSP libraries and headers in C:\ViSP\visp-build-msvc14-uwp-wp-8.1\install folder.

Now if you want that ViSP benefits from OpenCV functionalities, you can follow the next section.

Build ViSP with OpenCV

Note
The following steps are given for Windows Store 10.0 targetting a x86 platform. They need to be adapted to your use case.

Building ViSP with OpenCV as 3rd party needs first to succeed in building OpenCV for UWP. As of writing on January 2017, the way is to use Microsoft fork https://github.com/Microsoft/opencv and branch vs2015-samples.

  • Get OpenCV source code
    $ cd C:\OpenCV
    $ git clone https://github.com/Microsoft/opencv.git
    $ cd opencv
    $ git checkout vs2015-samples
  • Download opencv-microsoft-branch-vs2015-samples-patch.diff patch and save it in C:\OpenCV folder. This patch allows to add /WZ compiler option when building highgui and videoio modules.
  • Modify the source code applying the patch
    $ git apply --ignore-space-change --ignore-whitespace ..\opencv-microsoft-branch-vs2015-samples-patch.diff
  • Configure OpenCV build. The following command is for Windows Store 10.0 targetting a x86 platform but could be easily adapted:
    $ cd C:\OpenCV
    $ md opencv-build-msvc14-uwp-ws-10.0
    $ cd opencv-build-msvc14-uwp-ws-10.0
    $ cmake.exe -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME:String=WindowsStore -DCMAKE_SYSTEM_VERSION:String="10.0" -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=x86 -DBUILD_opencv_ts=OFF ../opencv
  • Open C:/OpenCV/opencv-build-msvc14-uwp-ws-10/opencv.sln file with Visual Studio 2015, build and install all the solution
  • If everything goes right you will find OpenCV libraries and headers in C:\OpenCV\opencv-build-msvc14-uwp-ws-10\install folder.

Now you can use OpenCV as third-party and configure ViSP in order to use OpenCV. To this end modify the cmake command that was used to Build ViSP without OpenCV by adding -DOpenCV_DIR=C:\OpenCV\opencv-build-msvc14-uwp-ws-10\install option to cmake command line:

$ cd C:\ViSP\visp-build-msvc14-uwp-ws-10
$ cmake.exe -G "Visual Studio 14 2015" -DCMAKE_SYSTEM_NAME:String=WindowsStore -DCMAKE_SYSTEM_VERSION:String="10.0" -DCMAKE_VS_EFFECTIVE_PLATFORMS:String=x86 -DOpenCV_DIR=C:/OpenCV/opencv-build-msvc14-uwp-ws-10/install ../visp

As described in Build ViSP without OpenCV, open again ViSP solution file, build and install ViSP.

Tips and tricks

How to add Universal Windows App Development Tools support

In case you're trying to build Windows Store and Windows Phone 10.0 projects having only default Visual Studio 2015 installation you'll likely get the following error during cmake run:

A Windows Store component with CMake requires both the Windows Desktop SDK
as well as the Windows Store '10.0' SDK. Please make sure that you have
both installed

Resolution consists in:

  • On the Start menu select Settings
  • Select System > Apps & features.
  • Select Microsoft Visual Studio 2015 program, and right click to modify installation
    img-uwp-msvc-modify.png
  • Select Modify
    img-uwp-msvc-modify2.png
  • Enable "Universal Windows App Development Tools" and "Windows 8.1 and Windows Phone 8.0/8.1 Tools"
    img-uwp-msvc-modify3.png
  • Select Update button