Debian Codegraph @

docpages/building/linux.md

raw symbols SCIP
1 \page buildlinux Building on Linux
2
3 \note You might not need to build a copy of the library for Linux - precompiled deb files for 64 bit and 32 bit Debian and Ubuntu are provided in the GitHub version releases. Unless you are on a different Linux distribution which does not support the installation of deb files, or wish to submit fixes and enhancements to the library itself you should have an easier time installing the precompiled version instead.
4
5 ## 1. Build Source Code
6
7 ```bash
8 cmake -B ./build
9 cmake --build ./build -j8
10 ```
11
12 Replace the number after `-j` with a number suitable for your setup, usually the same as the number of cores on your machine. `cmake` will fetch any dependencies that are required for you and ensure they are compiled alongside the library.
13
14 ## 2. Install to /usr/local/include and /usr/local/lib
15
16 ```bash
17 cd build
18 sudo make install
19 ```
20
21 ## 3. Installation to a Different Directory
22
23 If you want to install the library, its dependencies, and header files to a different directory, specify this directory when running `cmake`:
24
25 ```bash
26 cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install
27 ```
28
29 Then once the build is complete, run `make install` to install to the location you specified.
30
31 ## 4. Using the Library
32
33 Once installed to the `/usr/local` directory, you can make use of the library in standalone programs simply by including it and linking to it:
34
35 ```bash
36 g++ -std=c++20 mydppbot.cpp -o dppbot -ldpp
37 ```
38
39 The important flags in this command-line are:
40
41 * `-std=c++20` - Required to compile the headers
42 * `-ldpp` - Link to libdpp.so
43 * `mydppbot.cpp` - Your source code
44 * `dppbot` - The name of the executable to make
45
46 \include{doc} install_prebuilt_footer.dox
47
48 **Have fun!**