blob: 77fd16553b4de169b1f93240c19a9c3f834c6008 [file] [log] [blame]
Radek Krejci7132fc52020-10-26 14:34:06 +01001/**
2 * @page build Building libyang
3 *
4 * [TOC]
5 *
6 * libyang utilizes CMake build system to detect necessary dependencies, checkout the build environment and prepare Makefiles
7 * for the compilation of the library and acompanied tools.
8 *
9 * @section buildRequirements Requirements
10 *
11 * @subsection buildRequirementsCompile Building Requirements
12 *
13 * - C compiler (gcc, clang, ...)
14 * - CMake >= 2.8.12
15 * - libpcre2 (including headers - devel package) >= 10.30
16 *
17 * @subsubsection buildRequirementsCompileOptional Optional Requirements
18 *
19 * - doxygen (for generating documentation)
20 * - cmocka >= 1.0.0 (for tests)
21 * - valgrind (for enhanced testing)
22 * - gcov (for code coverage)
23 * - lcov (for code coverage)
24 * - genhtml (for code coverage)
25 *
26 * @subsection buildRequirementsRun Runtime Requirements
27 *
28 * - libpcre2 (runtime package) >= 10.30
29 *
30 * @section buildCommands Building
31 *
32 * To simply build libyang library and the accompanied tools with the default settings, follow these steps (the `#` character
33 * indicates command(s) to run with `root` privileges):
34 *
35 * $ mkdir build; cd build
36 * $ cmake ..
37 * $ make
38 * # make install
39 *
40 * The default settings can be changed with various CMake variables set via command line or using e.g. `ccmake(1)` tool.
41 * The following sections introduces those variables and explain their meaning.
42 *
43 * @section buildTypes Build Types
44 *
45 * There are several build types according to the primary goal of using the built binaries.
46 *
47 * @subsection buildTypesRelese Release
48 *
49 * Build type to produce final binaries for production use without any debug option. The compiler flags are set as follows:
50 *
51 * -Wall -Wextra -Wno-missing-field-initializers -std=c99 -O3 -DNDEBUG
52 *
53 * Here is the list of the selected additional options available in the *Release* build type.
54 *
55 * Option | Description | Default
56 * ----------------------|------------------------------------------------------------------------------------|--------
57 * ENABLE_BUILD_TESTS | Build tests. | OFF
58 * ENABLE_VALGRIND_TESTS | Build tests with valgrind. | OFF
59 * ENABLE_COVERAGE | Build code coverage report from tests. | OFF
60 * ENABLE_FUZZ_TARGETS | Build target programs suitable for fuzzing with AFL. | OFF
61 * ENABLE_STATIC | Build static (.a) library | OFF
62 * INTERNAL_DOCS | Include developers notes and internal API description into generated Documentation | OFF
63 *
64 * Here is the list of available important targets for the `make(1)` tool:
65 *
66 * Target | Description
67 * -------|------------------------------------------------------------------------------------------------------------
68 * all | Default target, builds libyang library (.so), `yanglint(1)` and `yangre(1)`.
69 * clean | Removes files generated by the make process.
70 * cclean | Extends the `clean` target by removing all the cmake generated files.
71 * doc | Generate HTML documentation. Requires `doxygen(1)`.
72 *
73 * @subsection buildTypesDebug Debug
74 *
75 * `Debug` is the default build type, the produced binaries include additional debug information and the prepared tests are
76 * also built. The compiler flags are set as follows:
77 *
78 * -Wall -Wextra -Wno-missing-field-initializers -std=c99 -g3 -O0
79 *
80 * Here is the list of the selected additional options available in the *Debug* build type.
81 *
82 * Option | Description | Default
83 * ----------------------|------------------------------------------------------------------------------------|--------
84 * ENABLE_BUILD_TESTS | Build tests. | ON
85 * ENABLE_VALGRIND_TESTS | Build tests with valgrind. | ON
86 * ENABLE_COVERAGE | Build code coverage report from tests. | OFF
87 * ENABLE_FUZZ_TARGETS | Build target programs suitable for fuzzing with AFL. | OFF
88 * ENABLE_STATIC | Build static (.a) library | OFF
89 * INTERNAL_DOCS | Include developers notes and internal API description into generated Documentation | OFF
90 *
91 * Here is the list of available important targets for the `make(1)` tool:
92 *
93 * Target | Description
94 * -------------|------------------------------------------------------------------------------------------------------
95 * all | Default target, builds libyang library (.so), `yanglint(1)` and `yangre(1)`.
96 * clean | Removes files generated by the make process.
97 * cclean | Extends the `clean` target by removing all the cmake generated files.
98 * doc | Generate HTML documentation. Requires `doxygen(1)`.
99 * test | Run implementation tests. Requires `cmocka` (and `valgrind(1)` for part of the tests).
100 * format | Reformat source codes using `uncrustify(1)`.
101 * format-check | Dry-run of the `format` target.
102 *
103 * @subsection buildTypesABICheck ABICheck
104 *
105 * Special build type to perform check of the ABI/API compatibility and generate reports. In addition to the basic
106 * requirements, the build type requires some of the <a href="https://abi-laboratory.pro/">ABI Laboratory tools</a>:
107 * `abi-dumper(1)` and `abi-compliance-checker(1)`.
108 *
109 * The compiler flags are set as follows:
110 *
111 * -Wall -Wextra -Wno-missing-field-initializers -std=c99 -g -Og
112 *
113 * All the additional options are switched OFF and the settings should not be changed.
114 *
115 * Here is the list of available important targets for the `make(1)` tool:
116 *
117 * Target | Description
118 * -------------|------------------------------------------------------------------------------------------------------
119 * all | Default target, builds libyang library (.so), `yanglint(1)` and `yangre(1)`.
120 * clean | Removes files generated by the make process.
121 * cclean | Extends the `clean` target by removing all the cmake generated files.
122 * doc | Generate HTML documentation. Requires `doxygen(1)`.
123 * abi-check | Check the backward compatibility of the API/ABI changes. Requires `abi-compliance-checker(1)` and `abi-dump(1)`.
124 * abi-dump | Helper target for `abi-check` generating API/ABI reports. Requires `abi-dump(1)`.
125
126 * @subsection buildTypesDocOnly DocOnly
127 *
128 * Special build type to avoid any requirements except those for building documentation. There are no compiler flags set
129 * since the build type does not allow building any binary output. The settings of the additional options should not be
130 * changed.
131 *
132 * Here is the list of available important targets for the `make(1)` tool:
133 *
134 * Target | Description
135 * -------------|------------------------------------------------------------------------------------------------------
136 * all | Default target, does nothing.
137 * doc | Generate HTML documentation. Requires `doxygen(1)`.
138 *
139 */