xref: /dpdk/doc/guides/sample_app_ug/compiling.rst (revision e2a94f9ad3ef949c0df3e63699bd4e381b5003d9)
1..  SPDX-License-Identifier: BSD-3-Clause
2    Copyright(c) 2015 Intel Corporation.
3
4Compiling the Sample Applications
5=================================
6
7This section explains how to compile the DPDK sample applications.
8
9To compile all the sample applications
10--------------------------------------
11
12Go to DPDK build directory:
13
14    .. code-block:: console
15
16       cd dpdk/<build_dir>
17
18Enable examples compilation:
19
20   .. code-block:: console
21
22      meson configure -Dexamples=all
23
24Build:
25
26   .. code-block:: console
27
28      ninja
29
30For additional information on compiling see
31:ref:`Compiling DPDK on Linux <linux_gsg_compiling_dpdk>` or
32:ref:`Compiling DPDK on FreeBSD <building_from_source>`.
33Applications are output to: ``dpdk/<build_dir>/examples``.
34
35
36To compile a single application
37-------------------------------
38
39
40Using meson
41~~~~~~~~~~~
42
43Go to DPDK build directory:
44
45    .. code-block:: console
46
47       cd dpdk/<build_dir>
48
49Enable example app compilation:
50
51   .. code-block:: console
52
53      meson configure -Dexamples=helloworld
54
55Build:
56
57   .. code-block:: console
58
59      ninja
60
61
62Using Make
63~~~~~~~~~~
64
65Pkg-config is used when building an example app standalone using make, please
66see :ref:`building_app_using_installed_dpdk` for more information.
67
68Go to the sample application directory. Unless otherwise specified the sample
69applications are located in ``dpdk/examples/``.
70
71Build the application:
72
73    .. code-block:: console
74
75        make
76
77To build the application for debugging use the ``DEBUG`` option.
78This option adds some extra flags, disables compiler optimizations and
79sets verbose output.
80
81    .. code-block:: console
82
83       make DEBUG=1
84