From 618a6bdc732164c67d652d14834a3376ba9f900c Mon Sep 17 00:00:00 2001 From: Archie Jaskowicz Date: Thu, 28 Mar 2024 16:48:39 +0000 Subject: [PATCH] docs: renamed and moved clion-vcpkg to building_a_bot --- docpages/03_installing.md | 1 - docpages/04_building_a_bot.md | 1 + .../install/install-windows-clion-vcpkg.md | 62 ------------------- docpages/make_a_bot/clion_windows.md | 42 +++++++++++++ 4 files changed, 43 insertions(+), 63 deletions(-) delete mode 100644 docpages/install/install-windows-clion-vcpkg.md create mode 100644 docpages/make_a_bot/clion_windows.md diff --git a/docpages/03_installing.md b/docpages/03_installing.md index 210d17afeb..dc3e42d9d4 100644 --- a/docpages/03_installing.md +++ b/docpages/03_installing.md @@ -7,7 +7,6 @@ There are many ways to install D++, either from a package manager, or from sourc * \subpage install-vcpkg * \subpage install-arch-aur * \subpage install-windows-vs-zip -* \subpage install-windows-clion-vcpkg * \subpage install-xmake * \subpage install-brew * \subpage install-from-source diff --git a/docpages/04_building_a_bot.md b/docpages/04_building_a_bot.md index ba55d6e50a..41cfe43247 100644 --- a/docpages/04_building_a_bot.md +++ b/docpages/04_building_a_bot.md @@ -7,6 +7,7 @@ Click on a link below for a guide specifically for your system: * \subpage creating-a-bot-application * \subpage build-a-discord-bot-windows-visual-studio * \subpage build-a-discord-bot-windows-wsl +* \subpage install-windows-clion-vcpkg * \subpage build-a-discord-bot-linux-clion * \subpage buildcmake * \subpage buildmeson diff --git a/docpages/install/install-windows-clion-vcpkg.md b/docpages/install/install-windows-clion-vcpkg.md deleted file mode 100644 index 4cb2991197..0000000000 --- a/docpages/install/install-windows-clion-vcpkg.md +++ /dev/null @@ -1,62 +0,0 @@ -\page install-windows-clion-vcpkg Installing D++ for CLion via VCPKG (Windows) - -\warning This page is for **Windows only**. If you want to use CLion on Linux, look to use \ref build-a-discord-bot-linux-clion "this page". Like always with windows, we highly recommends you use the [pre-made Visual Studio template](https://github.com/brainboxdotcc/windows-bot-template/) - -## Changing Toolchains - -\note If you have already configured your toolchain to use anything **but** MinGW64, then you can skip to the next section. Otherwise, it is **critical** that you follow along with this section. It should also be noted that you **need** Visual Studio for this. - -Head on over to `File > Settings` (Ctrl+Alt+S), then navigate to `Build, Execution, Deployment > Toolchains`. - -If there is a Visual Studio toolchain there, drag it to the top of the list. This will make the Visual Studio toolchain the default toolchain. - -\image html clionvstoolchain.png - -If you don't have the Visual Studio toolchain, you can hit the plus symbol above the list of toolchains and add a toolchain. This is also how you can add WSL as a toolchain! - -\image html clionvstoolchain2.png - -From there, you need to drag it to the top (if it didn't already add at the top) to ensure it's the default toolchain. - -## VCPKG setup - -1. Build [VCPKG](https://vcpkg.io/) on your system (skip if you already have it). -2. Run `vcpkg install dpp:x64-windows`. -3. VCPKG will install the library along with the dependencies for you. Note, this can take a while and may eat up your system's resources. -4. Now, check if D++ has been installed using `vcpkg list dpp`. -```cmd -C:/vcpkg>vcpkg list dpp -dpp:x64-windows 10.0.29 D++ Extremely Lightweight C++ Discord Library. -``` - -## Using VCPKG with CLion - -1. To use vcpkg in CLion, add the following line to your CMake options in the settings (Located under `Settings > Build, Execution, Deployment > CMake`) -```cmd --DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_root_folder/scripts/buildsystems/vcpkg.cmake -``` - For example, if your root folder is `C:/vcpkg/` then the CMake option will be: -```cmd --DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -``` - -2. Now proceed to add the following lines to your `CMakeLists.txt`: -```cmake -find_package(dpp CONFIG REQUIRED) -target_link_libraries(main PRIVATE dpp::dpp) -target_include_directories(main PRIVATE path_to_vcpkg_root_folder/installed/architecture-os/include) -``` - For example, if your VCPKG root is `C:/vcpkg/`, then your `CMakeLists.txt` should look like this: -```cmake -find_package(dpp CONFIG REQUIRED) -target_link_libraries(main PRIVATE dpp::dpp) -target_include_directories(main PRIVATE C:/vcpkg/installed/x64-windows/include) -``` - -3. Congratulations! Now try to build a test program to see if the installation succeeded. - -If you get stuck somewhere, feel free to ask us on the D++ [discord server](https://discord.gg/dpp). - -## Troubleshooting - -If you see a message like `Detecting C compiler ABI info - failed` or something along the lines of `"cl.exe" is not able to compile a simple test program`, then try to reinstall `Windows Build Tools` along with the `Windows SDK` from the Visual Studio Installer. diff --git a/docpages/make_a_bot/clion_windows.md b/docpages/make_a_bot/clion_windows.md new file mode 100644 index 0000000000..051f3dfb8e --- /dev/null +++ b/docpages/make_a_bot/clion_windows.md @@ -0,0 +1,42 @@ +\page install-windows-clion-vcpkg Building a Discord Bot using CLion & VCPKG (Windows) + +\warning This page is for **Windows only**. If you want to use CLion on Linux, look to use \ref build-a-discord-bot-linux-clion "this page". Like always with windows, we highly recommends you use the [pre-made Visual Studio template](https://github.com/brainboxdotcc/windows-bot-template/). This tutorial also assumes you have installed D++ via VCPKG already. If you haven't, look at \ref install-vcpkg "this page". + +### Changing Toolchains + +\note If you have already configured your toolchain to use anything **but** MinGW64, then you can skip to the next section. Otherwise, it is **critical** that you follow along with this section. It should also be noted that you **need** Visual Studio for this. + +Head on over to `File > Settings` (Ctrl+Alt+S), then navigate to `Build, Execution, Deployment > Toolchains`. + +If there is a Visual Studio toolchain there, drag it to the top of the list. This will make the Visual Studio toolchain the default toolchain. + +\image html clionvstoolchain.png + +If you don't have the Visual Studio toolchain, you can hit the plus symbol above the list of toolchains and add a toolchain. This is also how you can add WSL as a toolchain! + +\image html clionvstoolchain2.png + +From there, you need to drag it to the top (if it didn't already add at the top) to ensure it's the default toolchain. + +### Using VCPKG with CLion + +To use vcpkg in CLion, add the following line to your CMake options in the settings (Located under `Settings > Build, Execution, Deployment > CMake`) +```cmd +-DCMAKE_TOOLCHAIN_FILE=path_to_vcpkg_root_folder/scripts/buildsystems/vcpkg.cmake +``` +For example, if your root folder is `C:/vcpkg/` then the CMake option will be: +```cmd +-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake +``` + +### Making a test application. + +Open your `main.cpp` file and then copy and paste the following \ref firstbot "example program" in. Then, set your bot token (see \ref creating-a-bot-application). Here's how your `main.cpp` file should look: + +\include{cpp} firstbot.cpp + +If everything went well, you should now have a functioning bot! If not, feel free to ask us on the D++ [discord server](https://discord.gg/dpp). + +### Troubleshooting + +If you see a message like `Detecting C compiler ABI info - failed` or something along the lines of `"cl.exe" is not able to compile a simple test program`, then try to reinstall `Windows Build Tools` along with the `Windows SDK` from the Visual Studio Installer.