- CMake 3.20 or later
- C++20 compatible compiler (GCC 11+, Clang 14+, MSVC 2019+)
- Conan 2.0+
- Python 3.x (for Conan)
- Docker (for running InfluxDB tests locally)
pip install conanUsing scripts (recommended):
# Linux/macOS
./scripts/build.sh Release # or Debug
# Windows
scripts\build.bat Release # or DebugManual build:
mkdir build && cd build
conan install .. --build=missing --output-folder=.
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20
cmake --build . --config ReleaseThis installs dependencies:
- cpprestsdk (HTTP client library)
- catch2 (testing framework)
src/influxdb-cpp-rest/- Core C++ library (static library)src/influx-c-rest/- C wrapper API (shared library)src/demo/- Example applicationsrc/test/- C++ unit testssrc/test-shared/- C API unit testssrc/auth_test/- Authentication tests
Using scripts (recommended):
# Linux/macOS
./scripts/start-influxdb.sh
# Windows
scripts\start-influxdb.batUsing docker compose directly:
docker compose up -d # Linux/macOS
docker compose -f docker-compose.win.yml up -d # WindowsThis starts InfluxDB with:
- Database:
testdb - Admin user:
admin/admin123 - Test user:
testuser/testpass - Port:
8086
Using scripts:
# Linux/macOS
./scripts/test.sh
# Windows
scripts\test.batManual test execution:
cd build
# Linux/macOS
export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
./bin/test-influxdb-cpp-rest -d yes
./bin/test-influx-c-rest -d yes
./bin/test-influxdb-cpp-auth -d yesWindows:
set PATH=%CD%\bin\Release;%PATH%
bin\Release\test-influxdb-cpp-rest.exe -d yes
bin\Release\test-influx-c-rest.exe -d yes
bin\Release\test-influxdb-cpp-auth.exe -d yes# Linux/macOS
./scripts/stop-influxdb.sh
# Windows
scripts\stop-influxdb.batOr directly:
docker compose down # Linux/macOS
docker compose -f docker-compose.win.yml down # WindowsBUILD_TESTING(default: ON) - Build test executablesBUILD_DEMO(default: ON) - Build demo applicationUSE_CONAN(default: ON) - Use Conan for dependency management
Example:
cmake .. -DBUILD_TESTING=OFF -DBUILD_DEMO=OFF- Follow existing code style
- C++20 standard
- Use modern C++ features (smart pointers, ranges, concepts where applicable)
- cpprestsdk/2.10.19 - HTTP client library
- catch2/3.5.3 - Testing framework
- fmt/11.1.4 - Formatting library (C++20 compatible)
- fmt - Formatting library (in
deps/fmt/) - RxCpp - Reactive Extensions (in
deps/rxcpp/, header-only)
These bundled dependencies may be migrated to Conan in the future.
The package is published to Conan Center via pull requests to the conan-center-index repository. The recipe is maintained at recipes/influxdb-cpp-rest/ in that repository.
-
Clone your fork locally
-
Set upstream remote:
git remote add upstream https://github.com/conan-io/conan-center-index.git -
Create a GitHub Personal Access Token (PAT) with
reposcope:- Go to https://github.com/settings/tokens
- Generate a new token (classic) with
reposcope - Add it as a repository secret named
CONAN_INDEX_PATin your influxdb-cpp-rest repository- Go to Settings → Secrets and variables → Actions → New repository secret
- Name:
CONAN_INDEX_PAT - Value: your PAT token
Note: The workflow will use
GITHUB_TOKENifCONAN_INDEX_PATis not set, butGITHUB_TOKENcannot push to forks. A PAT is required for automated publishing.
Use the automated script (recommended):
./scripts/publish-conan-version.sh 1.0.0Or manually:
- Create a GitHub release/tag for the version (if not already exists)
- Navigate to conan-center-index repository:
cd ../conan-center-index # or wherever you cloned it git checkout master git pull upstream master
- Create version branch:
git checkout -b recipes/influxdb-cpp-rest/X.Y.Z
- Create recipe directory and files:
mkdir -p recipes/influxdb-cpp-rest/X.Y.Z # Copy conanfile.py template and adapt for conan-center-index format # Create conandata.yml with source URL and SHA256
- Commit and push:
git add recipes/influxdb-cpp-rest/X.Y.Z/ git commit -m "Add influxdb-cpp-rest/X.Y.Z" git push origin recipes/influxdb-cpp-rest/X.Y.Z - Create pull request:
gh pr create --repo conan-io/conan-center-index --title "Add influxdb-cpp-rest/X.Y.Z"
See Publishing New Versions section below for details.
When releasing a new version of influxdb-cpp-rest:
-
Create and push a Git tag (e.g.,
v1.0.0):./scripts/tag-version.sh patch # or major/minor git push --tags -
Automatic publishing: Pushing a tag starting with
v(e.g.,v1.0.0) automatically triggers the GitHub Actions workflow that:- Calculates the SHA256 hash of the source tarball
- Creates the recipe files in the correct format
- Commits and pushes to your conan-center-index fork
- Creates a pull request to conan-center-index
-
Monitor the PR: The Conan Center CI will automatically test the recipe. Address any review comments or CI failures.
If you need to publish manually or the automated workflow fails:
./scripts/publish-conan-version.sh 1.0.0This script will:
- Clone/update your conan-center-index fork if needed
- Calculate the SHA256 hash of the source tarball
- Create the recipe files in the correct format
- Commit and push the changes
- Create a pull request to conan-center-index
The recipe in conan-center-index differs from the local conanfile.py:
- No
versionfield - version comes from directory path source()method - downloads from GitHub release/tagconandata.yml- contains source URL and SHA256 checksum- No
exports_sources- source is downloaded, not exported
The automation script handles these differences automatically.
- Recipe follows Conan Center conventions
- All dependencies are declared in
requirements() - Test package included (optional but recommended)
- License file included
- Source code properly exported
- Compatible with major compilers (GCC, Clang, MSVC)
- Works on Linux, macOS, Windows
Before publishing, test the recipe locally:
# In your conan-center-index fork
cd recipes/influxdb-cpp-rest/1.0.0
conan create . influxdb-cpp-rest/1.0.0@- Recipe must be in conan-center-index repository
- Must pass automated CI checks
- All dependencies must also be in Conan Center
- License must be compatible with Conan Center
- Source code must be publicly accessible
- GitHub tag/release must exist for the version
Follow semantic versioning (semver):
- MAJOR.MINOR.PATCH (e.g., 1.2.3)
- Release candidates: MAJOR.MINOR.PATCH-rcN (e.g., 1.2.3-rc1)
Using the version tagging script:
# Preview changes without applying (dry-run)
./scripts/tag-version.sh major --dry-run
# Bump major version (e.g., 1.2.3 -> 2.0.0)
./scripts/tag-version.sh major
# Bump minor version (e.g., 1.2.3 -> 1.3.0)
./scripts/tag-version.sh minor
# Bump patch version (e.g., 1.2.3 -> 1.2.4)
./scripts/tag-version.sh patch
# Create/bump release candidate (e.g., 1.2.3 -> 1.2.3-rc1 or 1.2.3-rc1 -> 1.2.3-rc2)
./scripts/tag-version.sh rc
# Bump and create RC in one command (e.g., 1.2.3 -> 2.0.0-rc1)
./scripts/tag-version.sh major rc
./scripts/tag-version.sh minor rc
./scripts/tag-version.sh patch rc
# Release (remove -rc suffix, e.g., 1.2.3-rc2 -> 1.2.3)
./scripts/tag-version.sh releaseThe script:
- Updates version in
conanfile.pyandCMakeLists.txt - Creates a git tag
v{version} - Uses current version from conanfile.py or latest git tag
- Supports
--dry-runflag to preview changes without applying them
Pushing version tags:
# Preview what would be pushed (dry-run)
./scripts/push-latest-version.sh --dry-run
# Push latest version tag to origin
./scripts/push-latest-version.sh
# Push to specific remote
./scripts/push-latest-version.sh upstream
# Dry-run with specific remote
./scripts/push-latest-version.sh upstream --dry-run