Build OSVR on Windows

Required tools/libraries

1. Build boost

Use “Developer Command Prompt for VS2015”(C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\Shortcuts)

1
2
3
cd C:/osvr/boost_1_60_0
bootstrap.bat
b2 --toolset=msvc-14.0 architecture=x86 address-model=64 stage

2. Build OSVR-Core

目錄配置結構

1
2
3
4
5
6
C:\
├─ osvr
│  ├─ boost_1_60_0
│  ├─ jsoncpp-vc14-64bits-18
│  └─ libfunctionality-vc14-64bits-42
└─ opencv

輸入以下指令開始編譯 OSVR-Core

1
2
3
cd C:/osvr/
git clone --recursive https://github.com/OSVR/OSVR-Core.git
mkdir OSVR-Core/build

使用cmake-gui

1
2
3
4
source code dir = C:/osvr/OSVR-Core
build the binaries dir = C:/osvr/OSVR-Core/build
Configure
選 Visual Studio 14 2015 Win64

加入下列路徑

1
2
3
libfunctionality_DIR = C:/osvr/libfunctionality-binary/install/lib/cmake/libfunctionality
OpenCV_DIR = C:/osvr/opencv/build
jsoncpp_DIR = C:/osvr/jsoncpp-vc14-64bits-18/install/lib/cmake/jsoncpp

手動加入entry (click “Add Entry”, add PATH)

1
2
3
BOOST_LIBRARYDIR = C:/osvr/boost_1_60_0/libs
BOOST_ROOT = C:/osvr/boost_1_60_0
BOOST_INCLUDE_DIR = C:/osvr/boost_1_60_0

Configure and Generate, click osvrcore.sln and build

1
C:\osvr\OSVR-Core\build\osvrcore.sln

Fix compiler error (header_cpp_265, header_cpp_172) 加入opencv目錄路徑

1
2
3
PROJECT > Properties (或在專案右鍵選Properties)
Configuration Properties \ C/C++ \ General \ Additional Include Directories
add C:\osvr\opencv\build\include

Compile Plugin of video-based tracker

Need DirectShow (Microsoft Windows SDK Update)
確保 DIRECTSHOW_QEDIT_INCLUDE_DIR 和 DIRECTSHOW_STRMIIDS_LIBRARY 都要有值

1
2
DIRECTSHOW_QEDIT_INCLUDE_DIR:PATH="C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2/Include"
DIRECTSHOW_STRMIIDS_LIBRARY:PATH="C:/Program Files (x86)/Windows Kits/8.1/Lib/winv6.3/um/x64/strmiids.lib"

CMake Script

輸入以下腳本可以自動完成上面第2步
gen_vs2015_64.sh

1
2
3
4
5
6
7
8
9
10
11
12
cd OSVR-Core/build
cmake .. \
-G "Visual Studio 14 2015 Win64" \
-DCMAKE_INSTALL_PREFIX:PATH=C:/osvr/install \
-Dlibfunctionality_DIR:PATH=C:/osvr/jsoncpp-vc14-64bits-18/install/lib/cmake/libfunctionality \
-DOpenCV_DIR:PATH=C:/osvr/opencv/build \
-Djsoncpp_DIR:PATH=C:/osvr/jsoncpp-vc14-64bits-18/install/lib/cmake/jsoncpp \
-DBOOST_LIBRARYDIR:PATH=C:/osvr/boost_1_60_0/libs \
-DBOOST_ROOT:PATH=C:/osvr/boost_1_60_0 \
-DBOOST_INCLUDE_DIR:PATH=C:/osvr/boost_1_60_0 \
-DBUILD_HEADER_DEPENDENCY_TESTS:BOOL=OFF \
-DBUILD_TESTING:BOOL=OFF