Windows Source Installation

Windows 10

build_passing

Tip

Windows does not provide Visual Studio *.sln file directly and requires CMake to build. Firstly, CMake can be used across multiple platforms, it is easy to configure and can be maintained in a sustainable way. Secondly, the third-party codes (Glog, OpenCV) are built using CMake.

Tip

There is currently no binary installer available, which requires you to compile from source. It is also the process of configuring the development environment.

Prerequisites

CMake (provide build)

  • CMake,used to build and compile (necessary).

  • Git, used to get code (optional).

  • Doxygen, used to generate documents (optional).

After you install the above tools, confirm that you can run this command in CMD (Command Prompt):

>cmake --version
cmake version 3.10.1

>git --version
git version 2.11.1.windows.1

>doxygen --version
1.8.13

Visual Studio (provide compilation)

After installing Visual Studio, confirm that the following command can run in the Visual Studio Command Prompt:

>cl
Microsoft (R) C/C++ Optimizing Compiler Version 19.14.26429.4 for x86

>msbuild
Microsoft (R) 生成引擎版本 15.7.179.6572

Tip

Visual Studio Command Prompt can be opened from the Start menu,

../../_images/vs_cmd_menu.png

You can also open it from the Visual Studio Tools menu.

../../_images/vs_cmd.png

However, if you do not have the Visual Studio 2015 Tools menu, you can add one yourself.

Open Tools’s External Tools… and Add the following:

Field

Value

Title

Visual Studio Command Prompt

Command

C:\Windows\System32\cmd.exe

Arguments

/k "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"

Initial Directory

$(SolutionDir)

In Visual Studio command Prompt, you can use the compile command cl link lib msbuild, etc.(need finish MSYS2``and ``Getting Source Code steps first)

../../_images/vs_cmd_test.png

MSYS2 (provide Linux command)

After installation, verify that the following path has been added to the system environment variable PATH:

C:\msys64\usr\bin

Then, open MSYS2 MSYS, perform the update and install make:

$ pacman -Syu
$ pacman -S make

Finally, the CMD (Command Prompt) can run the following command:

>make --version
GNU Make 4.2.1

Getting Source Code

git clone https://github.com/slightech/MYNT-EYE-S-SDK.git

Required Packages

>cd <sdk>
>make init
Make init
Init deps
Install cmd: pacman -S
Install deps: git clang-format
pacman -S clang-format (not exists)
error: target not found: clang-format
pip install --upgrade autopep8 cpplint pylint requests
...
Init git hooks
ERROR: clang-format-diff is not installed!
Expect cmake version >= 3.0
cmake version 3.10.1

Tip

The official OpenCV provides the exe for installation. If you want to compile from the source code, see the Official document Installation in Windows . or refer to the following command:

>git clone https://github.com/opencv/opencv.git
>cd opencv
>git checkout tags/3.4.1

>cd opencv
>mkdir _build
>cd _build

>cmake ^
-D CMAKE_BUILD_TYPE=RELEASE ^
-D CMAKE_INSTALL_PREFIX=C:/opencv ^
-D WITH_CUDA=OFF ^
-D BUILD_DOCS=OFF ^
-D BUILD_EXAMPLES=OFF ^
-D BUILD_TESTS=OFF ^
-D BUILD_PERF_TESTS=OFF ^
-G "Visual Studio 15 2017 Win64" ^
..

>msbuild ALL_BUILD.vcxproj /property:Configuration=Release
>msbuild INSTALL.vcxproj /property:Configuration=Release

Building Code

Tip

If OpenCV is installed in a custom directory or wants to specify a version, you can set the path as follows before compiling:

# OpenCV_DIR is hte path where OpenCVConfig.cmake in
set OpenCV_DIR=C:\opencv

Otherwise, CMake will prompt that OpenCV could not be found. If you don’t want to rely on OpenCV, read OpenCV Description .

Build and install:

cd <sdk>
make install

Finally, the SDK will install in <sdk>/_install by default.

Building samples

cd <sdk>
make samples

Run samples:

.\samples\_output\bin\api\camera_a.bat

For tutorial samples, please read SDK Project Demos and SDK Control Samples .

Tip

All compiled sample programs exe will have a corresponding bat. bat will temporarily set system environment variables and then run exe. So it is recommended to run bat.

If you run``exe`` directly, it may prompt that cannot find dll. Then you should add <sdk>\\_install\\bin %OPENCV_DIR%\\bin to PATH in system environment variable.

How to set the environment variable for OpenCV, refer to the official document Set the OpenCV environment variable and add it to the systems path .

Building tools

cd <sdk>
make tools

The usage of tools and scripts will be introduced later.

Tip

The script is based on Python. You need to install Python and its package management tool pip first, and then install the dependencies as follows:

cd <sdk>\tools
pip install -r requirements.txt

Note: Python is also in MSYS2, but fail install Matplotlib in test.

Conclusion

If your project will use SDK, you can refer to the settings in samples/CMakeLists.txt for CMake. Or just import the head file and dynamic library in the installation directory.