To get drogon_ctl, one has to execute command "vcpkg install drogon[ctl]" for 32 bit "vcpkg install drogon[ctl]:x64-windows" for 64 bit
Better to update the document with this
This section takes Linux as an example to introduce the installation process. Other systems are similar;
std::filesystem
.sudo apt install git
sudo apt install gcc
sudo apt install g++
sudo apt install cmake
sudo apt install libjsoncpp-dev
sudo apt install uuid-dev
sudo apt install openssl
sudo apt install libssl-dev
sudo apt install zlib1g-dev
yum install git
yum install gcc
yum install gcc-c++
The default installed cmake version is too low, use source installation
git clone https://github.com/Kitware/CMake
cd CMake/
./bootstrap && make && make install
Upgrade gcc
yum install centos-release-scl
yum install devtoolset-8
scl enable devtoolset-8 bash
Note: Command scl enable devtoolset-8 bash
only activate the new gcc temporarily until the session is end. If you want to always use the new gcc, you could run command echo "scl enable devtoolset-8 bash" >> ~/.bash_profile
, system will automatically activate the new gcc after restarting.
git clone https://github.com/open-source-parsers/jsoncpp
cd jsoncpp/
mkdir build
cd build
cmake ..
make && make install
yum install libuuid-devel
yum install openssl-devel
yum install zlib-devel
Install Visual Studio 2019 professional 2019, at least included these options:
If python is installed on system, you could install conan package manager via pip, of course you can download the installation file from connan official website to install it also.
pip intall conan
conan package manager could provide all dependencies that Drogon projector needs。
Note: These libraries below are not mandatory. You could choose to install one or more database according to your actual needs.
Note: If you want to develop your webapp with database, please install the database develop environment first, then install drogon, otherwise you will encounter a NO DATABASE FOUND
issue.
PostgreSQL's native C library libpq needs to be installed. The installation is as follows:
ubuntu 16
: sudo apt-get install postgresql-server-dev-all
ubuntu 18
: sudo apt-get install postgresql-all
centOS 7
: yum install postgresql-devel
MacOS
: brew install postgresql
MySQL's native library does not support asynchronous read and write. Fortunately, MySQL also has a version of MariaDB maintained by the original developer community. This version is compatible with MySQL, and its development library supports asynchronous read and write. Therefore, Drogon uses the MariaDB development library to provide the right MySQL support, as a best practice,your operating system shouldn't install both Mysql and MariaDB at the same time.
MariaDB installation is as follows:
ubuntu
: sudo apt install libmariadbclient-dev
centOS 7
: yum install mariadb-devel
MacOS
: brew install mariadb
ubuntu
: sudo apt-get install libsqlite3-dev
centOS
: yum install sqlite-devel
MacOS
: brew install sqlite3
Note: Some of the above commands only install the development library. If you want to install a server also, please use Google search yourself.
Assuming that the above environment and library dependencies are all ready, the installation process is very simple;
cd $WORK_PATH
git clone https://github.com/an-tao/drogon
cd drogon
git submodule update --init
mkdir build
cd build
cmake ..
make && sudo make install
The default is to compile the debug version. If you want to compile the release version, the cmake command should take the following parameters:
cmake -DCMAKE_BUILD_TYPE=Release ..
After the installation is complete, the following files will be installed in the system(One can change the installation location with the CMAKE_INSTALL_PREFIX option):
After installed conan
package manager, run command in PowerShell for Visual studio as bellow:
cd $WORK_PATH
git clone https://github.com/an-tao/drogon
cd drogon
git submodule update --init
mkdir build
cd build
conan install .. -s compiler="Visual Studio" -s compiler.version=16 -s build_type=Debug -g cmake_paths
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=D:/ -DCMAKE_TOOLCHAIN_FILE=./conan_paths.cmake
cmake --build . --parallel --target install
Note: Must keep build type same in conan and cmake.
After the installation is complete, the following files will be installed in the system(One can change the installation location with the CMAKE_INSTALL_PREFIX option):
The easiest way to install drogon on windows is to use vcpkg
vcpkg.exe install drogon
Or
vcpkg.exe install drogon:x64-windows
if you haven't install vcpkg:
Assuming that you don't have cmake.exe
, make.exe
and vcpkg.exe
Make it sure you're already install git
for windows too
First, go to where you want to install vcpkg
.
C:/Dev
directory.cd c:/
mkdir Dev;cd Dev;
mean you will create dev and go to dev directorygit clone https://github.com/microsoft/vcpkg
cd vcpkg
./bootstrap-vcpkg.bat
this will install vcpkg.exe
note: to update your vcpkg, you just need to type git pull
to make it sure that vcpkg directory always able to access:
C:/dev/vpckg
to your windows environment variables.Now check if vcpkg already installed properly, just type vcpkg
or vcpkg.exe
To install drogon framework. Type:
vcpkg install drogon
vcpkg install drogon:x64-windows
vcpkg install zlib
or vcpkg install zlib:x64-windows
for 64-Bitvcpkg list
vcpkg install drogon[ctl]
for 32 bit or vcpkg install drogon[ctl]:x64-windows
for 64 bit. Please run vcpkg search drogon
for more feature option details.To add drogon_ctl command and dependencies, you need to add some variables. By following this guide, you just need to add:
C:\Dev\vcpkg\installed\x64-windows\tools\drogon
C:\Dev\vcpkg\installed\x64-windows\bin
C:\Dev\vcpkg\installed\x64-windows\lib
C:\Dev\vcpkg\installed\x64-windows\include
to your windows environment variables.
reload/re-open your powershell, then type:
drogon_ctl
or drogon_ctl.exe
usage: drogon_ctl [-v | --version] [-h | --help] <command> [<args>]
commands list:
create create some source files(Use 'drogon_ctl help create' for more information)
help display this message
press Do stress testing(Use 'drogon_ctl help press' for more information)
version display version of this tool
showed up, you are good to go.
Note:
gcc
or g++
We also provide a pre-build docker image on the docker hub. All dependencies of Drogon and Drogon itself are already installed in the docker environment, where users can build Drogon-based applications directly.
There is a Nix package for Drogon which was released in version 21.11.
You can use the package by adding the following shell.nix
to your project root:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
cmake
];
buildInputs = with pkgs; [
drogon
];
}
Enter the shell by running nix-shell
. This will install Drogon and enter you into an environment with all its dependencies.
The Nix package has a few options which you can configure according to your needs:
option | default value |
---|---|
sqliteSupport | true |
postgresSupport | false |
redisSupport | false |
mysqlSupport | false |
Here is an example of how you can change their values:
buildInputs = with pkgs; [
(drogon.override {
sqliteSupport = false;
})
];
if you haven't installed Nix: You can follow the instructions on the NixOS website.
Of course, you can also include the drogon source in your project. Suppose you put the drogon under the third_party of your project directory (don't forget to update submodule in the drogon source directory). Then, you only need to add the following two lines to your project's cmake file:
add_subdirectory(third_party/drogon)
target_link_libraries(${PROJECT_NAME} PRIVATE drogon)
To get drogon_ctl, one has to execute command "vcpkg install drogon[ctl]" for 32 bit "vcpkg install drogon[ctl]:x64-windows" for 64 bit
Better to update the document with this
I also got dificulty with compiling on windows.
drogon/DrClassMap.h:120: undefined reference to `trantor::Logger::stream()
vcpkg install libpq:x64-windows Install the driver for postgresql "vcpkg install libpq:x64-windows", I haven't been able to run the app for a while :( FATAL No database is supported by drogon, please install the database development library first. please help
i installed drogon library using vcpkg on windows successfully, but once installed i couldnt find the command line tool ( drogon_ctl ), i tried to re install but there it is still not found.
Try a flavor of *nix.
Hello Sir, I am a Windows user and failed to find a solution for the installation of Drogon on windows on this page. Hope you'll help me to find out a solution. regards.