File: tutorial-install-win10-mingw-w64.dox

package info (click to toggle)
visp 3.7.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 166,332 kB
  • sloc: cpp: 392,705; ansic: 224,448; xml: 23,444; python: 13,701; java: 4,792; sh: 206; objc: 145; makefile: 60
file content (850 lines) | stat: -rw-r--r-- 36,450 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
/**

\page tutorial-install-win10-mingw-w64 Tutorial: Installation from source for Windows 10 with MinGW-w64
\tableofcontents

In this tutorial you will learn how to install ViSP from source on Windows 10 with MinGW-W64.
These steps have been tested with CMake 3.19.0 and MinGW-W64 - GCC for Windows 64 & 32 bits.

\note Concerning ViSP installation, we provide also other \ref tutorial.

\section install_win10_mingw_required 1. Install prerequisites

\subsection install_win10_mingw_required_mingw 1.1. MinGW-W64

- MinGW64 can be downloaded from [here](https://winlibs.com/#download-release).
\note At the time this tutorial was created, we downloaded the latest UCRT runtime Win64 Zip archive Version
`"GCC 13.1.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 16.0.5 + MinGW-w64 11.0.0 (UCRT) - release 5 (LATEST)"`
that brings `winlibs-x86_64-posix-seh-gcc-13.1.0-llvm-16.0.5-mingw-w64ucrt-11.0.0-r5.zip` file.
- After downloading, you should unzip the file to a folder. We recommend to unzip in to `C:\` root drive.
- At this point, in `C:\mingw64` folder you should have something similar to
\image html img-mingw-explorator.jpg
- Then you have to set up path. For that follow these steps:
  - Open settings
  - Search for Edit environment variables for your account
  - Choose path variable and then select edit
  - Select New and add the path to Mingw-w64 bin folder. In our case, you may add `C:\mingw64\bin`
  - Select OK to save the updated path
  - Now reopen your `cmd` and check if everything is good by typing:
\verbatim
C:\> gcc --version
gcc (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 13.1.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\endverbatim

\subsection install_win10_mingw_3rd_cmake 1.2. CMake

CMake could be download from http://www.cmake.org. Download the latest release for Windows win64-x64
platform (at the time this tutorial was written it was the file `cmake-3.26.4-win64-x64.msi`).
To install just double click on the msi file.

\subsection install_win10_mingw_3rd_git 1.3. Git

Install Git for Windows from https://git-for-windows.github.io/. This installation allows then to use git in a
`cmd` Command Prompt.

\section install_win10_mingw_ws 2. Create a workspace

If not already done, create a workspace that will contain all ViSP source, build, data set and optional
3rd parties. This workspace is here set to `C:\visp-ws` folder, but it could be set to any other location.

To create the workspace, open a `cmd` Command Prompt (a fast way to launch this window is to press the
Win + R keys on your keyboard. Then, type `cmd` or `cmd.exe` and press Enter or click/tap OK) and run
the following to create a workspace environment var named `VISP_WS`:
\verbatim
C:\> setx VISP_WS "C:\visp-ws"
C:\> exit
\endverbatim
Open a new `cmd` Command Prompt and create the corresponding folder
\verbatim
C:\> mkdir %VISP_WS%
C:\> exit
\endverbatim

\section install_win10_mingw_quick 3. Quick ViSP installation

In this section, we give minimal instructions to build ViSP from source just to try ViSP without entering
in \ref install_win10_mingw_advanced.

- Open a new `cmd` Command Prompt and get ViSP source code in the workspace
\verbatim
C:\> cd %VISP_WS%
C:\> git clone https://github.com/lagadic/visp.git
\endverbatim
- Create a build directory
\verbatim
C:\> mkdir %VISP_WS%\visp-build-mingw
C:\> cd %VISP_WS%\visp-build-mingw
\endverbatim
- Run CMake in build directory (here the generator is chosen for Visual Studio 15 2017 and 64 bits hardware):
\verbatim
C:\> cmake -G "MinGW Makefiles" %VISP_WS%\visp
\endverbatim
- Build and install ViSP (installation doesn't need administrator privileges)
\verbatim
C:\> cmake --build . --config Release --target install -j4
\endverbatim
- ViSP is now installed in `%%VISP_WS%\visp-build-mingw\install` folder
- Modify the `Path` var to add `%%VISP_WS%\visp-build-mingw\install\x64\mingw\bin` corresponding to the path
to ViSP libraries. To modify `Path` environment variable do the following:
  - Open the Start Search, type in "env", and choose "Edit environment variables for your account"
  - Click the "Environment Variables..." button
  - Under the "User Variables" section (the upper half), find the row with "Path" in the first column,
  and click edit
  - The "Edit environment variable" UI will appear.
  - Click "New" button to add a new line with `%%VISP_WS%\visp-build-mingw\install\x64\mingw\bin`

- Set `VISP_DIR` var to help CMake to find ViSP as a 3rd party
\verbatim
C:\> setx VISP_DIR "%VISP_WS%\visp-build-mingw\install"
C:\> exit
\endverbatim

To have a trial, just jump to \ref install_win10_mingw_dataset before running some binaries that you
just build or jump to \ref install_win10_mingw_next. You can later come back to the
\ref install_win10_mingw_advanced.

\section install_win10_mingw_advanced 4. Advanced ViSP installation

\subsection install_win10_mingw_3rdparty 4.1. Install 3rd parties

ViSP is interfaced with several 3rd party libraries.
Follow the link to see the complete list of \ref supported-third-parties.
We recommend to install \ref install_win10_mingw_3rdparty_eigen,
\ref install_win10_mingw_3rdparty_opencv and \ref install_win10_mingw_3rdparty_json in the workspace.

\subsubsection install_win10_mingw_3rdparty_opencv 4.1.1. OpenCV

<b>4.1.1.1. Get OpenCV</b>

First you have to get OpenCV:
- From https://opencv.org/releases/ download the latest OpenCV for Windows. In our case we got
`opencv-4.8.0-windows.exe` Win pack installer. The same procedure could be applied with all the previous
OpenCV releases starting from 3.4.0 version.
- Extract the content of the archive in your workspace `%%VISP_WS%\3rdparty`.
\image html img-win-extract-opencv.jpg
- The installer extract all the material in `%%VISP_WS%\3rdparty\opencv`.
- We strongly recommend to rename this folder to a name that contain OpenCV version like
  `%%VISP_WS%\3rdparty\opencv-4.8.0`.

\note OpenCV 4.7.0 win pack installer contains prebuild OpenCV libraries build with Visual Studio 16 2019 (vc16)
but there is no build for MinGW. That's why you need to build yourself OpenCV
from source and install the libraries in `%%VISP_WS%\3rdparty\opencv-4.8.0\build\x64\mingw`.

<b>4.1.1.2. Configure, build and install OpenCV from source</b>

- Open a `cmd` Command Prompt and create a build folder
\verbatim
C:\> cd %VISP_WS%\3rdparty\opencv-4.8.0
C:\> mkdir build-mingw && cd build-mingw
\endverbatim
- Run CMake in build directory and set the install dir to `%%VISP_WS%\3rdparty\opencv-4.8.0\build`. We disable also
tests build in order to speed up the build process:
\verbatim
C:\> cmake -G "MinGW Makefiles" ..\sources -DCMAKE_INSTALL_PREFIX=%VISP_WS%\3rdparty\opencv-4.8.0\build -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF
\endverbatim
- Build and install OpenCV for MinGW (installation doesn't need administrator privileges)
\verbatim
C:\> cmake --build . --config Release --target install -j4
\endverbatim
- OpenCV is now installed in `%%VISP_WS%\opencv-4.8.0\build` folder

\note - With OpenCV 4.7.0 and 4.8.0 if you don't set `WITH_OBSENSOR=OFF` during cmake configuration you will get an
\ref issue_win10_mingw_opencv_obsensor.
\note - With OpenCV 4.5.0 if you don't set `OPENCV_ENABLE_ALLOCATOR_STATS=OFF` you will get an
\ref issue_win10_mingw_opencv_allocator.
\note - With OpenCV 4.1.0 if you don't set `WITH_OPENCL_D3D11_NV=OFF` you will get an
\ref issue_win10_mingw_opencv_opencl_d3d11.
\note - Using OpenCV older versions you may encounter the following issues, for which we propose work arounds;
\ref issue_win10_mingw_opencv_precompiled_headers, \ref issue_win10_mingw_opencv_cap_dshow,
\ref issue_win10_mingw_opencv_dtor, \ref issue_win10_mingw_opencv_tiff, or \ref issue_win10_mingw_opencv_ipp.

<b>4.1.1.3. Complete OpenCV installation</b>

Now you have to complete OpenCV installation setting some environment vars:
- In order that ViSP detects OpenCV you have to set `OpenCV_DIR` environment variable. Start up a `cmd`
Command Prompt and enter:
\verbatim
C:\> setx OpenCV_DIR "%VISP_WS%\3rdparty\opencv-4.8.0\build"
C:\> exit
\endverbatim
where `%%VISP_WS%\3rdparty\opencv-4.8.0\build` is where you have installed OpenCV. Inside this folder you should
have a file named `OpenCVConfig.cmake`.

- You have also to add the location of OpenCV libraries corresponding to MinGW usage in the `Path`
environment variable. Open the "Edit environment variable" UI, and modify `Path` to add a new line with
`%%VISP_WS%\3rdparty\opencv-4.8.0\build\x64\mingw\bin`.

\subsubsection install_win10_mingw_3rdparty_eigen 4.1.2. Eigen3

Even if Eigen3 is designed as a template we recommend to install the library with MinGW.

<b>4.1.2.1. Get Eigen3</b>

- Download the latest Eigen3 release from http://eigen.tuxfamily.org. At the time this tutorial was
written we downloaded `eigen-3.4.0.zip` archive corresponding to Eigen 3.4.0.
- Extract the content of the archive in `%%VISP_WS%\3rdparty`.
- Once unzipped, you should have Eigen in `%%VISP_WS%\3rdparty\eigen-3.4.0`

<b>4.1.2.2. Build and install Eigen3 from source</b>

- Create a build directory
\verbatim
C:\> cd %%VISP_WS%\3rdparty\eigen-3.4.0
C:\> mkdir build-mingw && cd build-mingw
\endverbatim
- Run CMake in build directory (here the generator is chosen for MinGW and installation folder is set to
`%%VISP_WS%\3rdparty\eigen-3.4.0\build-mingw\install` folder):
\verbatim
C:\> cmake -G "MinGW Makefiles" .. -DCMAKE_INSTALL_PREFIX=%VISP_WS%\3rdparty\eigen-3.4.0\build-mingw\install
\endverbatim
- Build and install Eigen3 (installation doesn't need administrator privileges)
\verbatim
C:\> cmake --build . --config Release --target install -j4
\endverbatim
- Eigen3 is now installed in `%%VISP_WS%\3rdparty\eigen-3.4.0\build-mingw\install` folder.

<b>4.1.2.3. Complete Eigen3 installation</b>

Now you have to complete Eigen3 installation setting some environment vars:
- In order that ViSP detects eigen you have to set `EIGEN_DIR` environment variable. Start up a `cmd` Command Prompt
and enter:
\verbatim
C:\> setx Eigen3_DIR "%VISP_WS%\3rdparty\eigen-3.4.0\build-mingw\install\share\eigen3\cmake"
C:\> exit
\endverbatim
where `%%VISP_WS%\3rdparty\eigen-3.4.0\build-mingw\install` is where you have installed Eigen3. Inside the folder
`%%VISP_WS%\3rdparty\eigen-3.4.0\build-mingw\install\share\eigen3\cmake` you should have a file named
`Eigen3Config.cmake`.
- There is no need to set `Path` environment var since Eigen3 is a template that has no library.

\subsubsection install_win10_mingw_3rdparty_json 4.1.3. Nlohmann JSON

<a href="https://json.nlohmann.me/">JSON for modern C++</a> installation need to be installed from source for MinGW.

- Open a `cmd` Command Prompt and follow the instructions below
\verbatim
C:\> cd %VISP_WS%\3rdparty
C:\> git clone https://github.com/nlohmann/json.git
C:\> cd json && mkdir build-mingw && cd build-mingw
C:\> cmake -G "MinGW Makefiles" .. -DCMAKE_INSTALL_PREFIX=%VISP_WS%\3rdparty\json\build-mingw\install -DBUILD_TESTING=OFF -DJSON_BuildTests=OFF
C:\> cmake --build . --config Release --target install
\endverbatim
  JSON is now installed in `%%VISP_WS%\3rdparty\json\build-mingw\install` folder.
  Now in order that ViSP detects JSON you have to set `nlohmann_json_DIR` environment variable.
  Start up a `cmd` Command Prompt and enter:
\verbatim
C:\> setx nlohmann_json_DIR "%VISP_WS%\3rdparty\json\build-mingw\install\share\cmake\nlohmann_json"
C:\> exit
\endverbatim
where `%%VISP_WS%\3rdparty\json\build-mingw\install` is where you have installed JSON.
Inside the folder `%%VISP_WS%\3rdparty\json\build-mingw\install\share\cmake\nlohmann_json` you should have a file
named `nlohmann_jsonConfig.cmake`.
There is no need to set `Path` environment var since JSON has only a header and no library.

\subsection install_win10_mingw_get_source 4.2. Get ViSP source code

There are different ways to get ViSP source code.

- You can download the <a href="https://visp.inria.fr/download">latest release</a> as a zip or a tarball.
Once `visp-x.y.z.tar.gz` or `visp-x.y.z.zip` is downloaded, uncompress the file in
`%%VISP_WS%\visp\visp-x.y.z` using for example <a href="http://www.win-rar.com">WinRAR</a>.

- You can also download a <a href="https://visp.inria.fr/download#snapshot">daily snapshot</a>. Once
`visp-snapshot-yyyy-mm-dd.tar.gz` is downloaded, uncompress the file in
`%%VISP_WS%\visp\visp-x.y.z` using for example <a href="http://www.win-rar.com">WinRAR</a>.

- Or you get the cutting-edge ViSP from <a href="https://github.com/lagadic/visp">GitHub repository</a> using
the `git` command line tool:
\verbatim
C:\> cd %VISP_WS%
C:\> git clone https://github.com/lagadic/visp.git
\endverbatim

We suppose now that ViSP source is in `%%VISP_WS%\visp`.

\subsection install_win10_mingw_config 4.3. Configure ViSP from source

The goal of the configuration step is now to use CMake to produce a Visual Studio C++ solution file that
will be located in `%%VISP_WS%/visp-build-mingw`.

- Launch CMake (cmake-gui) and complete the source code and binaries location as in the next image.
\image html img-cmake-win10-mingw-visp-launch.png
- Click then on "Configure" button.
\image html img-cmake-win10-mingw-visp-create-folder.png
- Click on "Yes" to create the `%%VISP_WS%/visp-build-mingw` folder.
- Select then your compiler "MinGW Makefiles" and click on "Finish" button.
\image html img-cmake-win10-mingw-makefiles.png
- This will start CMake configuration. As shown in the next image, Eigen3, GDI, JSON, OpenCV and OpenMP 3rd parties
  are automatically detected.
\image html img-cmake-win10-mingw-visp-config.jpg
\note - If OpenCV is not detected, you may encounter the following issue \ref issue_win10_mingw_opencv_not_detected.

\note - Installation folder is set to `%%VISP_WS%/visp-build-mingw/install`. If you want to change the installation
folder to `C:/Program Files (x86)/ViSP`, make sure that you have administrator privileges to write in that
folder before modifying `CMAKE_INSTALL_PREFIX`.

- Click then on "Configure" button. All the red lines should disappear.
\note The default configuration lead to the creation of a shared library (with `.dll` extension). This is
the default configuration that is recommended. If you want to create rather a static library
(with `.lib` extension) you have to uncheck the `BUILD_SHARED_LIBS` option to disable DLL creation.

- To finish the configuration, click on "Generate" button.

- Once the generation is done, in `%%VISP_WS%/visp-build-mingw` folder you have the Makefile file that
will be used by MinGW to build the whole project.

\subsection install_win10_mingw_build 4.4. Build and install ViSP

- To build ViSP, open a `cmd` Command Prompt, change to `%%VISP_WS%\visp-build-mingw` folder and run
`mingw32-make`:
\verbatim
C:\> cd %VISP_WS%\visp-build-mingw
C:\> mingw32-make -j4
\endverbatim

- Now to install ViSP, in the same `cmd` Command Prompt run:
\verbatim
C:\> mingw32-make -j4 install
\endverbatim

- At the end, in `%%VISP_WS%/visp-build-mingw/install/x64/mingw/bin` folder you will find ViSP DLL libraries
corresponding to the build modules.
\image html img-win10-mingw-visp-explorer-install.jpg

\note When `CMAKE_BUILD_TYPE` is set to Debug, the library names are suffixed by "d".

\subsection install_win10_mingw_build_visp_doc 4.5. Build ViSP documentation

To build ViSP documentation, you have first to install [Doxygen](http://www.doxygen.nl):
- [Download](http://www.doxygen.nl/download.html) binary distribution for Windows. At the time this tutorial
was written, we downloaded `doxygen-1.8.20-setup.exe`
- Run the installer following default options
- Open a new `cmd` Command Prompt and enter build directory
\verbatim
C:\> cd %VISP_WS%\visp-build-mingw
\endverbatim
- Run CMake in build directory:
\verbatim
C:\> cmake -G "MinGW Makefiles" %VISP_WS%\visp
\endverbatim
- Build documentation using:
\verbatim
C:\> cmake --build . --config Release --target visp_doc
\endverbatim

The generated documentation is then available in `$VISP_WS/visp-build-mingw/doc/html/index.html`

\note
- To speed up generating online doc, particularly around formula rendering, you can use
[MatJax](https://www.mathjax.org). To this end, install first `npm` LTS version following these
[instructions](https://www.npmjs.com/get-npm), then install MathJax and build doc using:
\verbatim
C:\> npm install mathjax
C:\> cmake -G "MinGW Makefiles" %VISP_WS%\visp -DUSE_MATHJAX=ON
C:\> cmake --build . --config Release --target visp_doc
\endverbatim

- It is also possible to generate a more complete documentation that includes also all the
internal classes. This could be achieved setting CMake var `ENABLE_FULL_DOC` to `ON` like:
\verbatim
C:\> cmake -G "MinGW Makefiles" %VISP_WS%\visp -DENABLE_FULL_DOC=ON
C:\> cmake --build . --config Release --target visp_doc
\endverbatim

\subsection install_win10_mingw_env_var 4.6. Set Path environment var

Modify the `Path` var to add the path to ViSP dll libraries. To this end open the "Edit environment variable"
UI, and modify `Path` to add a new line with `%%VISP_WS%\visp-build-mingw\install\x64\mingw\bin`.

\subsection install_win10_mingw_visp_dir 4.7. Set VISP_DIR environment var

In order to ease ViSP detection by CMake when ViSP is used as a 3rd party in an external project, like the
one described in the \ref tutorial-getting-started, you may set `VISP_DIR` environment variable with the
path to the `VISPConfig.cmake` file:
\verbatim
C:\> setx VISP_DIR "%VISP_WS%\visp-build-mingw\install"
C:\> exit
\endverbatim

\section install_win10_mingw_dataset 5. Install ViSP data set

Some ViSP examples and tests require a dataset that contains images, video, models that is not part of ViSP
source code. This dataset is available in Github (https://github.com/lagadic/visp-images) or as a release
in a separate archive named `visp-images-x.y.z.zip`. This archive could be downloaded from
https://visp.inria.fr/download page. Note that ViSP tutorials are not using ViSP data set.

We give hereafter the two ways to get this data set:

\subsection install_win10_mingw_dataset_release 5.1. Get data set release

- Download the latest dataset release from https://visp.inria.fr/download and uncompress it in your workspace
  `%%VISP_WS%`. At the time this tutorial was written, the latest release was `visp-images-3.6.0.zip`.
\image html  img-win-visp-images-git.jpg
- Once downloaded, you need to set `VISP_INPUT_IMAGE_PATH` environment variable to help ViSP examples
and tests to detect automatically the location of the requested data. In our case, this variable should
be set to `%%VISP_WS%\visp-images-3.6.0`. Open a `cmd` Command Prompt and run
\verbatim
C:\> setx VISP_INPUT_IMAGE_PATH %VISP_WS%\visp-images-3.6.0
C:\> exit
\endverbatim

\subsection install_win10_mingw_dataset_github 5.2. Get data set from github

- Use git to get the data set latest version:
\verbatim
C:\> cd %VISP_WS%
C:\> git clone https://github.com/lagadic/visp-images.git
\endverbatim
\image html img-win-visp-images-last-release.jpg
- Once cloned, you need to set `VISP_INPUT_IMAGE_PATH` environment variable to help ViSP examples and tests
to detect automatically the location of the requested data. In our case, this variable should be set to
`%%VISP_WS%\visp-images`. Open a `cmd` Command Prompt and run
\verbatim
C:\> setx VISP_INPUT_IMAGE_PATH %VISP_WS%\visp-images
C:\> exit
\endverbatim

\subsection install_win10_mingw_dataset_test 5.3. Test data set usage

From now, you can try to run ViSP examples and tests. For example, if you want to run
`%%VISP_WS%\visp-build-mingw\example\device\display\displayOpenCV.exe`, open a `cmd` Command Prompt,
enter in the right folder and run:
\verbatim
C:\> cd %VISP_WS%\visp-build-mingw\example\device\display
C:\> displayOpenCV.exe

A click to close the windows...

A click to display a cross...
Cross position: 392, 306

A click to exit the program...
Bye
\endverbatim

\section install_win10_mingw_tips 6. Tips and tricks

\subsection install_win10_mingw_tips_new_3rdparty 6.1. How to take into account a newly installed 3rd party

Since all 3rd parties are optional you may have started to install only some of them. Imagine that you
just installed a new third-party, or that you upgraded the version of this 3rd party. The next step is to
go back to the build folder, configure ViSP with CMake to detect the newly installed third-party library
and build again ViSP. This could be achieved with:
\verbatim
$ cd $VISP_WS/visp-build-mingw
$ cmake ../visp
\endverbatim

Here you can check the content of the `ViSP-third-party.txt` file and see if the newly installed 3rd party
is well detected.

Finally, you need to rebuild ViSP with:
\verbatim
$ mingw32-make
\endverbatim

\subsection install_win10_mingw_tips_uninstall 6.2. How to uninstall ViSP
After ViSP installation, you can remove installed material using:
\verbatim
$ cd $VISP_WS/visp-build-mingw
$ mingw32-make uninstall
\endverbatim

\subsection install_win10_mingw_tips_modules 6.3. How to build only ViSP libraries

If you want to build only ViSP modules libraries, nor the examples, tutorials and tests:
\verbatim
$ cd $VISP_WS%/visp-build-mingw
$ mingw32-make visp_modules
\endverbatim

\subsection install_win10_mingw_tips_module_once 6.4. How to build a ViSP specific module

If you want to build a given module and all the dependencies:
\verbatim
$ cd $VISP_WS%/visp-build-mingw
$ mingw32-make visp_<module_name>
\endverbatim

For example to build the model-based tracker module named mbt, run:
\verbatim
$ cd $VISP_WS%/visp-build-mingw
$ mingw32-make visp_mbt
\endverbatim

\subsection install_win10_mingw_tips_3rd_party 6.5. Which are the 3rd party libraries that are used in ViSP ?

To see which are the optional 3rd parties that are found during the configuration stage and that will be
used by ViSP during the build you can have a look to the text file named `ViSP-third-party.txt` and
located in `%%VISP_WS%/visp-build-mingw`. We provide hereafter an example of a possible content of this
file that contains also build info.
\verbatim
$ type %VISP_WS%/visp-build-mingw/ViSP-third-party.txt

==========================================================
General configuration information for ViSP 3.5.1

  Version control:               08a979a03-dirty

  Platform:
    Timestamp:                   2023-07-06T14:34:24Z
    Host:                        Windows 10.0.19044 AMD64
    CMake:                       3.26.4
    CMake generator:             MinGW Makefiles
    CMake build tool:            C:/mingw64/bin/mingw32-make.exe
    Configuration:               Release

  System information:
    Number of CPU logical cores: 4
    Number of CPU physical cores: 4
    Total physical memory (in MiB): 16057
    OS name:                     Windows
    OS release:                  Professional
    OS version:                  (Build 19044)
    OS platform:                 AMD64
    CPU name:                    Pentium II (0.25 micron)
    Is the CPU 64-bit?           yes
    Does the CPU have FPU?       yes
    CPU optimization:            SSE2 SSE3 SSSE3

  C/C++:
    Built as dynamic libs?:      yes
    C++ Compiler:                C:/mingw64/bin/c++.exe  (ver 13.1.0)
    C++ flags (Release):         -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -msse2 -msse3 -mssse3 -O3 -DNDEBUG
    C++ flags (Debug):           -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -msse2 -msse3 -mssse3 -g
    C Compiler:                  C:/mingw64/bin/gcc.exe
    C flags (Release):           -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -msse2 -msse3 -mssse3 -O3 -DNDEBUG
    C flags (Debug):             -Wall -Wextra -fopenmp -std=c++17 -fvisibility=hidden -msse2 -msse3 -mssse3 -g
    Linker flags (Release):
    Linker flags (Debug):
    Use cxx standard:            17

  ViSP modules:
    To be built:                 core dnn_tracker gui imgproc io java_bindings_generator klt me sensor ar blob robot visual_features vs vision detection mbt tt tt_mi
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 java

  Windows RT support:            no

  Python (for build):            C:/Python310/python.exe

  Java:
    ant:                         no
    JNI:                         C:/Program Files/Microsoft/jdk-11.0.16.101-hotspot/include C:/Program Files/Microsoft/jdk-11.0.16.101-hotspot/include/win32 C:/Program Files/Microsoft/jdk-11.0.16.101-hotspot/include

  Build options:
    Build deprecated:            yes
    Build with moment combine:   no

  OpenCV:
    Version:                     4.8.0
    Modules:                     calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo stitching video videoio
    OpenCV dir:                  C:/visp-ws/3rdparty/opencv-4.8.0/build

  Mathematics:
    Blas/Lapack:                 yes
    \- Use MKL:                  no
    \- Use OpenBLAS:             no
    \- Use Atlas:                no
    \- Use Netlib:               no
    \- Use GSL:                  no
    \- Use Lapack (built-in):    yes (ver 3.2.1)
    Use Eigen3:                  yes (ver 3.4.0)
    Use OpenCV:                  yes (ver 4.8.0)

  Simulator:
    Ogre simulator:
    \- Use Ogre3D:               no
    \- Use OIS:                  no
    Coin simulator:
    \- Use Coin3D:               no
    \- Use SoWin:                no
    \- Use SoXt:                 no
    \- Use SoQt:                 no
    \- Use Qt5:                  no
    \- Use Qt4:                  no
    \- Use Qt3:                  no

  Media I/O:
    Use JPEG:                    no
    Use PNG:                     no
    \- Use ZLIB:                 no
    Use OpenCV:                  yes (ver 4.8.0)
    Use stb_image (built-in):    yes (ver 2.27.0)
    Use TinyEXR (built-in):      yes (ver 1.0.2)

  Real robots:
    Use Afma6:                   no
    Use Franka:                  no
    Use Viper650:                no
    Use Viper850:                no
    Use ur_rtde:                 no
    Use Kinova Jaco:             no
    Use aria (Pioneer):          no
    Use PTU46:                   no
    Use Biclops PTU:             no
    Use Flir PTU SDK:            no
    Use MAVSDK:                  no
    Use Parrot ARSDK:            no
    \-Use ffmpeg:                no
    Use Virtuose:                no
    Use qbdevice (built-in):     yes (ver 2.6.0)
    Use takktile2 (built-in):    no

  GUI:
    Use X11:                     no
    Use GTK:                     no
    Use OpenCV:                  yes (ver 4.8.0)
    Use GDI:                     yes
    Use Direct3D:                no

  Cameras:
    Use DC1394-2.x:              no
    Use CMU 1394:                no
    Use V4L2:                    no
    Use directshow:              no
    Use OpenCV:                  yes (ver 4.8.0)
    Use FLIR Flycapture:         no
    Use Basler Pylon:            no
    Use IDS uEye:                no

  RGB-D sensors:
    Use Realsense:               no
    Use Realsense2:              no
    Use Occipital Structure:     no
    Use Kinect:                  no
    \- Use libfreenect:          no
    \- Use libusb-1:             no
    \- Use pthread:              no
    Use PCL:                     no
    \- Use VTK:                  no

  F/T sensors:
    Use atidaq (built-in):       no
    Use comedi:                  no
    Use IIT SDK:                 no

  Mocap:
    Use Qualisys:                no
    Use Vicon:                   no

  Detection:
    Use zbar:                    no
    Use dmtx:                    no
    Use AprilTag (built-in):     yes (ver 3.1.1)
    \- Use AprilTag big family:  no

  Misc:
    Use Clipper (built-in):      yes (ver 6.4.2)
    Use pugixml (built-in):      yes (ver 1.9.0)
    Use libxml2:                 no
    Use json (nlohmann):         yes (ver 3.11.2)

  Optimization:
    Use OpenMP:                  yes
    Use pthread:                 no
    Use pthread (built-in):      yes (ver 3.0.1)
    Use Simd (built-in):         yes (ver 4.9.109)

  DNN:
    Use CUDA Toolkit:            no
    Use TensorRT:                no

  Documentation:
    Use doxygen:                 yes
    \- Use mathjax:              no

  Tests and samples:
    Use catch2 (built-in):       yes (ver 2.13.7)
    Tests:                       yes
    Demos:                       yes
    Examples:                    yes
    Tutorials:                   yes
    Dataset found:               yes (ver 3.6.0 in C:\visp-ws\visp-images)

  Library dirs:
    Eigen3 include dir:          C:/visp-ws/3rdparty/eigen-3.4.0/build-vc17/install/share/eigen3/cmake
    OpenCV dir:                  C:/visp-ws/3rdparty/opencv-4.8.0/build

  Install path:                  C:/visp-ws/visp-build-mingw/install

==========================================================
\endverbatim

\section issue_win10_mingw 7. Known issues

\subsection issue_win10_mingw_opencv_obsensor 7.1. OpenCV 4.7.0 and 4.8.0 compilation problem in obsensor_stream_channel_msmf.cpp

This issue occurs with OpenCV 4.7.0 and OpenCV 4.8.0.

\verbatim
In file included from C:\visp-ws\3rdparty\opencv-4.7.0\sources\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:41,
                 from C:\visp-ws\3rdparty\opencv-4.7.0\sources\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.cpp:25:
C:\visp-ws\3rdparty\opencv-4.7.0\sources\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp: In instantiation of 'class cv::obsensor::ComPtr<IMFAttributes>':
C:\visp-ws\3rdparty\opencv-4.7.0\sources\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:145:42:   required from here
C:\visp-ws\3rdparty\opencv-4.7.0\sources\modules\videoio\src\cap_obsensor\obsensor_stream_channel_msmf.hpp:106:27: error: could not convert template argument 'cv::obsensor::ComPtr<IMFAttributes>::__T_IID_getter' from 'const IID& (cv::obsensor::ComPtr<IMFAttributes>:()' {aka 'const GUID& (cv::obsensor::ComPtr<IMFAttributes>:()'} to 'const IID& ()' {aka 'const GUID& ()'}
  106 |     _COM_SMARTPTR_TYPEDEF(T, __uuidof(T));
\endverbatim

The workaround is to configure OpenCV using `cmake -DWITH_OBSENSOR=OFF` like:
\verbatim
C:\> cd %VISP_WS%\opencv-4.7.0\build-mingw
C:\> cmake -G "MinGW Makefiles" ..\sources -DCMAKE_INSTALL_PREFIX=%VISP_WS%\3rdparty\opencv-4.7.0\build -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DWITH_OBSENSOR=OFF
C:\> cmake --build . --config Release --target install -j4
\endverbatim

\note Previous instructions need to be adapted to your OpenCV version.

\subsection issue_win10_mingw_opencv_allocator 7.2. OpenCV 4.5.0 compilation problem gcc: error: long: No such file or directory

This issue occurs with OpenCV 4.5.0 and is referenced
[here](https://answers.opencv.org/question/228737/gcc-error-long-no-such-file-or-directory/).

\verbatim
C:\>cmake --build . --config Release --target install
...
[ 44%] Building RC object modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj
gcc: error: long: No such file or directory
C:\PROGRA~1\MINGW-~1\X86_64~1.0-P\mingw64\bin\windres.exe: preprocessing failed.
mingw32-make.exe[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:1494: modules/core/CMakeFiles/opencv_core.dir/vs_version.rc.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:1770: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
mingw32-make.exe: *** [Makefile:181: all] Error 2
\endverbatim

The workaround is to configure OpenCV using `cmake -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF` like:
\verbatim
C:\> cd %VISP_WS%\opencv-4.5.0\build-mingw
C:\> cmake -G "MinGW Makefiles" ..\sources -DCMAKE_INSTALL_PREFIX=%VISP_WS%\opencv-4.5.0\build \
     -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DWITH_OPENCL_D3D11_NV=OFF -DOPENCV_ENABLE_ALLOCATOR_STATS=OFF
C:\> cmake --build . --config Release --target install -j4
\endverbatim

\subsection issue_win10_mingw_opencv_opencl_d3d11 7.3. OpenCL D3D11 build failure

This issue occurs with OpenCV 4.1.1 and is referenced [here](https://github.com/opencv/opencv/issues/14286).

If you encounter the following issue during OpenCV build:
\image html img-mingw-issue-opencv-d3d11.png
you have to disable OpenCL D3D11 support and restart a new build:
\verbatim
C:\> cd %VISP_WS%\opencv-4.1.1\build-mingw
C:\> cmake -G "MinGW Makefiles" ..\sources -DCMAKE_INSTALL_PREFIX=%VISP_WS%\opencv-4.1.1\build \
    -DWITH_OPENCL_D3D11_NV=OFF
C:\> cmake --build . --config Release --target install
\endverbatim

\subsection issue_win10_mingw_opencv_endianness 7.4. OpenCV endianness failure during CMake configuration

\note This issue occurs with OpenCV 2.4.10, 2.3.0-beta and 2.3.0 releases.

If you encounter the following issue during CMake configuration
\image html img-opencv-issue-test-big-endian.jpg

Edit `%%VISP_WS%\opencv-2.y.z\sources\CMakeLists.txt` file, and line 464 replace:
\verbatim
test_big_endian(WORDS_BIGENDIAN)
\endverbatim
by:
\verbatim
#test_big_endian(WORDS_BIGENDIAN)
set(WORDS_BIGENDIAN 0)
\endverbatim

\subsection issue_win10_mingw_opencv_tiff 7.5. OpenCV build error: cannot build with tiff support

\note This issue occurs with OpenCV 2.4.10, 2.3.0-beta and 2.3.0 releases.

If you encounter a build issue during libtiff build as given in the next image:
\image html img-opencv-issue-tiff.jpg

- Open CMake GUI on OpenCV, turn BUILD_TIFF=OFF and also WITH_TIFF=OFF
- Click on "Configure" button, and then on "Generate" one.
- Build again OpenCV using
\verbatim
cd %VISP_WS%\opencv-2.y.z\sources\build-mingw
C:\> mingw32-make
\endverbatim

\subsection issue_win10_mingw_opencv_ipp 7.6. OpenCV link error: cannot find -lRunTmChk

\note This issue occurs with OpenCV 2.3.0-beta and 2.3.0 releases.

The following image shows the link issue that may appear when building OpenCV with MinGW:
\image html img-opencv-issue-ipp.jpg

A work around is to configure OpenCV without ipp support turning WITH_IPP=OFF and then trying to build again.

\subsection issue_win10_mingw_opencv_dtor 7.7. OpenCV build error: struct has virtual functions and accessible non-virtual destructor

This error that occurs with OpenCV 3.0.0 during `cap_dshow.cpp` build is known and reported as an issue
in https://github.com/Itseez/opencv/pull/5282/commits.
\image html img-win8.1-mingw-opencv-issue-dtor.jpg

- The fix consists in modifying `modules/videoio/src/cap_dshow.cpp` by adding near line 96:
\verbatim
#ifdef __MINGW32__
// MinGW does not understand COM interfaces
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#endif
\endverbatim

\subsection issue_win10_mingw_opencv_not_detected 7.8. OpenCV not detected with Mingw build

\note This issue occurs with OpenCV 2.4.9, 2.4.10 and 2.3.0-beta.

- To fix this issue, edit `%%VISP_WS%\opencv-2.y.z\sources\cmake\OpenCVConfig.cmake`, and line 89 replace:
\verbatim
  if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")
\endverbatim
by:
\verbatim
  if(OPENCV_GCC_TARGET_MACHINE MATCHES "64")
\endverbatim

- Then open a new `cmd` Command Prompt to build and install OpenCV again:
\verbatim
C:\> cd %VISP_WS%\opencv-2.y.z\sources\build-mingw
C:\> mingw32-make install
\endverbatim

\subsection issue_win10_mingw_opencv_precompiled_headers 7.9. windres.exe invalid option --W

\note This issue occurs with OpenCV 3.3.0.

When running `mingw32-make` if you get the following issue:
\image html img-win10-mingw-opencv-issue-precompiled-headers.png

the workaround consists in:
- opening cmake-gui and turning `ENABLE_PRECOMPILED_HEADERS` cmake var OFF:
\image html img-cmake-win10-mingw-opencv-issue-precompiled-headers.png
- in cmake-gui press "Configure" button, then press "Generate" button
- then in the `cmd` Command Prompt run again `mingw32-make`

\subsection issue_win10_mingw_opencv_cap_dshow 7.10. Build error in cap_dshow.cpp

\note This issue occurs with OpenCV 3.3.0.

When running `mingw32-make` if you get the following issue:
\image html img-win10-mingw-opencv-issue-cap-dshow.png

the workaround consists in:
- editing `%%VISP_WS%/opencv-3.3.0/sources/modules/videoio/src/cap_dshow.cpp` adding
\code
#define NO_DSHOW_STRSAFE
\endcode
before the line
\code
#include "DShow.h"
\endcode
- then in the `cmd` Command Prompt run again `mingw32-make`

\section install_win10_mingw_next 8. Next tutorial

You are now ready to see the next \ref tutorial-getting-started that will show you how to use ViSP as a
3rd party to build your own project.

*/