-
Notifications
You must be signed in to change notification settings - Fork 0
/
CompilingOTBFromSource.html
701 lines (577 loc) · 35.5 KB
/
CompilingOTBFromSource.html
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
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Compiling OTB from source — Orfeo ToolBox 6.7.0 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/otb_theme.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Frequently Asked Questions" href="FAQ.html" />
<link rel="prev" title="Extended filenames" href="ExtendedFilenames.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html">
<img src="_static/logo-with-text.png" class="logo" alt="Logo"/>
</a>
<div class="version">
6.7.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Get Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="Installation.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="Monteverdi.html">Monteverdi</a></li>
</ul>
<p class="caption"><span class="caption-text">Applications</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="CliInterface.html">Command-line interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="GraphicalInterface.html">Graphical interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="PythonAPI.html">Python API</a></li>
<li class="toctree-l1"><a class="reference internal" href="QGISInterface.html">QGIS interface</a></li>
<li class="toctree-l1"><a class="reference internal" href="Applications.html">All Applications</a></li>
</ul>
<p class="caption"><span class="caption-text">Recipes</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="recipes/optpreproc.html">From raw image to calibrated product</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/sarprocessing.html">SAR processing</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/residual_registration.html">Residual registration</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/improc.html">Image processing</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/contrast_enhancement.html">Enhance local contrast</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/pbclassif.html">Classification</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/featextract.html">Feature extraction</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/stereo.html">Stereoscopic reconstruction</a></li>
<li class="toctree-l1"><a class="reference internal" href="recipes/hyperspectral.html">Hyperspectral image processing</a></li>
</ul>
<p class="caption"><span class="caption-text">C++ API</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="C++/SystemOverview.html">System Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="C++/Tutorial.html">Building simple OTB code</a></li>
<li class="toctree-l1"><a class="reference internal" href="C++/UserGuide.html">User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="C++/AboutBandMathX.html">About BandMathX</a></li>
<li class="toctree-l1"><a class="reference internal" href="C++/Examples.html">C++ Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="C++/DeveloperGuide.html">Developer Guide</a></li>
</ul>
<p class="caption"><span class="caption-text">Advanced use</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="EnvironmentVariables.html">Environment variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="ExtendedFilenames.html">Extended filenames</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Compiling OTB from source</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#gnu-linux-and-macos">GNU/Linux and macOS</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#setting-up-the-build-environment">Setting up the build environment</a></li>
<li class="toctree-l3"><a class="reference internal" href="#superbuild-build-otb-and-all-dependencies">SuperBuild: Build OTB and all dependencies</a></li>
<li class="toctree-l3"><a class="reference internal" href="#normal-build-build-only-otb">Normal build: Build only OTB</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#windows">Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="#known-issues">Known issues</a></li>
<li class="toctree-l2"><a class="reference internal" href="#tests">Tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#compiling-documentation">Compiling documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="FAQ.html">Frequently Asked Questions</a></li>
<li class="toctree-l1"><a class="reference internal" href="Contributors.html">Contributors</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Orfeo ToolBox</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li>Compiling OTB from source</li>
<li class="wy-breadcrumbs-aside">
<a href="https://gitlab.orfeo-toolbox.org/orfeotoolbox/OTB/blob/develop/Documentation/Cookbook/rst/CompilingOTBFromSource.rst" class="fa fa-gitlab"> Edit on GitLab</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="compiling-otb-from-source">
<span id="compilingfromsource"></span><h1>Compiling OTB from source<a class="headerlink" href="#compiling-otb-from-source" title="Permalink to this headline">¶</a></h1>
<p>This section covers the compilation of OTB from source code using <a class="reference external" href="http://www.cmake.org">CMake</a>. If you just need to install OTB and Monteverdi, follow
instructions from the <a class="reference internal" href="Installation.html"><span class="doc">Installation</span></a> section.</p>
<p>OTB is known to work on:</p>
<ul class="simple">
<li>Visual Studio 2015 on Windows</li>
<li>GCC 4.x, 5.x or Clang 3.x on GNU/Linux</li>
<li>AppleClang on macOS (10.8 or higher)</li>
</ul>
<p>The C++14 standard is required since version 6.2.0.</p>
<p>OTB depends on a number of external libraries. Some are mandatory,
meaning that OTB cannot be compiled without them, while others (the
majority) are optional and can be activated or not during the build
process:</p>
<table border="1" class="colwidths-given docutils align-center" id="id1">
<caption><span class="caption-text">External libraries used in OTB</span><a class="headerlink" href="#id1" title="Permalink to this table">¶</a></caption>
<colgroup>
<col width="50%" />
<col width="20%" />
<col width="30%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><strong>Library</strong></th>
<th class="head"><strong>Mandatory</strong></th>
<th class="head"><strong>Minimum version</strong></th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference external" href="http://www.itk.org">ITK</a></td>
<td>Yes</td>
<td>4.6.0</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://www.gdal.org">GDAL</a></td>
<td>Yes</td>
<td>2.0</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.ossim.org">OSSIM</a></td>
<td>Yes</td>
<td>1.8.20-3</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://trac.osgeo.org/geotiff/">libgeotiff</a></td>
<td>Yes</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.boost.org">boost</a></td>
<td>Yes</td>
<td> </td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://www.openscenegraph.org">openthreads</a></td>
<td>Yes</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.grinninglizard.com/tinyxml">tinyXML</a></td>
<td>Yes</td>
<td> </td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://6s.ltdri.org">6S</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.curl.haxx.se">Curl</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://www.fftw.org">FFTW</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://glew.sourceforge.net/">GLEW</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://www.glfw.org/">GLFW</a></td>
<td>No</td>
<td>3</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="https://www.opengl.org/resources/libraries/glut/">GLUT</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="https://github.com/google/libkml">libKML</a></td>
<td>No</td>
<td>1.2</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.csie.ntu.edu.tw/~cjlin/libsvm">libSVM</a></td>
<td>No</td>
<td>2.0</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="https://www.open-mpi.org/">MPI</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.muparser.sourceforge.net">MuParser</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://muparserx.beltoforion.de">MuParserX</a></td>
<td>No</td>
<td>4.0.7</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://opencv.org">OpenCV</a></td>
<td>No</td>
<td>2 (3.x also supported)</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="https://www.opengl.org/">OPENGL</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="https://www.qt.io/developers/">Qt</a></td>
<td>No</td>
<td>5</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://qwt.sourceforge.net">QWT</a></td>
<td>No</td>
<td>6</td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://image.diku.dk/shark/">Shark</a></td>
<td>No</td>
<td>3.1</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://libsift.sourceforge.net">SiftFast</a></td>
<td>No</td>
<td> </td>
</tr>
<tr class="row-even"><td><a class="reference external" href="https://github.com/remicres/sptw.git">SPTW</a></td>
<td>No</td>
<td> </td>
</tr>
</tbody>
</table>
<div class="section" id="gnu-linux-and-macos">
<h2>GNU/Linux and macOS<a class="headerlink" href="#gnu-linux-and-macos" title="Permalink to this headline">¶</a></h2>
<div class="section" id="setting-up-the-build-environment">
<h3>Setting up the build environment<a class="headerlink" href="#setting-up-the-build-environment" title="Permalink to this headline">¶</a></h3>
<p>The first thing to do is to create a directory for working with OTB.
This guide will use <code class="docutils literal notranslate"><span class="pre">~/OTB</span></code> but you are free to choose something
else. In this directory, there will be three locations:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">~/OTB/otb</span></code> for the source git repository</li>
<li><code class="docutils literal notranslate"><span class="pre">~/OTB/build</span></code> for the intermediate build objects, CMake specific
files, libraries and binaries.</li>
<li><code class="docutils literal notranslate"><span class="pre">~/OTB/install</span></code>, the installation directory for OTB once it is
built. A system location (<code class="docutils literal notranslate"><span class="pre">/usr/local</span></code> for example) can also be
used, but installing locally is more flexible and does not require
root access.</li>
</ul>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ mkdir ~/OTB
$ cd ~/OTB
$ git clone https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb.git
$ mkdir build
$ mkdir install
</pre></div>
</div>
<p>The OTB project uses a git branching model where <code class="docutils literal notranslate"><span class="pre">develop</span></code> is the current
development version. It contains the latest patches and represents the work in
progress towards the next release. <code class="docutils literal notranslate"><span class="pre">master</span></code> is the latest stable release.</p>
<p>Checkout the branch you want to build now:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cd ~/OTB/otb
$ git checkout develop
</pre></div>
</div>
<p>Now, there are two ways of compiling OTB from source, depending on how you want
to manage dependencies. Both methods rely on CMake.</p>
<ul class="simple">
<li><strong>SuperBuild</strong>: All OTB dependencies are automatically downloaded and
compiled. This method is the easiest to use and provides a complete OTB with
minimal effort.</li>
<li><strong>Normal build</strong>: OTB dependencies must already be compiled and available on
your system. This method requires more work but provides more flexibility.</li>
</ul>
<p>If you do not know which method to use and just want to compile OTB with
all its modules, use the SuperBuild.</p>
<p>Important CMake configuration variables:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">CMAKE_INSTALL_PREFIX</span></code>: Installation directory, target for <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code></li>
<li><code class="docutils literal notranslate"><span class="pre">BUILD_EXAMPLES</span></code>: Activate compilation of OTB examples</li>
<li><code class="docutils literal notranslate"><span class="pre">BUILD_TESTING</span></code>: Activate compilation of the tests</li>
<li><code class="docutils literal notranslate"><span class="pre">OTB_BUILD_DEFAULT_MODULES</span></code>: Activate all usual modules, required to build the examples</li>
<li><code class="docutils literal notranslate"><span class="pre">OTB_USE_XXX</span></code>: Activate module <em>XXX</em></li>
<li><code class="docutils literal notranslate"><span class="pre">OTBGroup_XXX</span></code>: Enable modules in the group <em>XXX</em></li>
<li><code class="docutils literal notranslate"><span class="pre">OTB_DATA_ROOT</span></code>: otb-data repository</li>
<li><code class="docutils literal notranslate"><span class="pre">OTB_WRAP_PYTHON</span></code>: Enable Python wrapper</li>
</ul>
<p>SuperBuild only:</p>
<ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">DOWNLOAD_LOCATION</span></code>: Location to download dependencies</li>
<li><code class="docutils literal notranslate"><span class="pre">USE_SYSTEM_XXX</span></code>: Use the system’s <em>XXX</em> library</li>
</ul>
</div>
<div class="section" id="superbuild-build-otb-and-all-dependencies">
<h3>SuperBuild: Build OTB and all dependencies<a class="headerlink" href="#superbuild-build-otb-and-all-dependencies" title="Permalink to this headline">¶</a></h3>
<p>OTB’s compilation is customized by specifying configuration variables.
The most important configuration variables are shown in the
table above. The simplest way to provide
configuration variables is via the command line <code class="docutils literal notranslate"><span class="pre">-D</span></code> option:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cd ~/OTB/build
$ cmake -D CMAKE_INSTALL_PREFIX=~/OTB/install ../otb/SuperBuild
</pre></div>
</div>
<p>You can also set variables manually with <code class="docutils literal notranslate"><span class="pre">cmake-gui</span></code> or <code class="docutils literal notranslate"><span class="pre">ccmake</span></code>.</p>
<p>Please note that the <code class="docutils literal notranslate"><span class="pre">CMAKE_INSTALL_PREFIX</span></code> variable is important
because the SuperBuild will install some targets during the compilation
step. Therefore this directory will be used even if you don’t use make
install target. In fact there is no <em>make install</em> target for the
SuperBuild. Also note that if not specified to cmake, a default install
dir will be used, located in <code class="docutils literal notranslate"><span class="pre">../superbuild_install</span></code>.</p>
<p>By default, SuperBuild will not use any of libraries installed on
system. All <code class="docutils literal notranslate"><span class="pre">USE_SYSTEM_XXX</span></code> are set to <cite>OFF</cite>. This is our recommended
way of using SuperBuild. You are however free to use a system library if
you want! You must be very much aware of dependencies of those
libraries you use from system. For example, if libjpeg is not used from
superbuild then you should not use zlib from superbuild because zlib is
a dependency of libjpeg. Here SuperBuild will NOT set
<code class="docutils literal notranslate"><span class="pre">USE_SYSTEM_ZLIB=FALSE</span></code>. One must re-run cmake with
<code class="docutils literal notranslate"><span class="pre">-DUSE_SYSTEM_ZLIB=FALSE</span></code>. Above example of libjpeg-zlib dependency is
so simple. Imagine the case for GDAL which depends on zlib, libjpeg,
libtiff (with big tiff support), geotiff, sqlite, curl, geos, libkml,
openjpeg. This is one of the reasons we recommend to use SuperBuild
exclusively.</p>
<p>All dependencies are configured and built in a way that help us to get
an efficient OTB build. So we enable geotiff (with proj4 support),
openjpeg, geos in GDAL build.</p>
<p>SuperBuild downloads dependencies into the <code class="docutils literal notranslate"><span class="pre">DOWNLOAD_LOCATION</span></code> directory,
which will be <code class="docutils literal notranslate"><span class="pre">~/OTB/build/Downloads</span></code> in our example. Dependencies can be
downloaded manually into this directory before the compilation step. This can be
useful if you wish to bypass a proxy, intend to compile OTB without an internet
connection, or other network constraints. You can find an archive with sources
of all our dependencies on <a class="reference external" href="https://www.orfeo-toolbox.org/packages">the Orfeo ToolBox website</a> (pick the ’SuperBuild-archives’
corresponding to the OTB version you want to build).</p>
<p><strong>Notes about Qt:</strong> Unlike other dependencies, building Qt5 on all platforms is
not a trivial task but OTB SuperBuild does its best to facilitate this for the
user. So there is still some additional package installation, one has to do as a
pre-requistie for SuperBuild On a GNU/Linux you must have Qt X11 dependencies
installed. See <a class="reference external" href="https://doc.qt.io/qt-5/linux-requirements.html">Qt 5 documentation</a> for the list of packages that
need to be installed before starting SuperBuild.</p>
<p>For example for a Debian 8.1 system, all Qt5 dependencies can be installed with the
following ’apt-get install’ command:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">libx11</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxext</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxt</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxi</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxrandr</span><span class="o">-</span><span class="n">dev</span> <span class="n">libgl</span><span class="o">-</span><span class="n">dev</span> <span class="n">libglu</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxinerama</span><span class="o">-</span><span class="n">dev</span> <span class="n">libxcursor</span><span class="o">-</span><span class="n">dev</span>
</pre></div>
</div>
<p>You can also deactivate Qt5 and skip this by passing
<code class="docutils literal notranslate"><span class="pre">-DOTB_USE_QT=OFF</span></code> to CMake, but this will install OTB without
Monteverdi, Mapla and the GUI application launchers.</p>
<p>You are now ready to compile OTB! Simply use the make command (other
targets can be generated with CMake’s <code class="docutils literal notranslate"><span class="pre">-G</span></code> option):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cd ~/OTB/build
$ make
</pre></div>
</div>
<p>Applications will be located in the <code class="docutils literal notranslate"><span class="pre">CMAKE_INSTALL_PREFIX/bin/</span></code> directory:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">~/</span><span class="n">OTB</span><span class="o">/</span><span class="n">install</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">otbcli_ExtractROI</span>
</pre></div>
</div>
<p>will launch the command line version of the <strong>ExtractROI</strong> application,
while:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">~/</span><span class="n">OTB</span><span class="o">/</span><span class="n">install</span><span class="o">/</span><span class="nb">bin</span><span class="o">/</span><span class="n">otbgui_ExtractROI</span>
</pre></div>
</div>
<p>will launch the graphical version.</p>
<p>In order to ensure access to your OTB build from anywhere within your
system, we recommend setting the following environment variables.
First, add <code class="docutils literal notranslate"><span class="pre">bin/</span></code> directory to your PATH for easy access:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>export PATH=$PATH:~/OTB/install/bin
</pre></div>
</div>
<p>Second, add the <code class="docutils literal notranslate"><span class="pre">lib/</span></code> directory to your <code class="docutils literal notranslate"><span class="pre">LD_LIBRARY_PATH</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>export LD_LIBRARY_PATH=~/OTB/install/lib:$LD_LIBRARY_PATH
</pre></div>
</div>
<p>Monteverdi is part of OTB module and is compiled by the SuperBuild if GLEW, GLUT, OPENGL, Qt and QWT
modules are activated.</p>
<p>To use OTB applications from within Monteverdi you will need to define
the <code class="docutils literal notranslate"><span class="pre">OTB_APPLICATION_PATH</span></code> environment variable:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">export</span> <span class="n">OTB_APPLICATION_PATH</span><span class="o">=~/</span><span class="n">OTB</span><span class="o">/</span><span class="n">install</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">otb</span><span class="o">/</span><span class="n">applications</span>
<span class="n">monteverdi</span>
</pre></div>
</div>
</div>
<div class="section" id="normal-build-build-only-otb">
<h3>Normal build: Build only OTB<a class="headerlink" href="#normal-build-build-only-otb" title="Permalink to this headline">¶</a></h3>
<p>Once all OTB dependencies are availables on your system, use CMake to
generate a Makefile:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cd ~/OTB/build
$ cmake -C configuration.cmake ../otb
</pre></div>
</div>
<p>The script <code class="docutils literal notranslate"><span class="pre">configuration.cmake</span></code> needs to contain dependencies
location if CMake cannot find them automatically. This can be done with
the <code class="docutils literal notranslate"><span class="pre">XXX_DIR</span></code> variables containing the directories which contain the
FindXXX.cmake scripts, or with the <code class="docutils literal notranslate"><span class="pre">XXX_INCLUDEDIR</span></code> and
<code class="docutils literal notranslate"><span class="pre">XXX_LIBRARY</span></code> variables.</p>
<p>Additionally, decide which module you wish to enable, together with tests and
examples. Refer to table above for the list of CMake variables.</p>
<p>OTB is modular. It is possible to only build some modules
instead of the whole set. To deactivate a module (and the ones that
depend on it) switch off the CMake variable
<code class="docutils literal notranslate"><span class="pre">OTB_BUILD_DEFAULT_MODULES</span></code>, configure, and then switch off each
<code class="docutils literal notranslate"><span class="pre">Module_module_name</span></code> variable.</p>
<p>Some of the OTB capabilities are considered as optional, and you can
deactivate the related modules thanks to a set of CMake variables
starting with <code class="docutils literal notranslate"><span class="pre">OTB_USE_XXX</span></code>. The table below shows which modules
are associated to these variables. It is very important to notice that
these variable override the variable <code class="docutils literal notranslate"><span class="pre">OTB_BUILD_DEFAULT_MODULES</span></code>.</p>
<p>You are now ready to compile OTB! Simply use the make command (other
targets can be generated with CMake’s <code class="docutils literal notranslate"><span class="pre">-G</span></code> option):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make
</pre></div>
</div>
<p>The installation target will copy the binaries and libraries to the
installation location:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ make install
</pre></div>
</div>
<table border="1" class="docutils">
<colgroup>
<col width="12%" />
<col width="11%" />
<col width="77%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head"><strong>CMake variable</strong></th>
<th class="head"><strong>3rd party module</strong></th>
<th class="head"><strong>Modules depending on it</strong></th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><strong>OTB_USE_LIBKML</strong></td>
<td>OTBlibkml</td>
<td>OTBKMZWriter OTBIOKML OTBAppKMZ</td>
</tr>
<tr class="row-odd"><td><strong>OTB_USE_QT</strong></td>
<td>OTBQt</td>
<td>OTBQtWidget</td>
</tr>
<tr class="row-even"><td><strong>OTB_USE_QWT</strong></td>
<td>OTBQwt</td>
<td>OTBMonteverdiGUI OTBMonteverdi</td>
</tr>
<tr class="row-odd"><td><strong>OTB_USE_GLEW</strong></td>
<td>OTBGlew</td>
<td>OTBIce OTBMonteverdiGUI OTBMonteverdi</td>
</tr>
<tr class="row-even"><td><strong>OTB_USE_OPENGL</strong></td>
<td>OTBOpenGL</td>
<td>OTBIce OTBMonteverdiGUI OTBMonteverdi</td>
</tr>
<tr class="row-odd"><td><strong>OTB_USE_CURL</strong></td>
<td>OTBCurl</td>
<td> </td>
</tr>
<tr class="row-even"><td><strong>OTB_USE_MUPARSER</strong></td>
<td>OTBMuParser</td>
<td>OTBMathParser OTBDempsterShafer OTBAppClassification OTBAppMathParser OTBAppStereo OTBAppProjection OTBAppSegmentation OTBRoadExtraction OTBRCC8 OTBCCOBIA OTBMeanShift</td>
</tr>
<tr class="row-odd"><td><strong>OTB_USE_MUPARSERX</strong></td>
<td>OTBMuParserX</td>
<td>OTBMathParserX OTBAppMathParserX</td>
</tr>
<tr class="row-even"><td><strong>OTB_USE_LIBSVM</strong></td>
<td>OTBLibSVM</td>
<td>optional for OTBSupervised OTBAppClassification</td>
</tr>
<tr class="row-odd"><td><strong>OTB_USE_OPENCV</strong></td>
<td>OTBOpenCV</td>
<td>optional for OTBSupervised OTBAppClassification</td>
</tr>
<tr class="row-even"><td><strong>OTB_USE_SHARK</strong></td>
<td>OTBShark</td>
<td>optional for OTBSupervised OTBAppClassification</td>
</tr>
<tr class="row-odd"><td><strong>OTB_USE_6S</strong></td>
<td>OTB6S</td>
<td>OTBOpticalCalibration OTBAppOpticalCalibration OTBSimulation</td>
</tr>
<tr class="row-even"><td><strong>OTB_USE_SIFTFAST</strong></td>
<td>OTBSiftFast</td>
<td> </td>
</tr>
</tbody>
</table>
<p>Table: Third parties and related modules.</p>
</div>
</div>
<div class="section" id="windows">
<h2>Windows<a class="headerlink" href="#windows" title="Permalink to this headline">¶</a></h2>
<p>Everything that is needed for OTB development on Windows, including
compiling from source, is covered in details on the OTB wiki at:</p>
<p><a class="reference external" href="http://wiki.orfeo-toolbox.org/index.php/OTB_development_on_Windows">http://wiki.orfeo-toolbox.org/index.php/OTB_development_on_Windows</a></p>
</div>
<div class="section" id="known-issues">
<h2>Known issues<a class="headerlink" href="#known-issues" title="Permalink to this headline">¶</a></h2>
<p>Please check <a class="reference external" href="https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/issues?label_name%5B%5D=bug">our gitlab tracker</a> for a list of open bugs.</p>
</div>
<div class="section" id="tests">
<h2>Tests<a class="headerlink" href="#tests" title="Permalink to this headline">¶</a></h2>
<p>There are more than 2500 tests for OTB. It can take from 20 minutes to 3
hours to run them all, depending on compilation options
(release mode does make a difference) and hardware.</p>
<p>To run the tests, first make sure to set the option
<code class="docutils literal notranslate"><span class="pre">BUILD_TESTING</span></code> to <code class="docutils literal notranslate"><span class="pre">ON</span></code> before building the library.</p>
<p>For some of the tests, you also need the test data and the baselines (~1GB):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">gitlab</span><span class="o">.</span><span class="n">orfeo</span><span class="o">-</span><span class="n">toolbox</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">orfeotoolbox</span><span class="o">/</span><span class="n">otb</span><span class="o">-</span><span class="n">data</span><span class="o">.</span><span class="n">git</span>
</pre></div>
</div>
<p>Once OTB is built with the tests, you just have to go to the binary
directory where you built OTB and run <code class="docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">-N</span></code> to have a list of all
the tests. Just using <code class="docutils literal notranslate"><span class="pre">ctest</span></code> will run all the tests. To select a
subset, you can do <code class="docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">-R</span> <span class="pre">Kml</span></code> to run all tests related to kml
files or <code class="docutils literal notranslate"><span class="pre">ctest</span> <span class="pre">-I</span> <span class="pre">1,10</span></code> to run tests from 1 to 10.</p>
</div>
<div class="section" id="compiling-documentation">
<h2>Compiling documentation<a class="headerlink" href="#compiling-documentation" title="Permalink to this headline">¶</a></h2>
<p>To build the CookBook documentation, the following python packages are required:
<code class="docutils literal notranslate"><span class="pre">numpy,</span> <span class="pre">sphinx,</span> <span class="pre">sphinx_rtd_theme</span></code>. They are available on pip:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">numpy</span> <span class="n">sphinx</span> <span class="n">sphinx_rtd_theme</span>
</pre></div>
</div>
<p>A working installation of <code class="docutils literal notranslate"><span class="pre">latex</span></code> is
required for building the PDF version.</p>
<p>Enable Python bindings and set <code class="docutils literal notranslate"><span class="pre">BUILD_COOKBOOK</span></code>:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="o">-</span><span class="n">DOTB_WRAP_PYTHON</span><span class="o">=</span><span class="n">ON</span> <span class="o">-</span><span class="n">DBUILD_COOKBOOK</span><span class="o">=</span><span class="n">ON</span> <span class="o">.</span>
</pre></div>
</div>
<p>Then, build the target:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">CookbookHTML</span>
</pre></div>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">CookBookPDF</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="FAQ.html" class="btn btn-neutral float-right" title="Frequently Asked Questions" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="ExtendedFilenames.html" class="btn btn-neutral" title="Extended filenames" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2019 CNES. The OTB CookBook is licensed under a Creative Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA).
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/versions.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>