Skip to content

Commit

Permalink
docs: added build from source for arch linux
Browse files Browse the repository at this point in the history
  • Loading branch information
BIGBEASTISHANK committed Nov 26, 2023
1 parent 418602c commit fee2dbc
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
53 changes: 53 additions & 0 deletions docpages/building/archlinux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
\page build-archlinux Building on Arch Linux

\note You might not have to build library from source on arch, you can install directly from AUR repo, See the guide [here](/install-arch-aur.html).

## 1. Copy Source code
```bash
git clone https://github.com/brainboxdotcc/DPP
cd DPP/
```

```bash
cmake -B ./build -DCMAKE_INSTALL_PREFIX=/usr/
cmake --build ./build -j8
```

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.

## 2. Install to /usr/include and /usr/lib

```bash
cd build
sudo make install
```

## 3. Installation to a Different Directory

If you want to install the library, its dependencies, and header files to a different directory, specify this directory when running `cmake`:

```bash
cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install
```

Then once the build is complete, run `make install` to install to the location you specified.

\note If you have installed `g++` and not made any changes in enviorment variable related to the path of system headers then you should install in `/usr/` because it is the default system header location on arch.

## 4. Using the Library

Once installed to the `/usr/` directory, you can make use of the library in standalone programs simply by including it and linking to it:

```bash
g++ mydppbot.cpp -o dppbot -ldpp
```

The important flags in this command-line are:

* `-ldpp` - Link to libdpp.so
* `mydppbot.cpp` - Your source code
* `dppbot` - The name of the executable to make

\include{doc} install_prebuilt_footer.dox

**Have fun!**
2 changes: 1 addition & 1 deletion docpages/example_programs/the_basics/firstbot.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The `event.reply` function (dpp::slashcommand_t::reply) replies to a slash comma
To make the bot start, we must call the dpp::cluster::start method, e.g. in our program by using `bot.start(dpp::st_wait)`.
We also add a line to tell the library to output all its log information to the console, `bot.on_log(dpp::utility::cout_logger());` - if you wanted to do something more advanced, you can replace this parameter with a lambda just like all other events.
We also add a line to tell the library to output all its log information to the console, use `bot.on_log(dpp::utility::cout_logger());` (dpp::utility::cout_logger) - if you wanted to do something more advanced, you can replace this parameter with a lambda just like all other events.
The parameter which we set to false indicates if the function should return once all shards are created. Passing dpp::st_wait here tells the program you do not need to do anything once `bot.start` is called.
Expand Down
2 changes: 2 additions & 0 deletions docpages/install/install-arch-aur.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ or use your favourite package manager:
yay -Sy dpp
```

\note If the package is outdated try installing `dpp-git` or build it from [source](/buildarchlinux.html).

This will do the following three things:

- Clone the D++ AUR repository to a directory called `dpp`
Expand Down

0 comments on commit fee2dbc

Please sign in to comment.