-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathIDE-integration.html
836 lines (799 loc) · 27.9 KB
/
IDE-integration.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<base href=".">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>IDE integration</title>
<link rel="stylesheet" href="assets/css/dark-frontend.css" type="text/css" title="dark">
<link rel="alternate stylesheet" href="assets/css/light-frontend.css" type="text/css" title="light">
<link rel="stylesheet" href="assets/css/bootstrap-toc.min.css" type="text/css">
<link rel="stylesheet" href="assets/css/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="assets/js/search/enable_search.css" type="text/css">
<link rel="stylesheet" href="assets/css/prism-tomorrow.css" type="text/css" title="dark">
<link rel="alternate stylesheet" href="assets/css/prism.css" type="text/css" title="light">
<script src="assets/js/mustache.min.js"></script>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="assets/js/scrollspy.js"></script>
<script src="assets/js/typeahead.jquery.min.js"></script>
<script src="assets/js/search.js"></script>
<script src="assets/js/compare-versions.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="assets/js/bootstrap-toc.min.js"></script>
<script src="assets/js/jquery.touchSwipe.min.js"></script>
<script src="assets/js/anchor.min.js"></script>
<script src="assets/js/tag_filtering.js"></script>
<script src="assets/js/language_switching.js"></script>
<script src="assets/js/styleswitcher.js"></script>
<script src="assets/js/lines_around_headings.js"></script>
<script src="assets/js/prism-core.js"></script>
<script src="assets/js/prism-autoloader.js"></script>
<script src="assets/js/prism_autoloader_path_override.js"></script>
<script src="assets/js/prism-keep-markup.js"></script>
<script src="assets/js/trie.js"></script>
<link rel="icon" type="image/png" href="assets/images/favicon.png">
<link rel="shortcut icon" href="assets/images/favicon.png">
</head>
<body class="no-script
">
<script>
$('body').removeClass('no-script');
</script>
<nav class="navbar navbar-fixed-top navbar-default" id="topnav">
<div class="container-fluid">
<div class="navbar-right">
<a id="toc-toggle">
<span class="glyphicon glyphicon-menu-right"></span>
<span class="glyphicon glyphicon-menu-left"></span>
</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-wrapper" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span title="light mode switch" class="glyphicon glyphicon-sunglasses pull-right" id="lightmode-icon"></span>
<form class="navbar-form pull-right" id="navbar-search-form">
<div class="form-group has-feedback">
<input type="text" class="form-control input-sm" name="search" id="sidenav-lookup-field" placeholder="search" disabled>
<span class="glyphicon glyphicon-search form-control-feedback" id="search-mgn-glass"></span>
</div>
</form>
</div>
<div class="navbar-header">
<a id="sidenav-toggle">
<span class="glyphicon glyphicon-menu-right"></span>
<span class="glyphicon glyphicon-menu-left"></span>
</a>
<a id="home-link" href="index.html" class="hotdoc-navbar-brand">
<img src="assets/images/meson_logo.png" alt="Home">
</a>
</div>
<div class="navbar-collapse collapse" id="navbar-wrapper">
<ul class="nav navbar-nav" id="menu">
<li class="dropdown">
<a class="dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Modules <span class="caret"></span>
</a>
<ul class="dropdown-menu" id="modules-menu">
<li>
<a href="CMake-module.html">CMake</a>
</li>
<li>
<a href="Cuda-module.html">CUDA</a>
</li>
<li>
<a href="Dlang-module.html">Dlang</a>
</li>
<li>
<a href="External-Project-module.html">External Project</a>
</li>
<li>
<a href="Fs-module.html">Filesystem</a>
</li>
<li>
<a href="Gnome-module.html">GNOME</a>
</li>
<li>
<a href="Hotdoc-module.html">Hotdoc</a>
</li>
<li>
<a href="i18n-module.html">i18n</a>
</li>
<li>
<a href="Icestorm-module.html">Icestorm</a>
</li>
<li>
<a href="Java-module.html">Java</a>
</li>
<li>
<a href="Keyval-module.html">Keyval</a>
</li>
<li>
<a href="Pkgconfig-module.html">Pkgconfig</a>
</li>
<li>
<a href="Python-3-module.html">Python 3</a>
</li>
<li>
<a href="Python-module.html">Python</a>
</li>
<li>
<a href="Qt4-module.html">Qt4</a>
</li>
<li>
<a href="Qt5-module.html">Qt5</a>
</li>
<li>
<a href="Qt6-module.html">Qt6</a>
</li>
<li>
<a href="Rust-module.html">Rust</a>
</li>
<li>
<a href="Simd-module.html">Simd</a>
</li>
<li>
<a href="SourceSet-module.html">SourceSet</a>
</li>
<li>
<a href="Wayland-module.html">Wayland</a>
</li>
<li>
<a href="Windows-module.html">Windows</a>
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Quick References <span class="caret"></span>
</a>
<ul class="dropdown-menu" id="quick-refs-menu">
<li>
<a href="Reference-manual.html">Functions</a>
</li>
<li>
<a href="Build-options.html">Options</a>
</li>
<li>
<a href="Configuration.html">Configuration</a>
</li>
<li>
<a href="Dependencies.html">Dependencies</a>
</li>
<li>
<a href="Unit-tests.html">Tests</a>
</li>
<li>
<a href="Syntax.html">Syntax</a>
</li>
</ul>
</li>
</ul>
<div class="hidden-xs hidden-sm navbar-text navbar-center">
<p><b>The Meson Build System</b></p>
</div>
</div>
</div>
</nav>
<main>
<div data-extension="core" data-hotdoc-in-toplevel="True" data-hotdoc-project="Meson-documentation" data-hotdoc-ref="IDE-integration.html" class="page_container" id="page-wrapper">
<script src="assets/js/utils.js"></script>
<div class="panel panel-collapse oc-collapsed" id="sidenav" data-hotdoc-role="navigation">
<script src="assets/js/full-width.js"></script>
<div id="sitenav-wrapper">
<iframe src="hotdoc-sitemap.html" id="sitenav-frame"></iframe>
</div>
</div>
<div id="body">
<div id="main">
<div id="page-description" data-hotdoc-role="main">
<h1 id="ide-integration">IDE integration</h1>
<p>Meson has exporters for Visual Studio and XCode, but writing a custom
backend for every IDE out there is not a scalable approach. To solve
this problem, Meson provides an API that makes it easy for any IDE or
build tools to integrate Meson builds and provide an experience
comparable to a solution native to the IDE.</p>
<p>All the resources required for such a IDE integration can be found in
the <code>meson-info</code> directory in the build directory.</p>
<p>The first thing to do when setting up a Meson project in an IDE is to
select the source and build directories. For this example we assume
that the source resides in an Eclipse-like directory called
<code>workspace/project</code> and the build tree is nested inside it as
<code>workspace/project/build</code>. First, we initialize Meson by running the
following command in the source directory.</p>
<pre><code>meson setup builddir
</code></pre>
<p>With this command Meson will configure the project and also generate
introspection information that is stored in <code>intro-*.json</code> files in
the <code>meson-info</code> directory. The introspection dump will be
automatically updated when Meson is (re)configured, or the build
options change. Thus, an IDE can watch for changes in this directory
to know when something changed. Note that <code>meson-info.json</code> guaranteed
to be the last file written.</p>
<p>The <code>meson-info</code> directory should contain the following files:</p>
<table>
<thead>
<tr>
<th> File</th>
<th> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td> <code>intro-benchmarks.json</code>
</td>
<td> Lists all benchmarks</td>
</tr>
<tr>
<td> <code>intro-buildoptions.json</code>
</td>
<td> Contains a full list of Meson configuration options for the project</td>
</tr>
<tr>
<td> <code>intro-buildsystem_files.json</code>
</td>
<td> Full list of all Meson build files</td>
</tr>
<tr>
<td> <code>intro-dependencies.json</code>
</td>
<td> Lists all dependencies used in the project</td>
</tr>
<tr>
<td> <code>intro-installed.json</code>
</td>
<td> Contains mapping of files to their installed location</td>
</tr>
<tr>
<td> <code>intro-install_plan.json</code>
</td>
<td> Dictionary of data types with the source files and their installation details</td>
</tr>
<tr>
<td> <code>intro-projectinfo.json</code>
</td>
<td> Stores basic information about the project (name, version, etc.)</td>
</tr>
<tr>
<td> <code>intro-targets.json</code>
</td>
<td> Full list of all build targets</td>
</tr>
<tr>
<td> <code>intro-tests.json</code>
</td>
<td> Lists all tests with instructions how to run them</td>
</tr>
</tbody>
</table>
<p>The content of the JSON files is further specified in the remainder of
this document.</p>
<h2 id="the-targets-section">The <code>targets</code> section</h2>
<p>The most important file for an IDE is probably <code>intro-targets.json</code>.
Here each target with its sources and compiler parameters is
specified. The JSON format for one target is defined as follows:</p>
<pre><code class="language-json">{
"name": "Name of the target",
"id": "The internal ID meson uses",
"type": "<TYPE>",
"defined_in": "/Path/to/the/targets/meson.build",
"subproject": null,
"filename": ["list", "of", "generated", "files"],
"build_by_default": true / false,
"target_sources": [],
"extra_files": ["/path/to/file1.hpp", "/path/to/file2.hpp"],
"installed": true / false,
}
</code></pre>
<p>If the key <code>installed</code> is set to <code>true</code>, the key <code>install_filename</code>
will also be present. It stores the installation location for each
file in <code>filename</code>. If one file in <code>filename</code> is not installed, its
corresponding install location is set to <code>null</code>.</p>
<p>The <code>subproject</code> key specifies the name of the subproject this target
was defined in, or <code>null</code> if the target was defined in the top level
project.</p>
<p><em>(New in 0.56.0)</em> The <code>extra_files</code> key lists all files specified via
the <code>extra_files</code> kwarg of a build target. See
<a href="Reference-manual_functions.html#executable"><ins><code>executable()</code></ins></a>.</p>
<p>A target usually generates only one file. However, it is possible for
custom targets to have multiple outputs.</p>
<h3 id="target-sources">Target sources</h3>
<p>The <code>intro-targets.json</code> file also stores a list of all source objects
of the target in the <code>target_sources</code>. With this information, an IDE
can provide code completion for all source files.</p>
<pre><code class="language-json">{
"language": "language ID",
"machine": "build" / "host",
"compiler": ["The", "compiler", "command"],
"parameters": ["list", "of", "compiler", "parameters"],
"sources": ["list", "of", "all", "source", "files", "for", "this", "language"],
"generated_sources": ["list", "of", "all", "source", "files", "that", "where", "generated", "somewhere", "else"]
}
</code></pre>
<p><em>(New in 1.7.0)</em> The <code>machine</code> and <code>language</code> keys make it possible to
to access further information about the compiler in the <code>compilers</code>
introspection information. <code>machine</code> can be absent if <code>language</code> is
<code>unknown</code>. In this case, information about the compiler is not
available; Meson is therefore unable to know if the output relates
to either the build of the host machine.</p>
<p>It should be noted that the compiler parameters stored in the
<code>parameters</code> differ from the actual parameters used to compile the
file. This is because the parameters are optimized for the usage in an
IDE to provide autocompletion support, etc. It is thus not recommended
to use this introspection information for actual compilation.</p>
<h3 id="possible-values-for-type">Possible values for <code>type</code>
</h3>
<p>The following table shows all valid types for a target.</p>
<table>
<thead>
<tr>
<th> value of <code>type</code>
</th>
<th> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td> <code>executable</code>
</td>
<td> This target will generate an executable file</td>
</tr>
<tr>
<td> <code>static library</code>
</td>
<td> Target for a static library</td>
</tr>
<tr>
<td> <code>shared library</code>
</td>
<td> Target for a shared library</td>
</tr>
<tr>
<td> <code>shared module</code>
</td>
<td> A shared library that is meant to be used with dlopen rather than linking into something else</td>
</tr>
<tr>
<td> <code>custom</code>
</td>
<td> A custom target</td>
</tr>
<tr>
<td> <code>run</code>
</td>
<td> A Meson run target</td>
</tr>
<tr>
<td> <code>jar</code>
</td>
<td> A Java JAR target</td>
</tr>
</tbody>
</table>
<h3 id="install-plan">Install plan</h3>
<p>The <code>intro-install_plan.json</code> file contains a list of the files that are going
to be installed on the system.</p>
<p>The data contains a list of files grouped by data type. Each file maps to a
dictionary containing the <code>destination</code> and <code>tag</code> keys, with the key being the
file location at build time. <code>destination</code> is the destination path using
placeholders for the base directories. New keys may be added in the future.</p>
<pre><code class="language-json">{
"targets": {
"/path/to/project/builddir/some_executable": {
"destination": "{bindir}/some_executable",
"tag": "runtime"
},
"/path/to/project/builddir/libsomelib.so": {
"destination": "{libdir_shared}/libsomelib.so",
"tag": "runtime"
}
},
"data": {
"/path/to/project/some_data": {
"destination": "{datadir}/some_data",
"tag": null
}
},
"headers": {
"/path/to/project/some_header.h": {
"destination": "{includedir}/some_header.h",
"tag": "devel"
}
}
}
</code></pre>
<p>Additionally, the <code>intro-installed.json</code> file contains the mapping of the
file path at build time to the absolute system location.</p>
<pre><code class="language-json">{
"/path/to/project/builddir/some_executable": "/usr/bin/some_executable",
"/path/to/project/builddir/libsomelib.so": "/user/lib/libsomelib.so",
"/path/to/project/some_data": "/usr/share/some_data",
"/path/to/project/some_header.h": "/usr/include/some_header.h"
}
</code></pre>
<h3 id="using-targets-without-a-build-directory">Using <code>--targets</code> without a build directory</h3>
<p>It is also possible to get most targets without a build directory.
This can be done by running <code>meson introspect --targets /path/to/meson.build</code>.</p>
<p>The generated output is similar to running the introspection with a
build directory or reading the <code>intro-targets.json</code>. However, there
are some key differences:</p>
<ul>
<li>The paths in <code>filename</code> now are <em>relative</em> to the future build directory</li>
<li>The <code>install_filename</code> key is completely missing</li>
<li>There is only one entry in <code>target_sources</code>:
<ul>
<li>With the language set to <code>unknown</code>
</li>
<li>Empty lists for <code>compiler</code> and <code>parameters</code> and <code>generated_sources</code>
</li>
<li>The <code>sources</code> list <em>should</em> contain all sources of the target</li>
</ul>
</li>
</ul>
<p>There is no guarantee that the sources list in <code>target_sources</code> is
correct. There might be differences, due to internal limitations. It
is also not guaranteed that all targets will be listed in the output.
It might even be possible that targets are listed, which won't exist
when Meson is run normally. This can happen if a target is defined
inside an if statement. Use this feature with care.</p>
<h2 id="build-options">Build Options</h2>
<p>The list of all build options (build type, warning level, etc.) is
stored in the <code>intro-buildoptions.json</code> file. Here is the JSON format
for each option.</p>
<pre><code class="language-json">{
"name": "name of the option",
"description": "the description",
"type": "type ID",
"value": "value depends on type",
"section": "section ID",
"machine": "machine ID"
}
</code></pre>
<p>The supported types are:</p>
<ul>
<li>string</li>
<li>boolean</li>
<li>combo</li>
<li>integer</li>
<li>array</li>
</ul>
<p>For the type <code>combo</code> the key <code>choices</code> is also present. Here all valid
values for the option are stored.</p>
<p>The possible values for <code>section</code> are:</p>
<ul>
<li>core</li>
<li>backend</li>
<li>base</li>
<li>compiler</li>
<li>directory</li>
<li>user</li>
<li>test</li>
</ul>
<p>The <code>machine</code> key specifies the machine configuration for the option.
Possible values are:</p>
<ul>
<li>any</li>
<li>host</li>
<li>build</li>
</ul>
<p>To set the options, use the <code>meson configure</code> command.</p>
<p>Since Meson 0.50.0 it is also possible to get the default buildoptions
without a build directory by providing the root <code>meson.build</code> instead
of a build directory to <code>meson introspect --buildoptions</code>.</p>
<p>Running <code>--buildoptions</code> without a build directory produces the same
output as running it with a freshly configured build directory.</p>
<p>However, this behavior is not guaranteed if subprojects are present.
Due to internal limitations all subprojects are processed even if they
are never used in a real Meson run. Because of this options for the
subprojects can differ.</p>
<h2 id="the-dependencies-section">The dependencies section</h2>
<p>The list of all <em>found</em> dependencies can be acquired from
<code>intro-dependencies.json</code>. Here, the name, version, compiler and
linker arguments for a dependency are listed.</p>
<h3 id="scanning-for-dependencies-with-scandependencies">Scanning for dependencies with <code>--scan-dependencies</code>
</h3>
<p>It is also possible to get most dependencies used without a build
directory. This can be done by running <code>meson introspect --scan-dependencies /path/to/meson.build</code>.</p>
<p>The output format is as follows:</p>
<pre><code class="language-json">[
{
"name": "The name of the dependency",
"required": true,
"version": [">=1.2.3"],
"conditional": false,
"has_fallback": false
}
]
</code></pre>
<p>The <code>required</code> keyword specifies whether the dependency is marked as
required in the <code>meson.build</code> (all dependencies are required by
default). The <code>conditional</code> key indicates whether the <code>dependency()</code>
function was called inside a conditional block. In a real Meson run
these dependencies might not be used, thus they <em>may</em> not be required,
even if the <code>required</code> key is set. The <code>has_fallback</code> key just
indicates whether a fallback was directly set in the <code>dependency()</code>
function. The <code>version</code> key always contains a list of version
requirements from the <code>meson.build</code> and <strong>not</strong> the actual version of
the dependency on disc. The version list is empty if no version was
specified in the <code>meson.build</code>.</p>
<h2 id="tests">Tests</h2>
<p>Compilation and unit tests are done as usual by running the <code>meson compile</code> and <code>meson test</code> commands. A JSON formatted result log can be
found in <code>workspace/project/builddir/meson-logs/testlog.json</code>.</p>
<p>When these tests fail, the user probably wants to run the failing test
in a debugger. To make this as integrated as possible, extract the
tests from the <code>intro-tests.json</code> and <code>intro-benchmarks.json</code> files.
This provides you with all the information needed to run the test:
what command to execute, command line arguments, environment variable
settings and how to process the output.</p>
<pre><code class="language-json">{
"name": "name of the test",
"workdir": "the working directory (can be null)",
"timeout": "the test timeout",
"suite": ["list", "of", "test", "suites"],
"is_parallel": true / false,
"protocol": "exitcode" / "tap",
"cmd": ["command", "to", "run"],
"depends": ["target1-id", "target2-id"],
"env": {
"VARIABLE1": "value 1",
"VARIABLE2": "value 2"
}
}
</code></pre>
<p>The <code>depends</code> entry <em>(since 0.56.0)</em> contains target ids; they can be
looked up in the targets introspection data. The executable pointed to
by <code>cmd</code> is also included in the entry, as are any arguments to the
test that are build products.</p>
<h2 id="build-system-files">Build system files</h2>
<p>It is also possible to get Meson build files used in your current
project. This can be done by running <code>meson introspect --buildsystem-files /path/to/builddir</code>.</p>
<p>The output format is as follows:</p>
<pre><code class="language-json">[
"/Path/to/the/targets/meson.build",
"/Path/to/the/targets/meson.options",
"/Path/to/the/targets/subdir/meson.build"
]
</code></pre>
<h1 id="programmatic-interface">Programmatic interface</h1>
<p>Meson also provides the <code>meson introspect</code> for project introspection
via the command line. Use <code>meson introspect -h</code> to see all available
options.</p>
<p>This API can also work without a build directory for the
<code>--projectinfo</code> command.</p>
<h1 id="ast-of-a-mesonbuild">AST of a <code>meson.build</code>
</h1>
<p>Since Meson <em>0.55.0</em> it is possible to dump the AST of a <code>meson.build</code>
as a JSON object. The interface for this is <code>meson introspect --ast /path/to/meson.build</code>.</p>
<p>Each node of the AST has at least the following entries:</p>
<table>
<thead>
<tr>
<th> Key</th>
<th> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td> <code>node</code>
</td>
<td> Type of the node (see following table)</td>
</tr>
<tr>
<td> <code>lineno</code>
</td>
<td> Line number of the node in the file</td>
</tr>
<tr>
<td> <code>colno</code>
</td>
<td> Column number of the node in the file</td>
</tr>
<tr>
<td> <code>end_lineno</code>
</td>
<td> Marks the end of the node (may be the same as <code>lineno</code>)</td>
</tr>
<tr>
<td> <code>end_colno</code>
</td>
<td> Marks the end of the node (may be the same as <code>colno</code>)</td>
</tr>
</tbody>
</table>
<p>Possible values for <code>node</code> with additional keys:</p>
<table>
<thead>
<tr>
<th> Node type</th>
<th> Additional keys</th>
</tr>
</thead>
<tbody>
<tr>
<td> <code>BooleanNode</code>
</td>
<td> <code>value</code>: bool</td>
</tr>
<tr>
<td> <code>IdNode</code>
</td>
<td> <code>value</code>: str</td>
</tr>
<tr>
<td> <code>NumberNode</code>
</td>
<td> <code>value</code>: int</td>
</tr>
<tr>
<td> <code>StringNode</code>
</td>
<td> <code>value</code>: str</td>
</tr>
<tr>
<td> <code>ContinueNode</code>
</td>
<td></td>
</tr>
<tr>
<td> <code>BreakNode</code>
</td>
<td></td>
</tr>
<tr>
<td> <code>ArgumentNode</code>
</td>
<td> <code>positional</code>: node list; <code>kwargs</code>: accept_kwargs</td>
</tr>
<tr>
<td> <code>ArrayNode</code>
</td>
<td> <code>args</code>: node</td>
</tr>
<tr>
<td> <code>DictNode</code>
</td>
<td> <code>args</code>: node</td>
</tr>
<tr>
<td> <code>EmptyNode</code>
</td>
<td></td>
</tr>
<tr>
<td> <code>OrNode</code>
</td>
<td> <code>left</code>: node; <code>right</code>: node</td>
</tr>
<tr>
<td> <code>AndNode</code>
</td>
<td> <code>left</code>: node; <code>right</code>: node</td>
</tr>
<tr>
<td> <code>ComparisonNode</code>
</td>
<td> <code>left</code>: node; <code>right</code>: node; <code>ctype</code>: str</td>
</tr>
<tr>
<td> <code>ArithmeticNode</code>
</td>
<td> <code>left</code>: node; <code>right</code>: node; <code>op</code>: str</td>
</tr>
<tr>
<td> <code>NotNode</code>
</td>
<td> <code>right</code>: node</td>
</tr>
<tr>
<td> <code>CodeBlockNode</code>
</td>
<td> <code>lines</code>: node list</td>
</tr>
<tr>
<td> <code>IndexNode</code>
</td>
<td> <code>object</code>: node; <code>index</code>: node</td>
</tr>
<tr>
<td> <code>MethodNode</code>
</td>
<td> <code>object</code>: node; <code>args</code>: node; <code>name</code>: str</td>
</tr>
<tr>
<td> <code>FunctionNode</code>
</td>
<td> <code>args</code>: node; <code>name</code>: str</td>
</tr>
<tr>
<td> <code>AssignmentNode</code>
</td>
<td> <code>value</code>: node; <code>var_name</code>: str</td>
</tr>
<tr>
<td> <code>PlusAssignmentNode</code>
</td>
<td> <code>value</code>: node; <code>var_name</code>: str</td>
</tr>
<tr>
<td> <code>ForeachClauseNode</code>
</td>
<td> <code>items</code>: node; <code>block</code>: node; <code>varnames</code>: list</td>
</tr>
<tr>
<td> <code>IfClauseNode</code>
</td>
<td> <code>ifs</code>: node list; <code>else</code>: node</td>
</tr>
<tr>
<td> <code>IfNode</code>
</td>
<td> <code>condition</code>: node; <code>block</code>: node</td>
</tr>
<tr>
<td> <code>UMinusNode</code>
</td>
<td> <code>right</code>: node</td>
</tr>
<tr>
<td> <code>TernaryNode</code>
</td>
<td> <code>condition</code>: node; <code>true</code>: node; <code>false</code>: node</td>
</tr>
</tbody>
</table>
<p>We do not guarantee the stability of this format since it is heavily
linked to the internal Meson AST. However, breaking changes (removal
of a node type or the removal of a key) are unlikely and will be
announced in the release notes.</p>
<h1 id="json-reference-manual">JSON Reference manual</h1>
<p>In additional to the online <a href="Reference-manual.html">Reference manual</a>, Meson also
offers the manual as JSON file. The content of this file is generated from the
same source as the online documentation. The two versions are thus identical
in content.</p>
<p>This JSON document is attached to every Meson release since <em>0.60.0</em>. The JSON
schema is defined by the class structure given in
<a href="https://github.com/mesonbuild/meson/blob/master/docs/refman/jsonschema.py"><code>jsonschema.py</code></a></p>
<h1 id="existing-integrations">Existing integrations</h1>
<ul>
<li><a href="https://www.jetbrains.com/clion/">CLion</a></li>
<li><a href="https://www.eclipse.org/cdt/">Eclipse CDT</a></li>
<li><a href="https://wiki.gnome.org/Apps/Builder">Gnome Builder</a></li>
<li><a href="https://www.kdevelop.org">KDevelop</a></li>
<li>
<a href="https://plugins.jetbrains.com/plugin/13269-meson-syntax-highlighter">Meson Syntax Highlighter</a> 3rd party plugin for JetBrains IDEs.</li>
<li>
<a href="https://github.com/dreamer-coding-555/meson-ui">Meson-UI</a> (build GUI for Meson)</li>
<li>
<a href="https://github.com/stephanlachnit/mmeson">mmeson</a> (ccmake clone for Meson)</li>
<li><a href="https://doc.qt.io/qtcreator/creator-project-meson.html">Qt Creator</a></li>
<li>
<a href="https://github.com/mesonbuild/vscode-meson">vscode-meson</a> extension for VS Code/Codium</li>
</ul>
</div>
</div>
<div id="search_results">
<p>The results of the search are</p>
</div>
<div id="footer">
<hr>
<div class="license-description">
Website licensing information are available on the <a href="legal.html">Legal</a> page.
</div>
</div>
</div>
<div id="toc-column">
<div class="edit-button">
<a href="https://github.com/mesonbuild/meson/edit/master/docs/markdown/IDE-integration.md" data-hotdoc-role="edit-button">Edit on GitHub</a>
</div>
<div id="toc-wrapper">
<nav id="toc"></nav>
</div>
</div>
</div>
</main>
<script src="assets/js/navbar_offset_scroller.js"></script>
</body>
</html>