-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuilding_windows.html
284 lines (278 loc) · 17.9 KB
/
building_windows.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Building » Building the DIPlib project on Windows | DIPlib | a library for quantitative image analysis</title>
<link rel="stylesheet" href="m-dip+documentation.compiled.css" />
<link rel="icon" href="DIPlib_logo_32.png" type="image/png" />
<link rel="search" type="application/opensearchdescription+xml" href="opensearch.xml" title="Search DIPlib documentation" />
<link rel="prev" href="building_macos.html" />
<link rel="next" href="building_documentation.html" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#ffffff" />
</head>
<body>
<header><nav id="navigation">
<div class="m-container">
<div class="m-row">
<span id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">
<a href="https://diplib.org"><img src="DIPlib_logo.svg" alt="" />DIPlib</a><span class="m-breadcrumb">┃</span><a href="index.html" class="m-thin">a library for quantitative image analysis</a><span class="m-breadcrumb">┃</span><a href="https://github.com/DIPlib/diplib/releases/tag/3.5.2" class="m-thin">version 3.5.2</a> </span>
<div class="m-col-t-4 m-hide-m m-text-right m-nopadr">
<a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<path id="m-doc-search-icon-path" d="m6 0c-3.31 0-6 2.69-6 6 0 3.31 2.69 6 6 6 1.49 0 2.85-0.541 3.89-1.44-0.0164 0.338 0.147 0.759 0.5 1.15l3.22 3.79c0.552 0.614 1.45 0.665 2 0.115 0.55-0.55 0.499-1.45-0.115-2l-3.79-3.22c-0.392-0.353-0.812-0.515-1.15-0.5 0.895-1.05 1.44-2.41 1.44-3.89 0-3.31-2.69-6-6-6zm0 1.56a4.44 4.44 0 0 1 4.44 4.44 4.44 4.44 0 0 1-4.44 4.44 4.44 4.44 0 0 1-4.44-4.44 4.44 4.44 0 0 1 4.44-4.44z"/>
</svg></a>
<a id="m-navbar-show" href="#navigation" title="Show navigation"></a>
<a id="m-navbar-hide" href="#" title="Hide navigation"></a>
</div>
<div id="m-navbar-collapse" class="m-col-t-12 m-show-m m-col-m-none m-right-m">
<div class="m-row">
<ol class="m-col-t-6 m-col-m-none">
<li><a href="pages.html">Pages</a></li>
<li><a href="modules.html">Modules</a></li>
</ol>
<ol class="m-col-t-6 m-col-m-none" start="3">
<li><a href="classes.html">Classes</a></li>
<li><a href="files.html">Files</a></li>
<li class="m-show-m"><a href="#search" class="m-doc-search-icon" title="Search" onclick="return showSearch()"><svg style="height: 0.9rem;" viewBox="0 0 16 16">
<use href="#m-doc-search-icon-path" />
</svg></a></li>
</ol>
</div>
</div>
</div>
</div>
</nav></header>
<main><article>
<div class="m-container m-container-inflatable">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<h1>
<span class="m-breadcrumb"><a href="building_diplib.html">Building</a> »</span>
Building the <em>DIPlib</em> project on Windows
</h1>
<div class="m-block m-default">
<h3>Contents</h3>
<ul>
<li><a href="#windows_msvc"><em>Visual Studio</em></a></li>
<li><a href="#windows_cmake"><em>CMake</em></a></li>
<li><a href="#windows_doxpp"><em>dox++</em></a></li>
<li><a href="#windows_git">Cloning the repository</a></li>
<li><a href="#windows_dependencies">Installing dependencies</a></li>
<li><a href="#windows_configure">Creating <em>Visual Studio</em> project files</a></li>
<li><a href="#windows_build">Building</a></li>
<li><a href="#windows_dipimage">Using <em>DIPimage</em></a></li>
<li><a href="#windows_pydip">Using <em>PyDIP</em></a></li>
</ul>
</div>
<p>Compiling <em>DIPlib</em> requires a few programs that do not come preinstalled on Windows.
We describe here how to obtain these programs, and how to use them to compile the
<em>DIPlib</em> project.</p>
<p>See <a href="building_cmake.html"><em>CMake</em> configuration</a> for additional information on the build targets and <em>CMake</em> configuration options.</p>
<h2 id="windows_msvc"><em>Visual Studio</em></h2>
<p>You can download the free <em>MS Visual Studio Community Edition</em>
<a href="https://www.visualstudio.com/vs/community/">from its website</a>.</p>
<p>We recommend that you use at least the 2019 edition. We were able to build with the
2015 and 2017 editions, but had to turn off some components that would not build because
they used some advanced C++14 constructs that will not compile with older versions of <em>MSVC</em>.</p>
<p>Download and install as directed. Select the “Desktop C++ applications” option.
Optionally, you can select to install <em>Python 3</em> as well. You can do this if you
don’t have <em>Python</em> but want to compile the <em>PyDIP</em> interface.</p>
<p>Make sure you select the <em>Git</em> option as well. If you don’t have <em>Git</em> installed,
and cannot install it through <em>Visual Studio</em>,
<a href="https://git-scm.com/downloads">download and install it from here</a>.</p>
<h2 id="windows_cmake"><em>CMake</em></h2>
<p>You can obtain the latest <em>CMake</em> <a href="https://cmake.org/download/">on its website</a>.</p>
<p>Again, download and install as directed.</p>
<h2 id="windows_doxpp"><em>dox++</em></h2>
<p>To compile the documentation yourself (which shouldn’t be necessary, but some IDEs
might require), you need <em>dox++</em>. See <a href="building_documentation.html">Building the <em>DIPlib</em> documentation</a> for details.</p>
<h2 id="windows_git">Cloning the repository</h2>
<p>Next, get the source repository from <em>GitHub</em>. Open the “Git GUI” program on your
start menu, and select “Clone existing repository”. The source location is</p>
<div class="m-code"><pre><span></span>https://github.com/DIPlib/diplib.git
</pre></div>
<p>Pick any directory on your system as destination. For example <code>src\DIPlib</code> in
your user directory. The standard clone type is OK to use. Click “Clone”.</p>
<h2 id="windows_dependencies">Installing dependencies</h2>
<p>Windows does not have a simple dependency installation system, so this step
involves a lot of manual labor. Fortunately, all these dependencies are optional,
so feel free to skip this section.</p>
<ul>
<li>
<p>Download <a href="http://www.glfw.org/download.html">the <em>GLFW</em> binaries</a>.
If you intend to build a 64-bit version of <em>DIPlib</em> (recommended!) get the 64-bit
version of <em>GLFW</em>. Extract the ZIP file and note the location.</p>
</li>
<li>
<p>Download <a href="https://www.openmicroscopy.org/bio-formats/downloads">the <em>Bio-Formats</em> library</a>.
Put it somewhere sensible and note the location. The same location (as well as the
library installation path) will be used to find it during execution.</p>
<p>If building only <em>DIPimage</em> (the <em>MATLAB</em> toolbox), you don’t need to download <em>Bio-Formats</em>
before building; instead follow the directions you can read when you do <code>help readim</code> in <em>MATLAB</em>
after installation.</p>
</li>
</ul>
<aside class="m-note m-info">
<h4>TODO</h4>
<p>Describe how to get <em>FFTW3</em>.</p>
</aside>
<h2 id="windows_configure">Creating <em>Visual Studio</em> project files</h2>
<p>Open the <em>CMake</em> program. Enter the name of the directory you cloned the repository
in (in our example, <code>C:\Users\<name>\src\DIPlib</code>); you can browse to this directory.
Under “Where to build the binaries” enter a different, new directory. For example
<code>target\DIPlib</code> in your user directory. Click on “Configure”. A pop-up window will
ask you for which generator to use. You should select your version of <em>Visual Studio</em>
here. Make sure you select the <strong>Win64</strong> version. If you select the default version,
you will build 32-bit binaries (really, in 2019 we’re still building 32-bit binaries
by default?). Also, the latest <em>MATLAB</em> versions no longer support 32-bit binaries,
so unless you select the 64-bit generator, you won’t be able to build <em>DIPimage</em>.</p>
<p>You will see a series of options, and a configuration report at the bottom. Here you
can change options:</p>
<ul>
<li>
<p><code>CMAKE_INSTALL_PREFIX</code> should be set to some directory where you want <em>DIPlib</em> and
friends installed. By default this is <code>C:\Program Files\DIPlib</code>. You can pick any
directory to your liking here. Note that the default directory requires administrator
privileges (I was not able to install there, even though I have the administrator
password). Let’s say we select <code>C:\Users\<name>\DIPlib</code>.</p>
</li>
<li>
<p>If <code>DIP_BUILD_DIPIMAGE</code> is not on the list, you don’t have <em>MATLAB</em> installed, or you are
building 32-bit binaries.</p>
</li>
<li>
<p>If <code>DIP_BUILD_DIPVIEWER</code> is not on the list, you need to specify the locations for
<em>GLFW</em>. Click the “Advanced” check box, this will show additional parameters.
Look for <code>GLFW_INCLUDE_DIR</code> and <code>GLFW_LIBRARY</code>. For both of these, click the “…” button
at the right and navigate to where you extracted the <em>GLFW</em> ZIP file. Select the “include”
directory for the first parameter, and “lib-vc2015\glfw3.lib” for the second.</p>
</li>
<li>
<p>If <code>DIP_BUILD_DIPVIEWER_JAVA</code> is not on the list but <code>DIP_BUILD_DIPVIEWER</code> is, you
don’t have <em>MATLAB</em> installed, you are building 32-bit binaries, or the <em>Java SDK</em> could not
be found. This is only necessary if you want to use the <code>viewslice</code> command from <em>DIPimage</em>.</p>
</li>
<li>
<p>If <code>DIP_BUILD_JAVAIO</code> is not on the list, the <em>Java SDK</em> could not be found. This is only
necessary if you want to import image formats that are not directly supported by <em>DIPlib</em>, and only
for <em>Python</em> and C++ (<em>MATLAB</em> uses the <em>Bio-Formats</em> package differently, see <code>help readim</code>
after installation).</p>
</li>
<li>
<p>If using a version of <em>MSVC</em> older than the 2019 edition, set both <code>DIP_ENABLE_UNICODE</code>
and <code>DIP_ENABLE_DOCTEST</code> to <code>Off</code>. You will get compilation errors if you don’t do this.</p>
</li>
<li>
<p>If you set <code>DIP_SHARED_LIBRARY</code> to <code>Off</code>, <em>DIPimage</em> and <em>PyDIP</em> will likely not work
correctly.</p>
</li>
</ul>
<p>Finally, click on “Generate” to create a <em>Visual Studio</em> solution file.</p>
<h2 id="windows_build">Building</h2>
<p>Find the file <code>DIPlib.sln</code> in the directory you selected as output for <em>CMake</em>, and
open it. Also, <em>CMake</em> will prompt you to open this file after it has generated it.</p>
<p>Opening the solution file will launch <em>Visual Studio</em>. In the “Solution Explorer” you’ll
find a list of targets (if configured for <em>DIPimage</em>, there will be very many targets!).
The <code>DIP</code> target is the <em>DIPlib</em> library itself. To build the <em>DIPimage</em> toolbox, use
the <code>INSTALL</code> target. This target builds everything
and installs it in the destination directory you specified in <em>CMake</em>
(<code>C:\Users\<name>\DIPlib</code> in our example). This is the target you will want to build.
To additionally install <em>PyDIP</em>, use the <code>pip_install</code> target (but note that you need
to run the <code>INSTALL</code> target first).</p>
<p>In the tool bar, make sure that “Release” and “x64” are selected (or x86 if you want to
build 32-bit binaries). Right-click on <code>INSTALL</code> and select “Build”.</p>
<p>If everything works correctly, you will have (depending on which options were enabled during configuration):</p>
<ul>
<li>
<p><code>C:\Users\<name>\DIPlib\bin</code>: <code>DIP.dll</code>, as well as <code>DIPviewer.dll</code>,
<code>DIPjavaio.dll</code>, <code>DIPjavaio.jar</code>, <code>dipview.exe</code> and <code>dipviewjava.exe</code>.</p>
</li>
<li>
<p><code>C:\Users\<name>\DIPlib\lib</code>: <code>DIP.lib</code>, as well as <code>DIPviewer.lib</code> and <code>DIPjavaio.lib</code>.</p>
</li>
<li>
<p><code>C:\Users\<name>\DIPlib\include</code>: The <em>DIPlib</em> include files, which you’ll need when
building your own C++ programs using <em>DIPlib</em>.</p>
</li>
<li>
<p><code>C:\Users\<name>\DIPlib\share\DIPimage</code>: The <em>DIPimage</em> toolbox for <em>MATLAB</em>.</p>
</li>
<li>
<p>In your selected <em>Python</em> package path: <code>diplib</code> (the <em>Python</em> module).</p>
</li>
</ul>
<h2 id="windows_dipimage">Using <em>DIPimage</em></h2>
<p>Once the <code>INSTALL</code> target has finished building and installing the toolbox, start
<em>MATLAB</em>. Type the following commands:</p>
<div class="m-code"><pre><span></span><span class="nb">addpath</span><span class="p">(</span><span class="s">'C:\Users\<name>\DIPlib\share\DIPimage'</span><span class="p">)</span>
<span class="nb">setenv</span><span class="p">(</span><span class="s">'PATH'</span><span class="p">,[</span><span class="s">'C:\Users\<name>\DIPlib\bin'</span><span class="p">,</span><span class="s">';'</span><span class="p">,</span><span class="nb">getenv</span><span class="p">(</span><span class="s">'PATH'</span><span class="p">)]);</span>
</pre></div>
<p>This will make the toolbox available (replace <code>C:\Users\<name>\DIPlib</code> with the
actual path you installed to).</p>
<p>To get started using <em>DIPimage</em>, read the <a href="dipimage_user_manual.html"><em>DIPimage</em> User Manual</a>,
and look through the help, starting at</p>
<div class="m-code"><pre><span></span><span class="nb">help</span><span class="w"> </span><span class="n">DIPimage</span>
</pre></div>
<p>Or start the GUI:</p>
<div class="m-code"><pre><span></span><span class="n">dipimage</span>
</pre></div>
<h2 id="windows_pydip">Using <em>PyDIP</em></h2>
<p>Once the <code>pip_install</code> target has finished installing, start <em>Python</em>.
The following command will import the <em>PyDIP</em> package as <code>dip</code>, which is shorter to
type and mimics the namespace used in the C++ library:</p>
<div class="m-code"><pre><span></span><span class="kn">import</span> <span class="nn">diplib</span> <span class="k">as</span> <span class="nn">dip</span>
</pre></div>
<p>To get started using <em>PyDIP</em>, look through the help, starting at</p>
<div class="m-code"><pre><span></span><span class="n">help</span><span class="p">(</span><span class="n">dip</span><span class="p">)</span>
</pre></div>
<p>The <a href="pydip_user_manual.html"><em>PyDIP</em> User Manual</a> is still quite short, but does contain some important
information to get you started.</p>
<div class="m-note m-dim m-thin m-text-center"><a href="building_macos.html" class="m-doc">« Building the <em>DIPlib</em> project on macOS</a> | <a href="building_diplib.html" class="m-doc">Building</a> | <a href="building_documentation.html" class="m-doc">Building the <em>DIPlib</em> documentation »</a></div>
</div>
</div>
</div>
</article></main>
<div class="m-doc-search" id="search">
<a href="#!" onclick="return hideSearch()"></a>
<div class="m-container">
<div class="m-row">
<div class="m-col-m-8 m-push-m-2">
<div class="m-doc-search-header m-text m-small">
<div><span class="m-label m-default">Tab</span> / <span class="m-label m-default">T</span> to search, <span class="m-label m-default">Esc</span> to close</div>
<div id="search-symbolcount">…</div>
</div>
<div class="m-doc-search-content">
<form action="https://diplib.org/diplib-docs/#search">
<input type="search" name="q" id="search-input" placeholder="Loading …" disabled="disabled" autofocus="autofocus" autocomplete="off" spellcheck="false" />
</form>
<noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript. Enable it or <a href="https://google.com/search?q=site:diplib.org+">use an external search engine</a>.</noscript>
<div id="search-help" class="m-text m-dim m-text-center">
<p class="m-noindent">Search for symbols, directories, files, pages or modules.
You can omit any prefix from the symbol or file path; adding a <code>:</code> or
<code>/</code> suffix lists all members of given symbol or directory.</p>
<p class="m-noindent">Use <span class="m-label m-dim">↓</span> / <span class="m-label m-dim">↑</span> to navigate through the list,
<span class="m-label m-dim">Enter</span> to go.
<span class="m-label m-dim">Tab</span> autocompletes common prefix.
You can copy a link to the result using <span class="m-label m-dim">⌘</span> <span class="m-label m-dim">L</span>,
or <span class="m-label m-dim">⌘</span> <span class="m-label m-dim">M</span> to copy a Markdown link.</p>
</div>
<div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.<br />Maybe try a full-text <a href="#" id="search-external" data-search-engine="https://google.com/search?q=site:diplib.org+{query}">search with external engine</a>?</div>
<ul id="search-results"></ul>
</div>
</div>
</div>
</div>
</div>
<script src="search-v1.js"></script>
<script src="searchdata-v1.js" async="async"></script>
<footer><nav>
<div class="m-container">
<div class="m-row">
<div class="m-col-l-10 m-push-l-1">
<p>DIPlib, a library for quantitative image analysis. Documentation compiled with <a href="https://crisluengo.github.io/doxpp/">dox++</a> and styled with <a href="https://mcss.mosra.cz/">m.css</a>.</p>
</div>
</div>
</div>
</nav></footer>
</body>
</html>