2021-09-29 22:43:50 +00:00
Here's how you can install Crow on your favorite GNU/Linux distro.
2021-11-06 08:54:29 +00:00
## Getting Crow
2021-09-29 22:43:50 +00:00
2021-11-06 08:54:29 +00:00
### Requirements
2021-09-29 22:43:50 +00:00
- C++ compiler with at least C++11 support.
- boost library & development headers (1.64 or later).
- **(optional)** ZLib for HTTP Compression.
- **(optional)** OpenSSL for HTTPS support.
- **(optional)** CMake and Python3 to build tests and/or examples.
!!!note
Crow's CI uses `g++-9.3` and `clang-7.0` running on AMD64 (x86_64) and ARM64v8 architectures.
< br > < br >
2021-11-06 08:54:29 +00:00
### Using a package Manager
2021-09-29 22:43:50 +00:00
You can install Crow on GNU/Linux as a pre-made package
=== "Debian/Ubuntu"
Simply download Crow's `.deb` file from the [release section ](https://github.com/CrowCpp/Crow/releases/latest ) and Install it.
=== "Arch"
2021-09-30 10:27:44 +00:00
Crow is available for Arch based distros through the AUR package `crow` .
2021-09-29 22:43:50 +00:00
< br > < br >
2021-11-06 08:54:29 +00:00
### Release package
2021-09-29 22:43:50 +00:00
Crow provides an archive containing the framework and CMake files, just copy the `include` folder to `/usr/local/include` and `lib` folder to `/usr/local/lib` .< br >< br >
You can also download the `crow_all.h` file and simply include that into your project.
< br > < br >
2021-11-06 08:54:29 +00:00
### Installing from source
#### Using CMake
2022-03-23 22:55:46 +00:00
1. Download Crow's source code (Either through Github's UI or by using< br > `git clone https://github.com/CrowCpp/Crow.git` ).
2021-09-29 22:43:50 +00:00
2. Run `mkdir build` inside of crow's source directory.
3. Navigate to the new "build" directory and run the following:< br >
`cmake .. -DCROW_BUILD_EXAMPLES=OFF -DCROW_BUILD_TESTS=OFF`
4. Run `make install` .
2022-03-23 22:55:46 +00:00
!!! note
2021-09-29 22:43:50 +00:00
You can ignore `-DCROW_BUILD_EXAMPLES=OFF -DCROW_BUILD_TESTS=OFF` if you want to build the Examples and Unit Tests.
2022-03-23 22:55:46 +00:00
!!! note
You can uninstall Crow at a later time using `make uninstall` .
2021-09-29 22:43:50 +00:00
< br >
2021-11-06 08:54:29 +00:00
#### Manually
2021-09-29 22:43:50 +00:00
Crow can be installed manually on your Linux computer.
2021-11-06 08:54:29 +00:00
##### Multiple header files
2021-09-29 22:43:50 +00:00
=== "Project Only"
Copy Crow's `include` directory to your project's `include` directory.
=== "System wide"
Copy Crow's `include` directory to the `/usr/local/include` directory.
2021-11-06 08:54:29 +00:00
##### Single header (crow_all.h)
2022-03-23 22:55:46 +00:00
!!! warning
2021-09-29 22:43:50 +00:00
`crow_all.h` is recommended only for small, possibly single source file projects, and ideally should not be installed on your system.
2022-03-23 22:55:46 +00:00
2021-09-29 22:43:50 +00:00
navigate to the `scripts` directory and run `./merge_all.py ../include crow_all.h` . This will generate a `crow_all.h` file that you can use in your projects.
2022-03-23 22:55:46 +00:00
!!! note
2021-09-29 22:43:50 +00:00
You can also include or exclude middlewares from your `crow_all.h` by using `-i` or `-e` followed by the middleware header file names separated by a comma (e.g. `merge_all.py ../include crow_all.h -e cookie_parser` to exclude the cookie parser middleware).
2022-03-23 22:55:46 +00:00
2021-11-06 08:54:29 +00:00
## Compiling your project
### Using CMake
2021-09-29 22:43:50 +00:00
In order to get your CMake project to work with Crow, all you need are the following lines in your CMakeLists.txt:
```
find_package(Crow)
target_link_libraries(your_project PUBLIC Crow::Crow)
```
From there CMake should handle compiling and linking your project.
2021-11-06 08:54:29 +00:00
### Directly using a compiler
2021-09-29 22:43:50 +00:00
All you need to do is run the following command:
```
g++ main.cpp -lpthread
```
You can use arguments like `-DCROW_ENABLE_DEBUG` , `-DCROW_ENABLE_COMPRESSION -lz` for HTTP Compression, or `-DCROW_ENABLE_SSL -lssl` for HTTPS support, or even replace g++ with clang++.
2022-03-23 22:55:46 +00:00
!!! warning
2021-09-29 22:43:50 +00:00
If you're using a version of boost prior to 1.69, you'll need to add the argument `-lboost_system` in order for you Crow application to compile correctly.