87 lines
2.1 KiB
Markdown
87 lines
2.1 KiB
Markdown
# Dropshell Build
|
|
|
|
A Docker-based build system for creating statically-linked C++ executables using Alpine Linux and musl libc.
|
|
|
|
## Overview
|
|
|
|
This repository provides a comprehensive C++ development environment with:
|
|
|
|
1. **dropshell-build-base**: A base image with C++ toolchain and libraries
|
|
2. **dropshell-build**: Multi-stage Docker build system for C++ projects
|
|
3. **Test projects**: Sample applications demonstrating the build system
|
|
|
|
## Features
|
|
|
|
### Libraries Available
|
|
|
|
The base image includes statically-linked versions of:
|
|
|
|
- **Web Framework**: Drogon with async HTTP capabilities
|
|
- **Database Support**: PostgreSQL (libpq), MySQL/MariaDB, SQLite3
|
|
- **HTTP Clients**:
|
|
- Custom Drogon-based HTTP utilities (see `ipdemo`)
|
|
- CPR (C++ Requests) library for simplified HTTP requests
|
|
- **Networking**: cURL, c-ares, OpenSSL
|
|
- **JSON**: nlohmann/json, jsoncpp
|
|
- **Compression**: zlib, zstd, lzma
|
|
- **Logging**: spdlog, fmt
|
|
- **Utilities**: ccache, mold linker
|
|
|
|
### HTTP Client Options
|
|
|
|
Two HTTP client approaches are available:
|
|
|
|
1. **Drogon HTTP Utilities** (see `tests/ipdemo/src/http_utils.hpp`):
|
|
```cpp
|
|
auto response = http_get("example.com", "/api/endpoint", true, 10.0);
|
|
if (response.success && response.status_code == 200) {
|
|
std::cout << response.body << std::endl;
|
|
}
|
|
```
|
|
|
|
2. **CPR Library** (C++ Requests):
|
|
```cpp
|
|
#include <cpr/cpr.h>
|
|
cpr::Response r = cpr::Get(cpr::Url{"https://example.com/api"});
|
|
if (r.status_code == 200) {
|
|
std::cout << r.text << std::endl;
|
|
}
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
### Building the Base Image
|
|
|
|
```bash
|
|
cd build-base
|
|
./build.sh
|
|
```
|
|
|
|
### Building a Project
|
|
|
|
```bash
|
|
./build.sh
|
|
```
|
|
|
|
### Testing
|
|
|
|
```bash
|
|
./test.sh
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
### Test Projects
|
|
|
|
- **ipdemo**: Demonstrates Drogon HTTP utilities and JSON processing
|
|
- **test_libs**: Tests all available libraries (fmt, spdlog, SQLite3, etc.)
|
|
- **cprdemo**: Example using CPR library for HTTP requests
|
|
|
|
### Environment Variables
|
|
|
|
- `CMAKE_BUILD_TYPE`: "Debug" or "Release" (default: Debug)
|
|
- `PROJECT`: Project name to build (default: ipdemo)
|
|
|
|
## Installation
|
|
|