Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson instructions to docs. #541

Merged
merged 6 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docpages/02_building_a_bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Click on a link below for a guide specifically for your system:
* \subpage build-a-discord-bot-windows-wsl "Building a discord bot in Windows using WSL (Windows Subsystem for Linux)"
* \subpage build-a-discord-bot-linux-clion "Building a discord bot in Linux using CLion"
* \subpage buildcmake "Building a Discord Bot using CMake/UNIX"
* \subpage buildmeson "Building a Discord Bot using Meson"
* \subpage building-a-cpp-discord-bot-in-repl "Creating a Discord bot in Repl.it"

Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ int main(int argc, char const *argv[])
/* Add a text component */
modal.add_component(
dpp::component().
set_label("Type rammel").
set_label("Short type rammel").
set_id("field_id").
set_type(dpp::cot_text).
set_placeholder("gumd").
set_min_length(5).
set_max_length(50).
set_text_style(dpp::text_short)
);
/* Add another text component in the next row, as required by Discord */
modal.add_row();
modal.add_component(
dpp::component().
set_label("Type rammel").
set_id("field_id2").
set_type(dpp::cot_text).
set_placeholder("gumf").
set_min_length(1).
set_max_length(2000).
Expand Down
57 changes: 57 additions & 0 deletions docpages/make_a_bot/meson.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
\page buildmeson Build a Discord Bot using Meson

## 1. Toolchain

Before compiling, you will need to install `meson` on your system.
To be sure that `meson` is installed, you can type the following command:

$ meson --version
0.63.2

## 2. Create a Meson project

In an empty directory.

- your project/

run the command

$ meson init -l cpp

## 3. Configuring your Meson project

add the following line after the project() line in your meson.build file.

dpp = dependency('dpp')

add the following line in the executable section of your meson.build file.

dependencies: [dpp]

change the cpp_std value in the project() to c++17

your meson.build should look like this.
~~~~~~~~~~~~~~
project('discord-bot', 'cpp',
version : '0.1',
default_options : ['warning_level=3',
'cpp_std=c++14'])

dpp = dependency('dpp')


exe = executable('discord', 'discord_bot.cpp',
install : true, dependencies: [dpp])

test('basic', exe)

~~~~~~~~~~~~~~

Meson automatically generates a cpp for your project. And a test suite.

## 4. Building

To build a meson project run

$ meson setup builddir
$ meson compile -C builddir