-
Notifications
You must be signed in to change notification settings - Fork 0
/
CLion.html
301 lines (258 loc) · 20.3 KB
/
CLion.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
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CLion</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css?v=fadd4351" />
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=77160d70" />
<script src="_static/documentation_options.js?v=a8da1a53"></script>
<script src="_static/doctools.js?v=9bcbadda"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="VSCode" href="VSCode.html" />
<link rel="prev" title="PyCharm" href="PyCharm.html" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59110517-1', 'auto');
ga('send', 'pageview');
</script>
</head><body>
<div id="navbar" class="navbar navbar-default ">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://www.mantidproject.org">
</a>
<span class="navbar-text navbar-version pull-left"><b>main</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
<li><a href="index.html">Home</a></li>
<li><a href="https://download.mantidproject.org">Download</a></li>
<li><a href="https://docs.mantidproject.org">User Documentation</a></li>
<li><a href="http://www.mantidproject.org/contact">Contact Us</a></li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<p>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html">Documentation</a> »</li>
<li class="nav-item nav-item-this"><a href="">CLion</a></li>
</ul>
</div> </p>
</div>
<div class="container">
<div class="row">
<div class="body col-md-12 content" role="main">
<section id="clion">
<span id="clion-ref"></span><h1>CLion<a class="headerlink" href="#clion" title="Link to this heading">¶</a></h1>
<nav class="contents local" id="contents">
<ul class="simple">
<li><p><a class="reference internal" href="#installing-clion" id="id1">Installing CLion</a></p></li>
<li><p><a class="reference internal" href="#opening-clion" id="id2">Opening CLion</a></p></li>
<li><p><a class="reference internal" href="#setup-for-a-clion-build" id="id3">Setup for a CLion Build</a></p>
<ul>
<li><p><a class="reference internal" href="#additional-build-configuration" id="id4">Additional Build Configuration</a></p></li>
</ul>
</li>
<li><p><a class="reference internal" href="#building-with-clion" id="id5">Building with CLion</a></p></li>
<li><p><a class="reference internal" href="#debugging-with-clion" id="id6">Debugging with CLion</a></p></li>
</ul>
</nav>
<section id="installing-clion">
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Installing CLion</a><a class="headerlink" href="#installing-clion" title="Link to this heading">¶</a></h2>
<p>Please note that these instructions only work when using a Ninja generator from a Windows or Linux operating system.</p>
<p>You will also need to have Visual Studio installed on windows.</p>
<p>If you haven’t installed CLion yet do that now, CLion can be installed from <a class="reference external" href="https://jetbrains.com/clion/download/">here</a>.</p>
</section>
<section id="opening-clion">
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Opening CLion</a><a class="headerlink" href="#opening-clion" title="Link to this heading">¶</a></h2>
<p>The first time you build from CLion, you will most likely need to launch it from a terminal or command line to make sure you have access to all the relevant tools.</p>
<ul class="simple">
<li><p>On Linux,</p>
<ol class="arabic simple">
<li><p>Open any terminal</p></li>
<li><p>Run <code class="docutils literal notranslate"><span class="pre">conda</span> <span class="pre">activate</span> <span class="pre">mantid-developer</span></code></p></li>
<li><p>Then launch CLion from this terminal with <code class="docutils literal notranslate"><span class="pre"><CLION_INSTALL>/bin/clion.sh</span></code></p></li>
</ol>
</li>
<li><p>On Windows,</p>
<ol class="arabic simple">
<li><p>Using your search bar, open the <code class="docutils literal notranslate"><span class="pre">x64</span> <span class="pre">Native</span> <span class="pre">Tools</span> <span class="pre">Command</span> <span class="pre">Prompt</span> <span class="pre">for</span> <span class="pre">VS</span> <span class="pre">2019</span></code> command prompt</p></li>
<li><p>Run <code class="docutils literal notranslate"><span class="pre">conda</span> <span class="pre">activate</span> <span class="pre">mantid-developer</span></code></p></li>
<li><p>Then launch CLion with <code class="docutils literal notranslate"><span class="pre"><CLION_INSTALL>/bin/clion.bat</span></code></p></li>
</ol>
</li>
</ul>
<p>If you get errors about being unable to compile a ‘simple test program’, then doing the above should fix your issue.</p>
</section>
<section id="setup-for-a-clion-build">
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Setup for a CLion Build</a><a class="headerlink" href="#setup-for-a-clion-build" title="Link to this heading">¶</a></h2>
<p>Follow these instructions when the CLion IDE has opened:</p>
<p>To set up your toolchain:</p>
<ol class="arabic">
<li><p>Navigate to <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Settings</span> <span class="pre">></span> <span class="pre">Build,</span> <span class="pre">Execution,</span> <span class="pre">Deployment</span> <span class="pre">></span> <span class="pre">Toolchains</span></code></p></li>
<li><p>Create a new <code class="docutils literal notranslate"><span class="pre">System</span></code> toolchain using the <code class="docutils literal notranslate"><span class="pre">+</span></code> icon and call it <code class="docutils literal notranslate"><span class="pre">Default</span></code></p></li>
<li><p>Edit the CMake field to point to your conda installed <code class="docutils literal notranslate"><span class="pre">cmake</span></code></p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux: <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer/bin/cmake</span></code></p></li>
<li><p>On Windows: <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer/Library/bin/cmake.exe</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>Edit the Build Tool field to point to your conda installed <code class="docutils literal notranslate"><span class="pre">ninja</span></code></p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux: <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer/bin/ninja</span></code></p></li>
<li><p>On Windows: <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer/Library/bin/ninja.exe</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>For the C Compiler and C++ Compiler fields,</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux: choose <code class="docutils literal notranslate"><span class="pre">Let</span> <span class="pre">CMake</span> <span class="pre">detect</span></code></p></li>
<li><p>On Windows: direct them both at the same <code class="docutils literal notranslate"><span class="pre">cl.exe</span></code> in your Visual Studio installation, e.g. <code class="docutils literal notranslate"><span class="pre">C:/Program</span> <span class="pre">Files</span> <span class="pre">(x86)/Microsoft</span> <span class="pre">Visual</span> <span class="pre">Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe</span></code></p></li>
</ul>
</td></tr></table>
</li>
</ol>
<p>To set up CMake:</p>
<ol class="arabic">
<li><p>Navigate to <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Settings</span> <span class="pre">></span> <span class="pre">Build,</span> <span class="pre">Execution,</span> <span class="pre">Deployment</span> <span class="pre">></span> <span class="pre">CMake</span></code></p></li>
<li><p>Edit the Build type field by either selecting an option, or typing in a string</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux: <code class="docutils literal notranslate"><span class="pre">Debug</span></code></p></li>
<li><p>On Windows: <code class="docutils literal notranslate"><span class="pre">DebugWithRelRuntime</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>Set your Toolchain to be the <code class="docutils literal notranslate"><span class="pre">Default</span></code> toolchain that you just created</p></li>
<li><p>Set your generator to be <code class="docutils literal notranslate"><span class="pre">Ninja</span></code></p></li>
<li><p>Edit your Cmake options to be</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux: <code class="docutils literal notranslate"><span class="pre">--preset=linux</span></code></p></li>
<li><p>On Windows: <code class="docutils literal notranslate"><span class="pre">--preset=win-ninja</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>Set the build directory to the <code class="docutils literal notranslate"><span class="pre">build</span></code> directory if it is not the default (you’ll need to use the full path if its outside the source directory)</p></li>
<li><p>The configurations drop-down at the top should show all of the build targets. If not, the CMake project is probably not loaded. Go to <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Reload</span> <span class="pre">CMake</span> <span class="pre">Project</span></code>. The configurations should be populated</p></li>
</ol>
<section id="additional-build-configuration">
<h3><a class="toc-backref" href="#id4" role="doc-backlink">Additional Build Configuration</a><a class="headerlink" href="#additional-build-configuration" title="Link to this heading">¶</a></h3>
<p>This (optional) additional configuration allows one to start Clion from the JetBrains Toolbox or
from a terminal without having to activate the conda environment in the terminal.
This is useful when you’re working on both Mantid and other projects in CLion simultaneously.</p>
<ol class="arabic simple">
<li><p>Navigate to <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Settings</span> <span class="pre">></span> <span class="pre">Build,</span> <span class="pre">Execution,</span> <span class="pre">Deployment</span> <span class="pre">></span> <span class="pre">CMake</span></code></p></li>
<li><p>Under <code class="docutils literal notranslate"><span class="pre">environment</span></code>, add new environment variable <code class="docutils literal notranslate"><span class="pre">CONDA_PREFIX</span></code> with value <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer</span></code>.</p></li>
<li><p>Navigate to <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Settings</span> <span class="pre">></span> <span class="pre">Build,</span> <span class="pre">Execution,</span> <span class="pre">Deployment</span> <span class="pre">></span> <span class="pre">Python</span> <span class="pre">Interpreter</span> <span class="pre">></span> <span class="pre">Add</span> <span class="pre">Interpreter</span> <span class="pre">></span> <span class="pre">Add</span> <span class="pre">Local</span> <span class="pre">Interpreter</span> <span class="pre">></span> <span class="pre">Conda</span> <span class="pre">Environment</span> <span class="pre">></span> <span class="pre">Use</span> <span class="pre">existing</span> <span class="pre">environment</span></code>, then select <code class="docutils literal notranslate"><span class="pre">mantid-developer</span></code>.</p></li>
</ol>
</section>
</section>
<section id="building-with-clion">
<h2><a class="toc-backref" href="#id5" role="doc-backlink">Building with CLion</a><a class="headerlink" href="#building-with-clion" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p>To build all targets, navigate to <code class="docutils literal notranslate"><span class="pre">Build</span> <span class="pre">></span> <span class="pre">Build</span> <span class="pre">All</span> <span class="pre">in</span> <span class="pre">'Debug'</span></code>. Check that the build command displayed in the Messages window is running the correct cmake executable from your conda installation.</p></li>
<li><p>To build a specific target, select it in the configurations drop-down menu and click the hammer icon next to it.</p></li>
</ul>
<p>If this fails, you may need to open CLion from a terminal with your conda environment activated.</p>
<p>It is also useful to have your terminals in CLion to run with this environment:</p>
<ol class="arabic">
<li><p>In your <code class="docutils literal notranslate"><span class="pre">home</span></code> directory create a file named <code class="docutils literal notranslate"><span class="pre">.clionrc</span></code> and open in your favourite text editor, adding these lines:</p>
<div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="nb">source</span><span class="w"> </span>~/.bashrc
<span class="nb">source</span><span class="w"> </span>~/mambaforge/bin/activate<span class="w"> </span>mantid-developer
</pre></div>
</div>
</li>
<li><p>Start CLion using the above steps</p></li>
<li><p>Navigate to <code class="docutils literal notranslate"><span class="pre">File</span> <span class="pre">></span> <span class="pre">Settings</span> <span class="pre">></span> <span class="pre">Tools</span> <span class="pre">></span> <span class="pre">Terminal</span></code></p></li>
<li><p>To the end of the <code class="docutils literal notranslate"><span class="pre">Shell</span> <span class="pre">path</span></code> option, add <code class="docutils literal notranslate"><span class="pre">--rcfile</span> <span class="pre">~/.clionrc</span></code></p></li>
</ol>
</section>
<section id="debugging-with-clion">
<h2><a class="toc-backref" href="#id6" role="doc-backlink">Debugging with CLion</a><a class="headerlink" href="#debugging-with-clion" title="Link to this heading">¶</a></h2>
<p>To debug workbench, you’ll need to edit the <code class="docutils literal notranslate"><span class="pre">workbench</span></code> CMake Application configuration.</p>
<ol class="arabic">
<li><p>Set the executable to be the <code class="docutils literal notranslate"><span class="pre">python</span></code> executable in your conda installation:</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux & macOS: <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer/bin/python</span></code></p></li>
<li><p>On Windows: <code class="docutils literal notranslate"><span class="pre">/path/to/mambaforge/envs/mantid-developer/python.exe</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>Set the program arguments:</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On Linux, macOS and Windows: <code class="docutils literal notranslate"><span class="pre">-m</span> <span class="pre">workbench</span> <span class="pre">--single-process</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>Set the working directory:</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>All OS: <code class="docutils literal notranslate"><span class="pre">path/to/mambaforge/envs/md/bin/</span></code></p></li>
</ul>
</td></tr></table>
</li>
<li><p>Set any relevant environment variables:</p>
<table class="hlist"><tr><td><ul class="simple">
<li><p>On macOS: <code class="docutils literal notranslate"><span class="pre">PYTHONPATH=${PYTHONPATH}:/full/path/to/build/bin/</span></code></p></li>
</ul>
</td></tr></table>
</li>
</ol>
<p>The <code class="docutils literal notranslate"><span class="pre">--single-process</span></code> flag is necessary for debugging. See the <a class="reference internal" href="Workbench/RunningWorkbench.html#runningworkbench"><span class="std std-ref">Running Workbench</span></a> documentation for more information.</p>
<p>You should now be able to set breakpoints and start debugging by clicking the bug icon.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>macOS developers will see the warning from Qt in the terminal:</p>
<p><code class="docutils literal notranslate"><span class="pre">An</span> <span class="pre">OpenGL</span> <span class="pre">surfcace</span> <span class="pre">format</span> <span class="pre">was</span> <span class="pre">requested</span> <span class="pre">that</span> <span class="pre">is</span> <span class="pre">either</span> <span class="pre">not</span> <span class="pre">version</span> <span class="pre">3.2</span> <span class="pre">or</span> <span class="pre">higher</span> <span class="pre">or</span> <span class="pre">a</span> <span class="pre">not</span> <span class="pre">Core</span> <span class="pre">Profile.</span></code>
<code class="docutils literal notranslate"><span class="pre">Chromium</span> <span class="pre">on</span> <span class="pre">macOS</span> <span class="pre">will</span> <span class="pre">fall</span> <span class="pre">back</span> <span class="pre">to</span> <span class="pre">software</span> <span class="pre">rendering</span> <span class="pre">in</span> <span class="pre">this</span> <span class="pre">case.</span></code>
<code class="docutils literal notranslate"><span class="pre">Hardware</span> <span class="pre">acceleration</span> <span class="pre">and</span> <span class="pre">features</span> <span class="pre">such</span> <span class="pre">as</span> <span class="pre">WebGL</span> <span class="pre">will</span> <span class="pre">not</span> <span class="pre">be</span> <span class="pre">available.</span></code></p>
<p>It can be safely ignored but is present as a reminder of some deprecated OpenGL
functionality being used.
It is only visible to developers and the spelling mistake is real.</p>
</div>
</section>
</section>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<ul class="nav navbar-nav" style=" float: right;">
<li>
<a href="PyCharm.html" title="Previous Chapter: PyCharm"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm hidden-tablet">« PyCharm</span>
</a>
</li>
<li>
<a href="VSCode.html" title="Next Chapter: VSCode"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm hidden-tablet">VSCode »</span>
</a>
</li>
<li><a href="#">Back to top</a></li>
</ul>
<p>
</p>
</div>
</footer>
</body>
</html>