Debian Codegraph @

docpages/building/freebsd.md

raw symbols SCIP
1 \page buildfreebsd Building on FreeBSD
2
3 \note This page assumes you are the root user. If you are not, start the package install commands with `sudo`, along with `make install`. You will need `sudo` installed if you are not the root user.
4
5 ## 1. Toolchain
6
7 Since the project uses `CMake`, you'll need to install it! If you don't have it, you can do the following:
8
9 ```bash
10 pkg install cmake
11 ```
12
13 ## 2. Install Voice Dependencies (Optional)
14
15 If you wish to use voice support, you'll need to install opus:
16
17 ```bash
18 cd /usr/ports/audio/opus
19 make && make install
20 ```
21
22 ## 3. Build Source Code
23
24 ```bash
25 cmake -B ./build
26 cmake --build ./build -j8
27 ```
28
29 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.
30
31 ## 4. Install Globally
32
33 ```bash
34 cd build
35 make install
36 ```
37
38 ## 5. Installation to a Different Directory (Optional)
39
40 If you want to install the library, its dependencies and header files to a different directory, specify this directory when running `cmake`:
41
42 ```bash
43 cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install
44 ```
45
46 Then once the build is complete, run `sudo make install` to install to the location you specified.
47
48 ## 6. Using the Library
49
50 Once installed, you can make use of the library in standalone programs simply by including it and linking to it:
51
52 ```bash
53 clang++ -std=c++20 -L/usr/local/lib -I/usr/local/include -ldpp bot.cpp -o dppbot
54 ```
55
56 The important flags in this command-line are:
57
58 * `-std=c++20` - Required to compile the headers
59 * `-L/usr/local/lib` - Required to tell the linker where libdpp is located.
60 * `-I/usr/local/include` - Required to tell the linker where dpp headers are located.
61 * `-ldpp` - Link to `libdpp.so`.
62 * `bot.cpp` - Your source code.
63 * `-o dppbot` - The name of the executable to make.
64
65 \include{doc} install_prebuilt_footer.dox
66
67 **Have fun!**