NvDialog 0.10.1
A cross-platform modal dialogs library for C/C++ that uses the native OS theme.
Loading...
Searching...
No Matches
nvdialog_build.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2025 Aggelos Tselios
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25/************************************************************************************
26 * This file is NOT source code. It will just be used by Doxygen when
27 * generating documentation for the "Building NvDialog" page. It won't be
28 * installed, it won't be used within the library or by a user, and probably
29 * isn't of interest to anyone.
30 ************************************************************************************/
31
32/**
33 * @page building BuildingNvDialog
34 * @version v0.10.0
35 * @author Aggelos Tselios
36 *
37 * # Building NvDialog
38 * This document will provide you with all the necessary information /
39 * documentation to build NvDialog on your machine. These steps have been
40 * verified to work on all supported platforms, thanks to usage of
41 * cross-platform tools.
42 *
43 * You can also download prebuilt binaries of NvDialog at the [releases
44 * page](https://github.com/tseli0s/nvdialog/releases/). This can be useful if
45 * you are looking to package NvDialog with your application without extra compilation.
46 *
47 * ## Dependencies
48 * Before proceeding, download and install the following:
49 * - [CMake](https://cmake.org)
50 * - [ninja](https://ninja-build.org/)
51 * - A C compiler (e.g. gcc or clang)
52 * - If you want to generate the documentation locally:
53 * [doxygen](https://doxygen.nl)
54 *
55 * ## 1. Downloading the source code.
56 * Before continuing, you must acquire the source code somehow. How you will do
57 * that depends on what version you want to use:
58 * - The git development version is the one where all the development goes. You
59 * should avoid it unless you want early access to new features, since many things may stay broken there for
60 * some time
61 * - The releases provide you with the source code of each release. They're
62 * recommended for stability and future-proofness, as the final releases usually work
63 * with older versions.
64 * - Optionally, you can also download a specific branch if you're looking for
65 * an unfinished feature.
66 *
67 * Each one will be explained below seperately:
68 *
69 * ### Git
70 * Open a terminal, and `cd` to the directory you want to store the source code.
71 * Then type the following two commands:
72 * ```sh
73 * $ git clone --recursive --depth=1 https://github.com/tseli0s/nvdialog.git
74 * $ cd nvdialog/
75 * ```
76 *
77 * > You can also have NvDialog as a submodule. Just use `git submodule add
78 * https://github.com/tseli0s/nvdialog.git` in your source code tree.
79 *
80 * ## Releases
81 * Go to https://github.com/tseli0s/nvdialog/releases/latest and download the
82 * source code as a zip file. Extract the archive where you want to store the
83 * source code.
84 *
85 * ## Specific git branch
86 * Same as the git one, but you must change the second command to this:
87 * ```sh
88 * git clone --branch <branchname> --recursive
89 * https://github.com/tseli0s/nvdialog.git
90 * ```
91 *
92 * ## 2. Building
93 * Go to the directory the source code is located. You must have files like
94 * `CMakeLists.txt`, `Makefile`, `CHANGELOG.md` and others. > Don't confuse the
95 * said directory with the directory named `src/`. Source code in this case
96 * means the entire NvDialog folder.
97 *
98 * Then, generate the build files, necessary to build the source code:
99 * ```sh
100 * $ cmake . -B build/ -G "Ninja" -DCMAKE_BUILD_TYPE=Release
101 * ```
102 *
103 * > You can optionally tweak NvDialog's default settings using the
104 * `-D<var>=<value>` CMake flag.
105 *
106 * Finally, building the source code is relatively simple:
107 * ```sh
108 * ninja
109 * ```
110 * The build takes at most 1 minute.
111 *
112 * If you want to install NvDialog on your computer (You probably do), then run
113 * this command as well:
114 *
115 * ```sh
116 * $ sudo ninja install # sudo may be omitted on Windows and macOS
117 * ```
118 *
119 * ## Older distros
120 * For older Linux distros that don't have a recent enough version of CMake,
121 * there's a `Makefile` provided. You can just run `make && sudo make install`
122 * and it should do the exact same thing. The downside is that the Makefile
123 * doesn't support any options - You will have to modify it manually to tweak
124 * any build time functionality.
125 *
126 * ## Compile-time features:
127 * This is a table of features that NvDialog supports enabling at compile time.
128 * You can enable features (Or set them appropriately) using the
129 * `-D<feature>=<value>` cmake flag. | Feature | Default | Description | | --- |
130 * --- | --- | | NVD_USE_GTK4 | OFF | Sets the Linux backend to use `libadwaita`
131 * | | CROSS_COMPILE_FOR_WIN32 | OFF | Cross compile from a Unix system for a
132 * Windows host | | NVDIALOG_MAXBUF | 4096 | Amount of bytes NvDialog will
133 * allocate by default on static buffers | | NVD_BUILD_STATIC | OFF | Build
134 * NvDialog as a static library instead, that will be packaged with your
135 * executable |
136 */