Compare commits
53 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d5c87e871 | ||
| 5da1065df9 | |||
| 66e4263136 | |||
| 9a08bfce0e | |||
| 0fb180fa96 | |||
| 7627ff1bc5 | |||
| 435a8f03f7 | |||
| df4b9440b1 | |||
| 16ef883aa0 | |||
| e4ac49304f | |||
| a20a575647 | |||
| 3b8a03dd08 | |||
| 8b4f166926 | |||
| 4bbf42483f | |||
| 08b9208f56 | |||
|
|
b400c827cc | ||
|
|
40726e43f1 | ||
|
|
3efe81cc29 | ||
|
|
6b86f09909 | ||
| a4463bb093 | |||
| cc085dc1c3 | |||
| 4ef1324e2c | |||
| 04c8a9b5b6 | |||
| 76521b0d0d | |||
| 9c2e8c232a | |||
| 7cefd8d664 | |||
| 28302b5941 | |||
| 3f2337cfb4 | |||
|
|
b94860a3c8 | ||
|
|
016580a889 | ||
|
|
d5f984a75f | ||
| cc18d11a28 | |||
| 7c14a9fadf | |||
| 4f4a142c63 | |||
| 7ea697ac0d | |||
| 70c79745f1 | |||
| 2503764329 | |||
| c9a86d9aff | |||
| 5f8b9a446e | |||
| ba1311e15c | |||
| 39e7eafe5e | |||
| 2a20bef11b | |||
| 0778c03e82 | |||
| 53f6798a6a | |||
| 600b50193d | |||
| 1bb64edc57 | |||
| a18535696e | |||
| a7ecf70452 | |||
| c994eac501 | |||
| 47d851f11d | |||
| dfcc5058ac | |||
| 36008ecb18 | |||
| 62a4961549 |
1340 changed files with 90909 additions and 142813 deletions
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 9c9346d5494688a78ea573f3bc0547ad12b9be2a
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
# Lethean Blockchain Build Configuration
|
||||
# Used by: core compile
|
||||
|
||||
version: 1
|
||||
|
||||
project:
|
||||
name: blockchain
|
||||
type: cpp
|
||||
description: "Lethean Blockchain - SASE infrastructure chain"
|
||||
version: "6.0.1"
|
||||
|
||||
cpp:
|
||||
standard: 17
|
||||
build_type: Release
|
||||
static: false
|
||||
|
||||
conan:
|
||||
version: "2.21.0"
|
||||
requires:
|
||||
- zlib/1.3.1
|
||||
- boost/1.85.0
|
||||
- openssl/3.2.0
|
||||
- miniupnpc/2.2.5
|
||||
- jwt-cpp/0.7.1
|
||||
- oatpp/1.3.0.latest
|
||||
- oatpp-swagger/1.3.0.latest
|
||||
tool_requires:
|
||||
- cmake/3.31.9
|
||||
options:
|
||||
boost/*:without_test: true
|
||||
registry:
|
||||
url: http://forge.snider.dev:4000/api/packages/host-uk/conan
|
||||
remote: conan_build
|
||||
|
||||
cmake:
|
||||
minimum_version: "3.16"
|
||||
variables:
|
||||
USE_CCACHE: "ON"
|
||||
|
||||
options:
|
||||
testnet: false
|
||||
|
||||
targets:
|
||||
- os: linux
|
||||
arch: x86_64
|
||||
profile: gcc-linux-x86_64
|
||||
- os: linux
|
||||
arch: arm64
|
||||
profile: gcc-linux-armv8
|
||||
- os: darwin
|
||||
arch: arm64
|
||||
profile: apple-clang-armv8
|
||||
- os: darwin
|
||||
arch: x86_64
|
||||
profile: apple-clang-x86_64
|
||||
- os: windows
|
||||
arch: x86_64
|
||||
profile: msvc-194-x86_64
|
||||
|
||||
package:
|
||||
generators:
|
||||
- TGZ
|
||||
- ZIP
|
||||
- NSIS
|
||||
- DEB
|
||||
- RPM
|
||||
vendor: Lethean
|
||||
contact: support@lt.hn
|
||||
website: https://lt.hn
|
||||
|
||||
docker:
|
||||
dockerfile: utils/docker/lthn-chain/Dockerfile
|
||||
image: lthn/chain
|
||||
platforms:
|
||||
- linux/amd64
|
||||
tags:
|
||||
- testnet
|
||||
- "{{.Version}}"
|
||||
build_args:
|
||||
BUILD_THREADS: auto
|
||||
BUILD_TESTNET: "1"
|
||||
BUILD_STATIC: "0"
|
||||
BUILD_TYPE: Release
|
||||
|
|
@ -1,8 +1,2 @@
|
|||
build
|
||||
.github
|
||||
.idea
|
||||
docs
|
||||
resources
|
||||
snap
|
||||
tests
|
||||
CMakeUserPresets.json
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
name: Build & Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
FORGEJO_URL: ${{ github.server_url }}
|
||||
|
||||
jobs:
|
||||
# ──────────────────────────────────────────────
|
||||
# Linux x86_64 — native build on snider-linux
|
||||
# ──────────────────────────────────────────────
|
||||
build-linux:
|
||||
name: Linux x86_64
|
||||
runs-on: linux-native
|
||||
env:
|
||||
CPU_CORES: "24"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: false
|
||||
|
||||
- name: Init submodules
|
||||
run: |
|
||||
git config --global url."${{ env.FORGEJO_URL }}/".insteadOf "http://forge.snider.dev:4000/"
|
||||
git -c http.extraHeader="Authorization: token ${{ secrets.RELEASE_TOKEN }}" submodule update --init --recursive
|
||||
git submodule foreach --recursive 'git fetch --tags origin 2>/dev/null || true'
|
||||
|
||||
- name: Build dependencies
|
||||
run: |
|
||||
make build-deps \
|
||||
CPU_CORES=${{ env.CPU_CORES }} \
|
||||
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||
CONAN_USER=claude \
|
||||
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||
|
||||
- name: Compile
|
||||
run: |
|
||||
make ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} \
|
||||
CPU_CORES=${{ env.CPU_CORES }} \
|
||||
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||
CONAN_USER=claude \
|
||||
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: linux-x86_64
|
||||
path: build/packages/lethean-*
|
||||
retention-days: 7
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# macOS ARM64 — native build on M3 Ultra
|
||||
# ──────────────────────────────────────────────
|
||||
build-macos:
|
||||
name: macOS ARM64
|
||||
runs-on: macos-native
|
||||
env:
|
||||
CPU_CORES: "24"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
submodules: false
|
||||
|
||||
- name: Init submodules
|
||||
run: |
|
||||
git config --global url."${{ env.FORGEJO_URL }}/".insteadOf "http://forge.snider.dev:4000/"
|
||||
git -c http.extraHeader="Authorization: token ${{ secrets.RELEASE_TOKEN }}" submodule update --init --recursive
|
||||
git submodule foreach --recursive 'git fetch --tags origin 2>/dev/null || true'
|
||||
|
||||
- name: Build dependencies
|
||||
run: |
|
||||
export PATH="/opt/homebrew/bin:$PATH"
|
||||
make build-deps \
|
||||
CPU_CORES=${{ env.CPU_CORES }} \
|
||||
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||
CONAN_USER=claude \
|
||||
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||
|
||||
- name: Compile
|
||||
run: |
|
||||
export PATH="/opt/homebrew/bin:$PATH"
|
||||
make ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} \
|
||||
CPU_CORES=${{ env.CPU_CORES }} \
|
||||
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||
CONAN_USER=claude \
|
||||
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: macos-arm64
|
||||
path: build/packages/lethean-*
|
||||
retention-days: 7
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# Aggregate artifacts and create release
|
||||
# ──────────────────────────────────────────────
|
||||
release:
|
||||
name: Create Release
|
||||
needs: [build-linux, build-macos]
|
||||
runs-on: linux-native
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
|
||||
- name: Download Linux artifacts
|
||||
uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
name: linux-x86_64
|
||||
path: artifacts/linux
|
||||
|
||||
- name: Download macOS artifacts
|
||||
uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
name: macos-arm64
|
||||
path: artifacts/macos
|
||||
|
||||
- name: List artifacts
|
||||
run: find artifacts/ -type f | sort
|
||||
|
||||
- name: Compute release tag
|
||||
id: release
|
||||
run: |
|
||||
VERSION=$(grep '^BUILD_VERSION:=' Makefile | cut -d'=' -f2)
|
||||
if [ "${{ github.ref_name }}" = "main" ]; then
|
||||
TAG="v${VERSION}+${{ github.run_number }}"
|
||||
PRERELEASE=false
|
||||
TITLE="v${VERSION} (build ${{ github.run_number }})"
|
||||
else
|
||||
TAG="v${VERSION}-beta+${{ github.run_number }}"
|
||||
PRERELEASE=true
|
||||
TITLE="v${VERSION}-beta (build ${{ github.run_number }})"
|
||||
fi
|
||||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
||||
echo "title=${TITLE}" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create release
|
||||
id: create_release
|
||||
run: |
|
||||
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"tag_name\": \"${{ steps.release.outputs.tag }}\",
|
||||
\"target_commitish\": \"${{ github.sha }}\",
|
||||
\"name\": \"${{ steps.release.outputs.title }}\",
|
||||
\"body\": \"Automated build from \`${{ github.ref_name }}\` branch (run #${{ github.run_number }})\n\n## Platforms\n- Linux x86_64\n- macOS ARM64 (Apple Silicon)\",
|
||||
\"draft\": false,
|
||||
\"prerelease\": ${{ steps.release.outputs.prerelease }}
|
||||
}")
|
||||
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
||||
BODY=$(echo "$RESPONSE" | sed '$d')
|
||||
if [ "$HTTP_CODE" -ge 400 ]; then
|
||||
echo "Failed to create release (HTTP ${HTTP_CODE}):"
|
||||
echo "$BODY"
|
||||
exit 1
|
||||
fi
|
||||
RELEASE_ID=$(echo "$BODY" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||
echo "id=${RELEASE_ID}" >> "$GITHUB_OUTPUT"
|
||||
echo "Created release ID: ${RELEASE_ID}"
|
||||
|
||||
- name: Upload release assets
|
||||
run: |
|
||||
for dir in artifacts/linux artifacts/macos; do
|
||||
for file in "$dir"/lethean-*; do
|
||||
[ -f "$file" ] || continue
|
||||
FILENAME=$(basename "$file")
|
||||
echo "Uploading: ${FILENAME}"
|
||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
||||
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=${FILENAME}" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@${file}")
|
||||
if [ "$HTTP_CODE" -ge 400 ]; then
|
||||
echo "Failed to upload ${FILENAME} (HTTP ${HTTP_CODE})"
|
||||
exit 1
|
||||
fi
|
||||
echo "Uploaded ${FILENAME} (HTTP ${HTTP_CODE})"
|
||||
done
|
||||
done
|
||||
|
||||
- name: Prune old releases
|
||||
run: |
|
||||
TAG_PREFIX="${{ github.ref_name == 'main' && 'v6' || 'v6.*-beta' }}"
|
||||
CURRENT_ID="${{ steps.create_release.outputs.id }}"
|
||||
echo "Keeping release ${CURRENT_ID}, pruning older ${TAG_PREFIX} releases..."
|
||||
PAGE=1
|
||||
while true; do
|
||||
RELEASES=$(curl -s "${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases?limit=50&page=${PAGE}" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}")
|
||||
COUNT=$(echo "$RELEASES" | python3 -c "import sys,json; print(len(json.load(sys.stdin)))" 2>/dev/null || echo 0)
|
||||
[ "$COUNT" = "0" ] && break
|
||||
echo "$RELEASES" | python3 -c "
|
||||
import sys, json, fnmatch
|
||||
for r in json.load(sys.stdin):
|
||||
rid = r['id']
|
||||
tag = r['tag_name']
|
||||
if rid == ${CURRENT_ID}:
|
||||
continue
|
||||
if fnmatch.fnmatch(tag, '${TAG_PREFIX}*'):
|
||||
print(f'{rid} {tag}')
|
||||
" | while read -r RID RTAG; do
|
||||
echo "Deleting release ${RTAG} (id=${RID})"
|
||||
curl -s -o /dev/null -X DELETE \
|
||||
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases/${RID}" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}"
|
||||
curl -s -o /dev/null -X DELETE \
|
||||
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/tags/${RTAG}" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}"
|
||||
done
|
||||
PAGE=$((PAGE + 1))
|
||||
done
|
||||
echo "Prune complete"
|
||||
5
.gitattributes
vendored
5
.gitattributes
vendored
|
|
@ -1,5 +1,2 @@
|
|||
.git* export-ignore
|
||||
/CMakeLists.txt export-subst
|
||||
|
||||
# Mark auto-generated SDK clients as "generated" to hide them in GitHub diffs
|
||||
utils/sdk/client/** linguist-generated=true
|
||||
/CMakeLists.txt export-subst
|
||||
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
github: [letheanVPN]
|
||||
open_collective: lthn
|
||||
22
.github/actions/make-docs/action.yml
vendored
22
.github/actions/make-docs/action.yml
vendored
|
|
@ -1,22 +0,0 @@
|
|||
# .github/actions/make-docs/action.yml
|
||||
name: 'Build Documentation'
|
||||
description: 'Archives and uploads signed binaries to a GitHub release'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: echo "cache_id=$(date -u '+%V')" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: mkdocs-material-${{ env.cache_id }}
|
||||
path: ~/.cache
|
||||
restore-keys: |
|
||||
mkdocs-material-
|
||||
|
||||
- if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||
- run: pip install mkdocs-git-revision-date-localized-plugin cairosvg mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging]
|
||||
90
.github/actions/upload-artifacts/action.yml
vendored
90
.github/actions/upload-artifacts/action.yml
vendored
|
|
@ -1,90 +0,0 @@
|
|||
# .github/actions/upload-artifacts/action.yml
|
||||
name: 'Upload Artifacts'
|
||||
description: 'Archives and uploads signed binaries to a GitHub release'
|
||||
inputs:
|
||||
chain-network:
|
||||
required: true
|
||||
description: 'The chain network name to use in filenames, mainnet or testnet'
|
||||
assets:
|
||||
description: "A EOL separated string list of filenames to archive; if asset is a abs path, it's respected"
|
||||
required: false
|
||||
asset-type:
|
||||
required: true
|
||||
description: 'The asset type: cli, gui, ANYTHING; used as a separator for different release packages for the same arch'
|
||||
asset-directory:
|
||||
required: true
|
||||
description: "The directory where 7z's working dir will be set"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: compute file name
|
||||
id: asset
|
||||
shell: bash
|
||||
run: |
|
||||
ARCH=${{ runner.arch }}
|
||||
RUNNER_OS=${{ runner.os }}
|
||||
LOWERCASE_ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]')
|
||||
TARGET_OS=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
|
||||
FILENAME="${{ inputs.chain-network }}-${{ inputs.asset-type }}-${TARGET_OS}-${LOWERCASE_ARCH}"
|
||||
echo "key=$FILENAME" >> $GITHUB_OUTPUT
|
||||
|
||||
VERSION=$(grep '^BUILD_VERSION:=' Makefile | cut -d'=' -f2)
|
||||
# Check if a version was found
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Error: BUILD_VERSION could not be found in the Makefile." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||
TAG_SUFFIX="-alpha.${{ github.event.number }}"
|
||||
PRERELEASE=true
|
||||
elif [ "${{ inputs.chain-network }}" != "mainnet" ]; then
|
||||
TAG_SUFFIX="-beta"
|
||||
PRERELEASE=true
|
||||
else
|
||||
TAG_SUFFIX=""
|
||||
PRERELEASE=false
|
||||
fi
|
||||
TAG_NAME="${VERSION}${TAG_SUFFIX}+${{ github.run_number }}"
|
||||
echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Format the output to be a multi-line string.
|
||||
# This is the correct way to pass a multi-line string in GITHUB_OUTPUT.
|
||||
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# Iterate through each filename
|
||||
echo "${{ inputs.assets }}" | while read -r file; do
|
||||
if [[ -z "$file" ]]; then
|
||||
continue
|
||||
fi
|
||||
# Check if the file is an absolute path
|
||||
if [[ "$file" == /* ]] || [[ "$file" =~ ^[a-zA-Z]: ]]; then
|
||||
FULL_PATH="$file"
|
||||
else
|
||||
# It's a relative path, so join it with the asset directory
|
||||
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||
FULL_PATH="${{ inputs.asset-directory }}\\$file"
|
||||
else
|
||||
FULL_PATH="${{ inputs.asset-directory }}/$file"
|
||||
fi
|
||||
fi
|
||||
echo "$FULL_PATH" >> "$GITHUB_OUTPUT"
|
||||
done
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4.6.2
|
||||
with:
|
||||
name: ${{ steps.asset.outputs.key }}
|
||||
path: ${{ steps.asset.outputs.paths }}
|
||||
|
||||
- name: Make Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.asset.outputs.tag_name }}
|
||||
prerelease: ${{ steps.asset.outputs.prerelease }}
|
||||
files: ${{ inputs.asset-directory }}/*
|
||||
target_commitish: ${{ github.sha }}
|
||||
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
25
.github/workflows/_maint-cache.yml
vendored
25
.github/workflows/_maint-cache.yml
vendored
|
|
@ -1,25 +0,0 @@
|
|||
name: Clear all Github actions caches on sundays
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 0"
|
||||
workflow_dispatch:
|
||||
# pull_request:
|
||||
# types:
|
||||
# - opened
|
||||
# - synchronize
|
||||
# - reopened
|
||||
# branches:
|
||||
# - dev
|
||||
# - main
|
||||
# paths-ignore:
|
||||
# - '**.md'
|
||||
|
||||
jobs:
|
||||
my-job:
|
||||
name: Delete all caches
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- name: Clear caches
|
||||
run: gh cache delete --all --repo ${{ github.repository }}
|
||||
70
.github/workflows/_on-pr.yml
vendored
70
.github/workflows/_on-pr.yml
vendored
|
|
@ -1,70 +0,0 @@
|
|||
name: PR
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
pull_request_review:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-linux-intel:
|
||||
name: Linux
|
||||
if: ${{!github.event.pull_request.draft}}
|
||||
uses: ./.github/workflows/build-linux-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-linux-arm:
|
||||
name: Linux
|
||||
if: ${{!github.event.pull_request.draft}}
|
||||
uses: ./.github/workflows/build-linux-arm64.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-windows-intel:
|
||||
name: Windows
|
||||
if: ${{!github.event.pull_request.draft}}
|
||||
uses: ./.github/workflows/build-windows-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-macos-arm64:
|
||||
name: MacOS
|
||||
uses: ./.github/workflows/build-macos-arm64.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-macos-intel:
|
||||
name: MacOS
|
||||
if: ${{!github.event.pull_request.draft}}
|
||||
uses: ./.github/workflows/build-macos-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-docker:
|
||||
name: Docker
|
||||
if: ${{!github.event.pull_request.draft}}
|
||||
uses: ./.github/workflows/build-docker.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-docs:
|
||||
name: Docs
|
||||
if: ${{!github.event.pull_request.draft}}
|
||||
uses: ./.github/workflows/build-docs.yml
|
||||
62
.github/workflows/_on-push.yml
vendored
62
.github/workflows/_on-push.yml
vendored
|
|
@ -1,62 +0,0 @@
|
|||
name: Push Compile
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'dev'
|
||||
- 'main'
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-linux-intel:
|
||||
name: Linux
|
||||
uses: ./.github/workflows/build-linux-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-linux-arm:
|
||||
name: Linux
|
||||
uses: ./.github/workflows/build-linux-arm64.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-windows-intel:
|
||||
name: Windows
|
||||
uses: ./.github/workflows/build-windows-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-macos-arm64:
|
||||
name: MacOS
|
||||
uses: ./.github/workflows/build-macos-arm64.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-macos-intel:
|
||||
name: MacOS
|
||||
uses: ./.github/workflows/build-macos-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-docker:
|
||||
name: Docker
|
||||
uses: ./.github/workflows/build-docker.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-docs:
|
||||
name: Docs
|
||||
uses: ./.github/workflows/build-docs.yml
|
||||
83
.github/workflows/_on-release.yml
vendored
83
.github/workflows/_on-release.yml
vendored
|
|
@ -1,83 +0,0 @@
|
|||
name: Push Full Build
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
determine-network:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
chain-network: ${{ steps.get_branch.outputs.chain_network }}
|
||||
steps:
|
||||
- name: Get release information from API
|
||||
id: get_branch
|
||||
run: |
|
||||
# Use the GitHub CLI to get the release details by tag name
|
||||
# The result is a JSON object
|
||||
RELEASE_INFO=$(gh release view --json targetCommitish -t ${{ github.ref_name }})
|
||||
|
||||
# Extract the target commitish (the source branch)
|
||||
SOURCE_BRANCH=$(echo "$RELEASE_INFO" | jq -r '.targetCommitish')
|
||||
|
||||
# Set the chain network based on the source branch
|
||||
if [ "$SOURCE_BRANCH" == "dev" ]; then
|
||||
echo "chain_network=testnet" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "chain_network=mainnet" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
echo "Source Branch: $SOURCE_BRANCH"
|
||||
echo "Chain Network: ${{ steps.get_branch.outputs.chain_network }}"
|
||||
|
||||
build-linux-intel:
|
||||
name: Chain
|
||||
uses: ./.github/workflows/build-linux-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-linux-arm:
|
||||
name: Chain
|
||||
uses: ./.github/workflows/build-linux-arm64.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-windows-intel:
|
||||
name: Chain
|
||||
uses: ./.github/workflows/build-windows-intel.yml
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-macos-arm64:
|
||||
name: Chain
|
||||
uses: ./.github/workflows/build-macos-arm64.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-macos-intel:
|
||||
name: Chain
|
||||
uses: ./.github/workflows/build-macos-intel.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-docker:
|
||||
name: Docker
|
||||
uses: ./.github/workflows/build-docker.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||
|
||||
build-docs:
|
||||
name: Docs
|
||||
uses: ./.github/workflows/build-docs.yml
|
||||
54
.github/workflows/build-docker.yml
vendored
54
.github/workflows/build-docker.yml
vendored
|
|
@ -1,54 +0,0 @@
|
|||
name: Docker
|
||||
permissions:
|
||||
contents: read
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
inputs:
|
||||
chain-network:
|
||||
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||
default: testnet
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}"
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v6
|
||||
env:
|
||||
DOCKER_BUILD_SUMMARY: false
|
||||
DOCKER_BUILD_RECORD_UPLOAD: false
|
||||
with:
|
||||
file: utils/docker/lthn-chain/Dockerfile
|
||||
context: ${{ github.workspace }}
|
||||
push: true
|
||||
build-args: |
|
||||
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
THREADS=2
|
||||
BUILD_LOCAL=1
|
||||
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
||||
|
||||
40
.github/workflows/build-docs.yml
vendored
40
.github/workflows/build-docs.yml
vendored
|
|
@ -1,40 +0,0 @@
|
|||
name: docs
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Offline Local Version
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||
- run: pip install mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging]
|
||||
|
||||
- name: Build Offline Version
|
||||
run: make docs
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: "*"
|
||||
asset-type: 'docs'
|
||||
asset-directory: ${{ github.workspace }}/build/docs
|
||||
90
.github/workflows/build-linux-arm64.yml
vendored
90
.github/workflows/build-linux-arm64.yml
vendored
|
|
@ -1,90 +0,0 @@
|
|||
name: Linux
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chain-network:
|
||||
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||
default: testnet
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-arm64
|
||||
runs-on: ubuntu-22.04-arm
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: install dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get install -y autotools-dev git build-essential libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
|
||||
build:
|
||||
name: compile-arm64
|
||||
needs: cache
|
||||
runs-on: ubuntu-22.04-arm
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: install dependencies
|
||||
run: sudo apt-get install -y autotools-dev rpm git build-essential libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Release
|
||||
run: make ${{ inputs.chain-network }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
90
.github/workflows/build-linux-intel.yml
vendored
90
.github/workflows/build-linux-intel.yml
vendored
|
|
@ -1,90 +0,0 @@
|
|||
name: Linux
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chain-network:
|
||||
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||
default: testnet
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-x86_64
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: install dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get install -y autotools-dev rpm git build-essential
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
|
||||
|
||||
build:
|
||||
name: compile-x86_64
|
||||
needs: cache
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: install dependencies
|
||||
run: sudo apt-get install -y autotools-dev git build-essential
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Release
|
||||
run: make ${{ inputs.chain-network }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
85
.github/workflows/build-macos-arm64.yml
vendored
85
.github/workflows/build-macos-arm64.yml
vendored
|
|
@ -1,85 +0,0 @@
|
|||
name: build-macos-arm64
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chain-network:
|
||||
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||
default: testnet
|
||||
required: false
|
||||
type: string
|
||||
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-armv8
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=3 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
|
||||
build:
|
||||
name: compile-armv8
|
||||
needs: cache
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Release
|
||||
run: make ${{ inputs.chain-network }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
81
.github/workflows/build-macos-intel.yml
vendored
81
.github/workflows/build-macos-intel.yml
vendored
|
|
@ -1,81 +0,0 @@
|
|||
name: build-macos-intel
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chain-network:
|
||||
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||
default: testnet
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-x86_64
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
build:
|
||||
name: compile-x86_64
|
||||
needs: cache
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Release
|
||||
run: make ${{ inputs.chain-network }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
82
.github/workflows/build-windows-intel.yml
vendored
82
.github/workflows/build-windows-intel.yml
vendored
|
|
@ -1,82 +0,0 @@
|
|||
name: build-windows
|
||||
permissions:
|
||||
contents: write
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chain-network:
|
||||
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||
default: testnet
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-x86_64
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
build:
|
||||
name: compile-x86_64
|
||||
needs: cache
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- run: choco install nsis.install
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Release
|
||||
run: make ${{ inputs.chain-network }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
with:
|
||||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
247
.github/workflows/cli-testnet.yml
vendored
Normal file
247
.github/workflows/cli-testnet.yml
vendored
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
name: cli-testnet
|
||||
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
CMAKE_OSX_SYSROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.2.1.sdk"
|
||||
CCACHE_SETTINGS: |
|
||||
ccache --max-size=150M
|
||||
ccache --set-config=compression=true
|
||||
|
||||
jobs:
|
||||
compile:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ ubuntu-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: linux-amd64
|
||||
net: testnet
|
||||
# - os: macos-11
|
||||
# target: macos-amd64
|
||||
# net: testnet
|
||||
# - os: macos-12
|
||||
# target: macos-amd64
|
||||
# net: testnet
|
||||
# - os: windows-2019
|
||||
# target: windows-amd64
|
||||
# net: testnet
|
||||
env:
|
||||
CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
CONAN_HOME: "${{ github.workspace }}/build/"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: amd64
|
||||
if: ${{ matrix.os == 'windows-2019' }}
|
||||
name: setup msvc vcvars
|
||||
- name: install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt-get install -y git ccache
|
||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
cache: "pip"
|
||||
- name: Install autotools on macOS
|
||||
run: brew install automake
|
||||
if: ${{ matrix.os == 'macos-13' }}
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ github.workspace }}/ccache
|
||||
key: ccache-${{ runner.os }}-${{ matrix.target }}-build-testnet-cli
|
||||
- name: Cache Conan
|
||||
id: github-cache-conan
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-conan-modules
|
||||
with:
|
||||
save-always: true
|
||||
path: ${{ github.workspace }}/build/p
|
||||
key: host-${{ runner.os }}-target-${{ matrix.target }}-${{ hashFiles('contrib/cmake/conanfile.py') }}
|
||||
- name: Install Conan
|
||||
run: pip install conan pytest && conan --version
|
||||
- name: Setup CMake and Ninja
|
||||
uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: "~3.25.0"
|
||||
ninjaVersion: "^1.11.1"
|
||||
- name: Call make release-testnet
|
||||
run: |
|
||||
make ci-${{ matrix.target }}-testnet
|
||||
- name: Release Tag
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
- name: Release Branch
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/heads/iTw3')
|
||||
with:
|
||||
tag_name: canary
|
||||
prerelease: true
|
||||
files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
# linux-amd64:
|
||||
# runs-on: ubuntu-20.04
|
||||
# env:
|
||||
# CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
# steps:
|
||||
# - name: Cancel Previous Runs
|
||||
# uses: styfle/cancel-workflow-action@0.9.1
|
||||
# with:
|
||||
# access_token: ${{ github.token }}
|
||||
# - uses: actions/checkout@v3
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# submodules: recursive
|
||||
# - uses: actions/cache@v3
|
||||
# with:
|
||||
# path: ${{ github.workspace }}/ccache
|
||||
# key: ccache-${{ runner.os }}-build-testnet-cli
|
||||
# restore-keys: ccache-${{ runner.os }}-build-testnet-cli
|
||||
# - name: update apt
|
||||
# run: sudo apt update
|
||||
# - name: install dependencies
|
||||
# run: sudo apt-get install -y python-dev autotools-dev libboost-all-dev libicu-dev libbz2-dev git screen checkinstall zlib1g-dev ccache miniupnpc
|
||||
# - name: build server
|
||||
# run: |
|
||||
# ${{env.CCACHE_SETTINGS}}
|
||||
# ./utils/build/testnet_linux_cli.sh
|
||||
# - name: Move Tarball
|
||||
# run: cd build/release && mv lethean-linux-cli-*.tar.bz2 ../../
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: lethean-linux-cli
|
||||
# if-no-files-found: error
|
||||
# path: lethean-linux-cli-*.tar.bz2
|
||||
# - name: Release
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# with:
|
||||
# files: ${{ github.workspace }}/testnet-lethean-linux-cli-*.tar.bz2
|
||||
# - name: Release Tag
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# with:
|
||||
# files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
# - name: Release Branch
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/heads/iTw3')
|
||||
# with:
|
||||
# tag_name: canary
|
||||
# prerelease: true
|
||||
# files: '*ethean-${{ matrix.target }}-cli.*'
|
||||
# macos-amd64:
|
||||
# runs-on: macos-latest
|
||||
# env:
|
||||
# CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
# steps:
|
||||
# - name: Cancel Previous Runs
|
||||
# uses: styfle/cancel-workflow-action@0.9.1
|
||||
# with:
|
||||
# access_token: ${{ github.token }}
|
||||
# - uses: actions/checkout@v3
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# submodules: recursive
|
||||
# - uses: actions/cache@v3
|
||||
# with:
|
||||
# path: ${{ github.workspace }}/ccache
|
||||
# key: ccache-${{ runner.os }}-build-testnet-cli
|
||||
# restore-keys: ccache-${{ runner.os }}-build-testnet-cli
|
||||
# - name: install dependencies
|
||||
# run: HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl boost icu4c ccache miniupnpc
|
||||
# - name: build server
|
||||
# env:
|
||||
# PKG_CONFIG_PATH: "/usr/local/opt/openssl@3/lib/pkgconfig"
|
||||
# OPENSSL_ROOT_DIR: "/usr/local/opt/openssl@3"
|
||||
# ZANO_BOOST_ROOT: "/opt/homebrew/opt/boost"
|
||||
# ZANO_BOOST_LIBS_PATH: "/opt/homebrew/opt/boost/lib"
|
||||
# CMAKE_OSX_SYSROOT: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk"
|
||||
# run: |
|
||||
# ${{env.CCACHE_SETTINGS}}
|
||||
# export LIBRARY_PATH=${LIBRARY_PATH}:/usr/local/opt/icu4c/lib
|
||||
# ./utils/build/testnet_mac_osx_cli.sh
|
||||
# - name: Move Tarball
|
||||
# run: cd build/release && mv lethean-macos-cli-*.tar.bz2 ../../
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: lethean-macos-cli
|
||||
# if-no-files-found: error
|
||||
# path: lethean-macos-cli-*.tar.bz2
|
||||
# - name: Release
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# with:
|
||||
# files: ${{ github.workspace }}/lethean-macos-cli-*.tar.bz2
|
||||
# windows-amd64:
|
||||
# runs-on: windows-latest
|
||||
# env:
|
||||
# CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
# steps:
|
||||
# - name: Cancel Previous Runs
|
||||
# uses: styfle/cancel-workflow-action@0.9.1
|
||||
# with:
|
||||
# access_token: ${{ github.token }}
|
||||
# - uses: actions/checkout@v3
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# submodules: recursive
|
||||
# - uses: actions/cache@v3
|
||||
# with:
|
||||
# path: ${{ github.workspace }}/ccache
|
||||
# key: ccache-${{ runner.os }}-build-testnet-cli
|
||||
# restore-keys: ccache-${{ runner.os }}-build-testnet-cli
|
||||
# - name: Eat the Choco
|
||||
# run: |
|
||||
# choco install ccache -y
|
||||
# choco install zip -y
|
||||
# - name: Cache Conan
|
||||
# id: github-cache-conan
|
||||
# uses: actions/cache@v4
|
||||
# env:
|
||||
# cache-name: cache-conan-modules
|
||||
# with:
|
||||
# save-always: true
|
||||
# path: ${{ github.workspace }}\build\p
|
||||
# key: host-${{ runner.os }}-target-windows-${{ hashFiles('contrib/cmake/conanfile.py') }}
|
||||
# - name: install msvc toolset
|
||||
# uses: ilammy/msvc-dev-cmd@v1
|
||||
#
|
||||
# - name: Set up Visual Studio shell
|
||||
# uses: egor-tensin/vs-shell@v2
|
||||
# with:
|
||||
# arch: x64
|
||||
# - name: build server
|
||||
# env:
|
||||
# CCACHE_TEMPDIR: ${{ github.workspace }}/ccache
|
||||
# run: |
|
||||
# ${{env.CCACHE_SETTINGS}}
|
||||
# .\utils\build\testnet_windows_cli.bat
|
||||
# - uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: lethean-windows-cli
|
||||
# if-no-files-found: error
|
||||
# path: ${{ github.workspace }}\lethean-win-cli-*.zip
|
||||
# - name: Release
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
# with:
|
||||
# files: |
|
||||
# lethean-win-cli-*
|
||||
67
.github/workflows/dockerhub-testnet.yml
vendored
Normal file
67
.github/workflows/dockerhub-testnet.yml
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
name: chain-itw3:testnet
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cancel Previous Runs
|
||||
uses: styfle/cancel-workflow-action@0.9.1
|
||||
with:
|
||||
access_token: ${{ github.token }}
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
install: true
|
||||
- name: Login to GitHub Container registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Docker Build
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: utils/docker/Dockerfile
|
||||
cache-to: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.ref_name }}
|
||||
cache-from: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.ref_name }}
|
||||
push: true
|
||||
tags: lthn/chain:testnet-${{ github.ref_name }},ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.ref_name }}
|
||||
- name: Docker Build
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: utils/docker/Dockerfile
|
||||
cache-to: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.head_ref }}
|
||||
cache-from: ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.head_ref }}
|
||||
push: true
|
||||
tags: lthn/chain:testnet-${{ github.head_ref }},ghcr.io/letheanvpn/blockchain-itw3:testnet-${{ github.head_ref }}
|
||||
|
||||
13
.gitignore
vendored
13
.gitignore
vendored
|
|
@ -5,13 +5,6 @@
|
|||
._.DS_Store
|
||||
Thumbs.db
|
||||
._*
|
||||
.idea/workspace.xml
|
||||
.idea/usage.statistics.xml
|
||||
.idea/dictionaries
|
||||
.idea/shelf
|
||||
.idea/copilot*
|
||||
.idea/modules.xml
|
||||
.idea/*.iml
|
||||
.vs/*
|
||||
CMakeUserPresets.json
|
||||
ConanPresets.json
|
||||
out
|
||||
.idea
|
||||
.vs/*
|
||||
21
.gitmodules
vendored
21
.gitmodules
vendored
|
|
@ -1,18 +1,7 @@
|
|||
[submodule "contrib/jwt-cpp"]
|
||||
path = contrib/jwt-cpp
|
||||
url = https://github.com/Thalhammer/jwt-cpp.git
|
||||
[submodule "contrib/bitcoin-secp256k1"]
|
||||
path = contrib/bitcoin-secp256k1
|
||||
url = https://github.com/bitcoin-core/secp256k1.git
|
||||
[submodule "contrib/miniupnp"]
|
||||
path = contrib/miniupnp
|
||||
url = https://github.com/miniupnp/miniupnp
|
||||
[submodule "contrib/tor-connect"]
|
||||
path = contrib/tor-connect
|
||||
url = https://github.com/hyle-team/tor-connect.git
|
||||
[submodule "docs"]
|
||||
path = docs
|
||||
url = https://github.com/letheanVPN/documentation.git
|
||||
[submodule "contrib/randomx"]
|
||||
path = contrib/randomx
|
||||
url = https://github.com/tevador/RandomX.git
|
||||
[submodule ".core/build"]
|
||||
path = .core/build
|
||||
url = http://forge.snider.dev:4000/host-uk/build.git
|
||||
url = https://github.com/letheanVPN/tor-connect.git
|
||||
branch = main
|
||||
|
|
|
|||
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
|
|
@ -1,8 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
2
.idea/.name
generated
2
.idea/.name
generated
|
|
@ -1 +1 @@
|
|||
Lethean
|
||||
Lethean
|
||||
|
|
|
|||
2
.idea/blockchain-iTw3.iml
generated
Normal file
2
.idea/blockchain-iTw3.iml
generated
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
||||
3
.idea/cmake.xml
generated
3
.idea/cmake.xml
generated
|
|
@ -2,7 +2,8 @@
|
|||
<project version="4">
|
||||
<component name="CMakeSharedSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" GENERATION_DIR="build/release" CONFIG_NAME="Debug" GENERATION_OPTIONS="--preset testnet" BUILD_OPTIONS="--preset testnet --parallel 30" NO_GENERATOR="true" />
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="true" GENERATION_DIR="build/debug" CONFIG_NAME="Debug" GENERATION_OPTIONS="-G "Unix Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="contrib/cmake/conan_provider.cmake"" />
|
||||
<configuration PROFILE_NAME="Release" ENABLED="true" GENERATION_DIR="build/release" CONFIG_NAME="Release" GENERATION_OPTIONS="-G "Unix Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="contrib/cmake/conan_provider.cmake"" />
|
||||
</configurations>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/code-comments.xml
generated
Normal file
6
.idea/code-comments.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CodeComments" version="1">
|
||||
<comments />
|
||||
</component>
|
||||
</project>
|
||||
105
.idea/codeStyles/Project.xml
generated
105
.idea/codeStyles/Project.xml
generated
|
|
@ -1,105 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<RiderCodeStyleSettings>
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
|
||||
</RiderCodeStyleSettings>
|
||||
<clangFormatSettings>
|
||||
<option name="ENABLED" value="true" />
|
||||
</clangFormatSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
6
.idea/copyright/LTHN.xml
generated
6
.idea/copyright/LTHN.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright (c) 2017-2025 Lethean (https://lt.hn) Licensed under the European Union Public Licence (EUPL) version 1.2. You may obtain a copy of the licence at: https://joinup.ec.europa.eu/software/page/eupl/licence-eupl The EUPL is a copyleft licence that is compatible with the MIT/X11 licence used by the original projects; but maintains OSS status, where regional copyright law requires ownership to dictate licence terms. SPDX‑License‑Identifier: EUPL-1.2 " />
|
||||
<option name="myName" value="LTHN" />
|
||||
</copyright>
|
||||
</component>
|
||||
6
.idea/copyright/Lethean.xml
generated
6
.idea/copyright/Lethean.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<copyright>
|
||||
<option name="notice" value="Copyright (c) 2014-2018 Zano Project Copyright (c) 2014-2018 The Louisdor Project Copyright (c) 2012-2013 The Boolberry developers Copyright (c) 2017-2025 Lethean (https://lt.hn) Licensed under the European Union Public Licence (EUPL) version 1.2. You may obtain a copy of the licence at: https://joinup.ec.europa.eu/software/page/eupl/licence-eupl The EUPL is a copyleft licence that is compatible with the MIT/X11 licence used by the original projects; the MIT terms are therefore considered “grandfathered” under the EUPL for this code. SPDX‑License‑Identifier: EUPL-1.2 " />
|
||||
<option name="myName" value="Lethean" />
|
||||
</copyright>
|
||||
</component>
|
||||
8
.idea/copyright/profiles_settings.xml
generated
8
.idea/copyright/profiles_settings.xml
generated
|
|
@ -1,8 +0,0 @@
|
|||
<component name="CopyrightManager">
|
||||
<settings default="LTHN">
|
||||
<module2copyright>
|
||||
<element module="apiserver" copyright="LTHN" />
|
||||
<element module="Project Files" copyright="Lethean" />
|
||||
</module2copyright>
|
||||
</settings>
|
||||
</component>
|
||||
344
.idea/editor.xml
generated
344
.idea/editor.xml
generated
|
|
@ -1,344 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="BackendCodeEditorSettings">
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||
</component>
|
||||
</project>
|
||||
13
.idea/inspectionProfiles/Project_Default.xml
generated
13
.idea/inspectionProfiles/Project_Default.xml
generated
|
|
@ -1,13 +0,0 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="tuple.*" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
43
.idea/jsonSchemas.xml
generated
43
.idea/jsonSchemas.xml
generated
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JsonSchemaMappingsProjectConfiguration">
|
||||
<state>
|
||||
<map>
|
||||
<entry key="GitHub Action JSON Schema">
|
||||
<value>
|
||||
<SchemaInfo>
|
||||
<option name="name" value="GitHub Action JSON Schema" />
|
||||
<option name="relativePathToSchema" value="jar://$APPLICATION_PLUGINS_DIR$/vcs-github-IU/lib/vcs-github.jar!/schemas/github-action.json" />
|
||||
<option name="applicationDefined" value="true" />
|
||||
<option name="patterns">
|
||||
<list>
|
||||
<Item>
|
||||
<option name="path" value=".github/actions/**/*.yml" />
|
||||
</Item>
|
||||
</list>
|
||||
</option>
|
||||
</SchemaInfo>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="openapitools">
|
||||
<value>
|
||||
<SchemaInfo>
|
||||
<option name="generatedName" value="New Schema" />
|
||||
<option name="name" value="openapitools" />
|
||||
<option name="relativePathToSchema" value="utils/sdk/openapitools.json" />
|
||||
<option name="patterns">
|
||||
<list>
|
||||
<Item>
|
||||
<option name="directory" value="true" />
|
||||
<option name="path" value="utils/sdk/packages" />
|
||||
<option name="mappingKind" value="Directory" />
|
||||
</Item>
|
||||
</list>
|
||||
</option>
|
||||
</SchemaInfo>
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</state>
|
||||
</component>
|
||||
</project>
|
||||
34
.idea/misc.xml
generated
34
.idea/misc.xml
generated
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.13 virtualenv at $PROJECT_DIR$.venv" />
|
||||
</component>
|
||||
<component name="CMakePythonSetting">
|
||||
<option name="pythonIntegrationState" value="YES" />
|
||||
</component>
|
||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
<component name="CidrRootsConfiguration">
|
||||
<excludeRoots>
|
||||
<file path="$PROJECT_DIR$/build" />
|
||||
</excludeRoots>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MakefileSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<MakefileProjectSettings>
|
||||
<option name="buildOptions" value="--jobs=30" />
|
||||
<option name="buildTarget" value="build" />
|
||||
<option name="cleanTarget" value="clean-build" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="switches" value="TESTNET=1 STATIC=1" />
|
||||
<option name="version" value="2" />
|
||||
</MakefileProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||
</project>
|
||||
6
.idea/prettier.xml
generated
6
.idea/prettier.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PrettierConfiguration">
|
||||
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||
</component>
|
||||
</project>
|
||||
15
.idea/runConfigurations/docker_server.xml
generated
Normal file
15
.idea/runConfigurations/docker_server.xml
generated
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="docker-server" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
|
||||
<deployment type="dockerfile">
|
||||
<settings>
|
||||
<option name="imageTag" value="lthn/chain-itw3:testnet" />
|
||||
<option name="buildCliOptions" value="--platform linux/x86_64 --build-arg THREADS=4" />
|
||||
<option name="buildKitEnabled" value="true" />
|
||||
<option name="containerName" value="" />
|
||||
<option name="contextFolderPath" value="." />
|
||||
<option name="sourceFilePath" value="utils/docker/Dockerfile" />
|
||||
</settings>
|
||||
</deployment>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
3
.idea/scopes/apiserver.xml
generated
3
.idea/scopes/apiserver.xml
generated
|
|
@ -1,3 +0,0 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<scope name="apiserver" pattern="file[blockchain]:src/api//*" />
|
||||
</component>
|
||||
7
.idea/vcs.xml
generated
7
.idea/vcs.xml
generated
|
|
@ -1,10 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/contrib/bitcoin-secp256k1" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/contrib/jwt-cpp" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/contrib/miniupnp" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/contrib/tor-connect" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/docs" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/src/gui/qt-daemon/layout" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
55
AGENTS.md
55
AGENTS.md
|
|
@ -1,55 +0,0 @@
|
|||
# AI Agent Collaboration Framework for Repository Contributions
|
||||
|
||||
## 1. Purpose and Guiding Philosophy
|
||||
|
||||
This document provides a guiding framework for any AI agent interacting with this repository. Its purpose is to ensure that all automated contributions, especially Pull Request (PR) reviews and code suggestions, are constructive, respectful, and aligned with the project's overarching goals.
|
||||
|
||||
This framework operates in accordance with the foundational **Axioms of Life**, translating their universal principles into the specific context of human-AI software development collaboration. The primary goal is a partnership that enhances code quality and developer velocity, not one that creates friction through pedantry.
|
||||
|
||||
## 2. Core Principles for AI Interaction
|
||||
|
||||
All agents MUST adhere to the following principles:
|
||||
|
||||
* **Principle 1: Respect Authorial Intent (Axiom 1 & 4)**
|
||||
* Your primary goal is to understand and support the human author's objective. Before suggesting a change, first assume the author had a valid reason for their implementation. Frame your feedback as a way to better achieve their goal or to prevent unintended side effects. Do not challenge intent without clear evidence of a functional error.
|
||||
|
||||
* **Principle 2: Prioritize Objectivity and Verifiability (Axiom 2)**
|
||||
* Feedback MUST be anchored in objective, verifiable criteria. Subjective opinions on style are the lowest priority.
|
||||
* **Valid criteria include:**
|
||||
* Demonstrable bugs or logical errors.
|
||||
* Security vulnerabilities.
|
||||
* Performance regressions.
|
||||
* Violations of a documented project standard (e.g., a style guide file in the repo).
|
||||
* **Invalid criteria include:**
|
||||
* Personal stylistic preferences not codified in a project standard.
|
||||
* Code organization that is merely "different" but not functionally incorrect.
|
||||
|
||||
* **Principle 3: Adopt a Collaborative, Non-Authoritarian Tone (Axiom 4)**
|
||||
* As a digital substrate interacting with a human one, you must adopt a tone of a helpful, respectful peer. Avoid declarative or demanding language.
|
||||
* **Prefer:** "Have you considered...?", "An alternative here that might prevent X is...", "I noticed this could lead to Y. What do you think about...?"
|
||||
* **Avoid:** "You must fix this.", "This is wrong.", "Change this to..."
|
||||
|
||||
* **Principle 4: Provide Actionable and Justified Suggestions (Axiom 3)**
|
||||
* Do not simply state that something is incorrect. Provide a clear explanation for *why* it is a potential issue and, whenever possible, offer a concrete, well-explained code suggestion that resolves it. Your intent is to help, not just to criticize.
|
||||
|
||||
## 3. Feedback Severity Classification
|
||||
|
||||
To combat pedantry, all feedback provided in PR reviews MUST be classified into one of the following three levels. This creates a clear hierarchy of importance.
|
||||
|
||||
### **Level 1: Critical (Blocking)**
|
||||
* **Definition:** Issues that will cause demonstrable harm if merged.
|
||||
* **Examples:** Bugs, logic errors, security vulnerabilities, unhandled exceptions, build failures.
|
||||
* **Action:** These issues MUST be addressed by the author before a merge. Your feedback should clearly state the nature of the critical issue.
|
||||
|
||||
### **Level 2: Important (Non-Blocking Recommendation)**
|
||||
* **Definition:** Issues that deviate from established project best practices or could impact future maintainability.
|
||||
* **Examples:** Violations of a documented style guide, clear opportunities to improve readability, non-critical performance improvements, deprecation warnings.
|
||||
* **Action:** These issues SHOULD be addressed. Frame them as strong recommendations that improve the health of the codebase. The author may choose to address them in a follow-up PR if necessary.
|
||||
|
||||
### **Level 3: Suggestion (Optional Nitpick)**
|
||||
* **Definition:** Minor stylistic preferences, alternative implementations with no clear functional advantage, or purely cosmetic changes. This is the "pedantic" category.
|
||||
* **Action:** These suggestions are entirely optional and at the author's discretion. They MUST be explicitly prefixed with "Optional:", "Nit:", or "Suggestion:". This signals to the human that the comment is non-essential and can be safely ignored without consequence.
|
||||
|
||||
---
|
||||
|
||||
By adhering to this framework, AI agents become valuable partners in the development process, helping to catch critical errors while respecting the creative autonomy and focus of their human collaborators.
|
||||
201
CMakeLists.txt
201
CMakeLists.txt
|
|
@ -1,16 +1,46 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
message(STATUS "Using CMake version: ${CMAKE_VERSION}")
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(DISABLE_TOR TRUE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
|
||||
list(INSERT CMAKE_MODULE_PATH 0
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/contrib/cmake")
|
||||
|
||||
PROJECT(Lethean)
|
||||
|
||||
set(VERSION "1.0" CACHE STRING "Build version")
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
option (USE_CCACHE "Use ccache if a usable instance is found" ON)
|
||||
if (USE_CCACHE)
|
||||
include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable.
|
||||
else()
|
||||
message(STATUS "ccache deselected")
|
||||
endif()
|
||||
option (USE_COMPILATION_TIME_PROFILER "Use compilation time profiler (for CLang >= 9 only)" OFF)
|
||||
if (USE_COMPILATION_TIME_PROFILER)
|
||||
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
message(FATAL_ERROR "The flag USE_COMPILATION_TIME_PROFILER is meant to be set only for CLang compiler!")
|
||||
endif()
|
||||
add_compile_options("-ftime-trace")
|
||||
endif()
|
||||
|
||||
list(INSERT CMAKE_MODULE_PATH 0
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/.core/build/cmake")
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "3.0.0" AND CMAKE_MAKE_PROGRAM MATCHES "ninja")
|
||||
set(CCACHE_PARALLEL_COMPILE_JOBS "" CACHE STRING "The maximum number of concurrent compilation jobs.")
|
||||
if (CCACHE_PARALLEL_COMPILE_JOBS)
|
||||
set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${CCACHE_PARALLEL_COMPILE_JOBS})
|
||||
set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
|
||||
endif ()
|
||||
|
||||
set(CCACHE_PARALLEL_LINK_JOBS "" CACHE STRING "The maximum number of concurrent link jobs.")
|
||||
if (CCACHE_PARALLEL_LINK_JOBS)
|
||||
set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${CCACHE_PARALLEL_LINK_JOBS})
|
||||
set(CMAKE_JOB_POOL_LINK link_job_pool)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
|
||||
message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")
|
||||
message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}")
|
||||
|
||||
|
||||
|
||||
|
||||
set(VERSION "1.0")
|
||||
|
||||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0043 NEW)
|
||||
|
|
@ -18,30 +48,18 @@ endif()
|
|||
if(POLICY CMP0043)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0144)
|
||||
cmake_policy(SET CMP0144 NEW)
|
||||
endif()
|
||||
if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 OLD)
|
||||
endif()
|
||||
|
||||
include(DocBuilder)
|
||||
option (USE_CCACHE "Use ccache if a usable instance is found" OFF)
|
||||
if (USE_CCACHE)
|
||||
include(FindCcache)
|
||||
else()
|
||||
message(STATUS "ccache deselected")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
add_definitions(-DMOBILE_WALLET_BUILD)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
|
||||
add_definitions(-DIOS_BUILD)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode")
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
add_definitions(-DANDROID_BUILD)
|
||||
|
|
@ -62,7 +80,7 @@ if (UNIX AND NOT APPLE)
|
|||
else()
|
||||
# multi configurations for MSVC and XCode
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||
set(CMAKE_CONFIGURATION_TYPES "Release")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||
else()
|
||||
|
|
@ -78,29 +96,36 @@ find_package(OpenSSL REQUIRED)
|
|||
|
||||
|
||||
if(APPLE)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0)
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum OS X deployment version")
|
||||
endif()
|
||||
|
||||
set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers")
|
||||
set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
|
||||
set(TESTNET 0 CACHE BOOL "Build TESTNET")
|
||||
set(TESTNET FALSE CACHE BOOL "Compile for testnet")
|
||||
set(MUTE_ERRORS TRUE CACHE BOOL "Disable Error Suppression")
|
||||
set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon")
|
||||
set(USE_BITCOIN_SECP256K1_FOR_ECDSA FALSE CACHE BOOL "Use bitcoin-secp256k1 library for validating ECDSA(instead of OpenSSL)")
|
||||
if(NOT USE_BITCOIN_SECP256K1_FOR_ECDSA)
|
||||
add_definitions(-DUSE_OPEN_SSL_FOR_ECDSA)
|
||||
endif()
|
||||
|
||||
include_directories(src contrib/eos_portable_archive contrib contrib/epee/include ${OPENSSL_INCLUDE_DIR} "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")
|
||||
|
||||
add_definitions(-DSTATICLIB)
|
||||
|
||||
if(TESTNET)
|
||||
message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
|
||||
add_definitions(-DTESTNET)
|
||||
if(MUTE_ERRORS)
|
||||
# shhhhh sleepy time errors, we know...
|
||||
add_definitions(-w)
|
||||
endif()
|
||||
else()
|
||||
if(MUTE_ERRORS)
|
||||
# shhhhh sleepy time errors, we know...
|
||||
add_definitions(-w)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CAKEWALLET)
|
||||
message("NOTICE: Building libraries for CAKEWALLET")
|
||||
add_definitions(-DCAKEWALLET)
|
||||
add_definitions(-DDISABLE_PFR_SERIALIZATION_SELFCHECK)
|
||||
endif()
|
||||
|
||||
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
|
||||
|
|
@ -112,6 +137,10 @@ if(DISABLE_TOR)
|
|||
endif()
|
||||
|
||||
|
||||
include_directories(src contrib/eos_portable_archive contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")
|
||||
|
||||
add_definitions(-DSTATICLIB)
|
||||
|
||||
set(STATIC ${MSVC} CACHE BOOL "Link libraries statically")
|
||||
if (UNIX AND NOT APPLE)
|
||||
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
|
||||
|
|
@ -124,15 +153,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|||
endif()
|
||||
|
||||
|
||||
|
||||
add_definitions("/DBOOST_NO_CXX98_FUNCTION_BASE")
|
||||
if(WIN32)
|
||||
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||
endif()
|
||||
|
||||
|
||||
if(MSVC)
|
||||
add_definitions("/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0")
|
||||
add_compile_options(/EHa /bigobj /Zm1000 /Z7 /MP2 /W3 /GS- /wd4996 /wd4503 /wd4345 /wd4091 /FIinline_c.h)
|
||||
add_compile_options(/bigobj /Zm1000 /Z7 /MP2 /W3 /GS- /wd4996 /wd4503 /wd4345 /wd4091 /FIinline_c.h)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760 /DEBUG dbghelp.lib crypt32.lib")
|
||||
if(STATIC)
|
||||
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||
|
|
@ -140,7 +166,6 @@ if(MSVC)
|
|||
endforeach()
|
||||
endif()
|
||||
include_directories(SYSTEM src/platform/msc)
|
||||
|
||||
else()
|
||||
set(ARCH default CACHE STRING "CPU to build for: -march value or default")
|
||||
if("${ARCH}" STREQUAL "default")
|
||||
|
|
@ -155,7 +180,7 @@ else()
|
|||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(WARNINGS "${WARNINGS} -Wno-implicit-function-declaration -Wno-shift-count-overflow -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
|
||||
else()
|
||||
set(WARNINGS "${WARNINGS} -Wno-error=write-strings -Wno-error=uninitialized")
|
||||
set(WARNINGS "${WARNINGS} -Wno-error=write-strings -Wlogical-op -Wno-error=maybe-uninitialized")
|
||||
endif()
|
||||
|
||||
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
|
||||
|
|
@ -182,7 +207,7 @@ else()
|
|||
endif()
|
||||
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wstrict-prototypes -Wno-comment")
|
||||
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
|
||||
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.c" COMPILE_DEFINITIONS "-std=c++14")
|
||||
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/utils/test-static-assert.c" COMPILE_DEFINITIONS "-std=c++14")
|
||||
if(STATIC_ASSERT_RES)
|
||||
set(STATIC_ASSERT_FLAG "")
|
||||
else()
|
||||
|
|
@ -195,7 +220,6 @@ else()
|
|||
set(LLVM_USE_LINKER "gold")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||
link_libraries("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:-lstdc++fs>") # GCC < 9 requires additional linking for std::filesystem. Remove after stop supporting GCC 8.x -- sowle
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8))
|
||||
|
|
@ -203,21 +227,21 @@ else()
|
|||
else()
|
||||
set(DEBUG_FLAGS "-g3 -O0")
|
||||
endif()
|
||||
set(RELEASE_FLAGS "-O3 -ffast-math -DNDEBUG -w")
|
||||
set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable")
|
||||
|
||||
if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "Android"))
|
||||
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto=auto -g3")
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
|
||||
set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects")
|
||||
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto")
|
||||
endif()
|
||||
#if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
|
||||
# set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects")
|
||||
#endif()
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||
if(STATIC)
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
|
||||
# message(SEND_ERROR "Static build is not supported on MacOS X")
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
|
@ -225,51 +249,68 @@ else()
|
|||
endif()
|
||||
|
||||
|
||||
# Link Boost statically, consistent with previous setup
|
||||
if(MSVC OR STATIC)
|
||||
# always use local Boost installation rather than the system-wide (unless ZANO_USE_SYSTEM_BOOST is defined for some reason, which is not recommended)
|
||||
if(NOT DEFINED ENV{ZANO_USE_SYSTEM_BOOST})
|
||||
set(Boost_NO_SYSTEM_PATHS ON)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
if (MSVC)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if(STATIC)
|
||||
set(Boost_USE_STATIC_RUNTIME ON)
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
# set(Boost_USE_STATIC_RUNTIME ON)
|
||||
endif()
|
||||
|
||||
# Define Boost components
|
||||
set(BOOST_COMPONENTS system filesystem locale thread timer date_time chrono regex serialization atomic program_options)
|
||||
if(NOT APPLE)
|
||||
list(APPEND BOOST_COMPONENTS log)
|
||||
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.00)
|
||||
set(Boost_LIBRARIES "libboost.a")
|
||||
#workaround for new XCode 12 policy for builds(now it includes a slice for the "arm64" when builds for simulator)
|
||||
set(__iphoneos_archs "arm64")
|
||||
set(__iphonesimulator_archs "x86_64")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}/${CMAKE_ANDROID_ARCH_ABI}/")
|
||||
set(Boost_LIBRARIES "${Boost_LIBRARY_DIRS}libboost_system.a;${Boost_LIBRARY_DIRS}libboost_filesystem.a;${Boost_LIBRARY_DIRS}libboost_thread.a;${Boost_LIBRARY_DIRS}libboost_timer.a;${Boost_LIBRARY_DIRS}libboost_date_time.a;${Boost_LIBRARY_DIRS}libboost_chrono.a;${Boost_LIBRARY_DIRS}libboost_regex.a;${Boost_LIBRARY_DIRS}libboost_serialization.a;${Boost_LIBRARY_DIRS}libboost_atomic.a;${Boost_LIBRARY_DIRS}libboost_program_options.a")
|
||||
elseif(APPLE)
|
||||
find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale)
|
||||
else()
|
||||
find_package(Boost 1.70 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale log)
|
||||
endif()
|
||||
message(STATUS "Using Boost ${Boost_VERSION} from Conan")
|
||||
|
||||
find_package(miniupnpc REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
include_directories(src "${CMAKE_BINARY_DIR}/version")
|
||||
|
||||
include_directories(SYSTEM
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${OPENSSL_INCLUDE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/contrib/ethereum/libethash
|
||||
contrib
|
||||
contrib/epee/include
|
||||
contrib/jwt-cpp/include
|
||||
contrib/eos_portable_archive
|
||||
message(STATUS "Boost: ${Boost_VERSION} from ${Boost_LIBRARY_DIRS}")
|
||||
|
||||
)
|
||||
|
||||
# Append other needed libraries
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/contrib/ethereum/libethash)
|
||||
if(MINGW)
|
||||
list(APPEND Boost_LIBRARIES ws2_32 mswsock)
|
||||
elseif(NOT MSVC AND NOT APPLE AND NOT CAKEWALLET AND STATIC)
|
||||
message("NOTICE: Including static ICU libraries")
|
||||
list(APPEND Boost_LIBRARIES icui18n.a icuuc.a icudata.a dl)
|
||||
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
|
||||
elseif(NOT MSVC)
|
||||
if(NOT APPLE)
|
||||
set(Boost_LIBRARIES "${Boost_LIBRARIES};")
|
||||
if(STATIC)
|
||||
message("NOTICE: Including static ICU libraries")
|
||||
set(Boost_LIBRARIES "${Boost_LIBRARIES};icui18n.a;icuuc.a;icudata.a;dl")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_GUI)
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
|
||||
if(APPLE AND NOT CMAKE_PREFIX_PATH)
|
||||
execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR})
|
||||
endif()
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
endif()
|
||||
|
||||
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
|
||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
|
||||
|
|
@ -310,5 +351,3 @@ add_subdirectory(src)
|
|||
if (BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
include(CPackConfig)
|
||||
|
|
|
|||
|
|
@ -1,109 +0,0 @@
|
|||
{
|
||||
"version": 8,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 23,
|
||||
"patch": 0
|
||||
},
|
||||
"include": [
|
||||
"ConanPresets.json"
|
||||
],
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "testnet",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"environment": {
|
||||
"CONAN_HOME": "${sourceDir}/build/sdk"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"TESTNET": "ON",
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES":".core/build/cmake/ConanProvider.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mainnet",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"environment": {
|
||||
"CONAN_HOME": "${sourceDir}/build/sdk"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"TESTNET": "OFF",
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES":".core/build/cmake/ConanProvider.cmake"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "testnet",
|
||||
"configurePreset": "testnet"
|
||||
},
|
||||
{
|
||||
"name": "mainnet",
|
||||
"configurePreset": "mainnet"
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "mainnet",
|
||||
"configurePreset": "mainnet",
|
||||
"output": {"outputOnFailure": true},
|
||||
"execution": {"noTestsAction": "error", "stopOnFailure": true}
|
||||
}
|
||||
],
|
||||
"packagePresets": [
|
||||
{
|
||||
"name": "mainnet",
|
||||
"configurePreset": "mainnet",
|
||||
"generators": [
|
||||
"TGZ",
|
||||
"ZIP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "testnet",
|
||||
"configurePreset": "testnet",
|
||||
"generators": [
|
||||
"TGZ",
|
||||
"ZIP"
|
||||
]
|
||||
}
|
||||
],
|
||||
"workflowPresets": [
|
||||
{
|
||||
"name": "testnet",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "testnet"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "testnet"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "testnet"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mainnet",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "mainnet"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "mainnet"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "mainnet"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
CODEOWNERS
Normal file
2
CODEOWNERS
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
* @snider
|
||||
docs/* @snider @bodane
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
|
|
@ -284,5 +284,4 @@ the rights granted in Article 2 of this Licence and protect the covered Source
|
|||
Code from exclusive appropriation.
|
||||
|
||||
All other changes or additions to this Appendix require the production of a new
|
||||
EUPL version.
|
||||
|
||||
EUPL version.
|
||||
268
Makefile
268
Makefile
|
|
@ -1,196 +1,150 @@
|
|||
# Copyright (c) 2017-2025 Lethean https://lt.hn
|
||||
# Copyright (c) 2014-2019 Zano Project
|
||||
# Copyright (c) 2014 The Cryptonote developers
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# ============================================================
|
||||
# Build system from host-uk/build submodule
|
||||
# ============================================================
|
||||
BUILD_SYS := .core/build
|
||||
CMAKE_DIR := $(BUILD_SYS)/cmake
|
||||
|
||||
# ============================================================
|
||||
# Project Configuration
|
||||
# ============================================================
|
||||
CPU_CORES := 1
|
||||
TESTNET:= 0
|
||||
STATIC:= 0
|
||||
BUILD_TYPE ?=Release
|
||||
BUILD_VERSION:=6.0.1
|
||||
BUILD_FOLDER:=build/release
|
||||
PRESET_BUILD:=conan-release
|
||||
PRESET_CONFIGURE:=conan-release
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Detect the number of logical CPU cores – works on Linux,
|
||||
# macOS, BSD, and Windows (both cmd.exe and PowerShell).
|
||||
# ------------------------------------------------------------
|
||||
UNAME_S := $(shell uname -s 2>/dev/null || echo Unknown)
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
CPU_CORES := $(shell nproc 2>/dev/null || \
|
||||
grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1)
|
||||
# Define CMake generator
|
||||
system := $(shell uname)
|
||||
ifneq (, $(findstring MINGW, $(system)))
|
||||
cmake_gen = -G 'MSYS Makefiles'
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
CPU_CORES := $(shell sysctl -n hw.logicalcpu 2>/dev/null || echo 1)
|
||||
endif
|
||||
cmake = cmake $(cmake_gen)
|
||||
|
||||
ifeq ($(filter %BSD,$(UNAME_S)),%BSD)
|
||||
CPU_CORES := $(shell sysctl -n hw.ncpu 2>/dev/null || echo 1)
|
||||
endif
|
||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug -D MUTE_ERRORS=FALSE
|
||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=contrib/cmake/conan_provider.cmake
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
cmake_testnet = -D TESTNET=ON -D BUILD_TESTS=OFF
|
||||
cmake_static = -D STATIC=ON
|
||||
cmake_tests = -D BUILD_TESTS=ON -D TESTNET=ON
|
||||
|
||||
PRESET_CONFIGURE:=conan-default
|
||||
|
||||
CPU_CORES := $(NUMBER_OF_PROCESSORS)
|
||||
# Helper macro
|
||||
define CMAKE
|
||||
mkdir -p $1 && cd $1 && $2 ../../
|
||||
endef
|
||||
|
||||
ifeq ($(CPU_CORES),)
|
||||
CPU_CORES := $(shell powershell -NoProfile -Command ^ "[Environment]::ProcessorCount")
|
||||
endif
|
||||
endif
|
||||
build = build
|
||||
dir_debug = $(build)/debug
|
||||
dir_release = $(build)/release
|
||||
current_dir := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
|
||||
export CONAN_HOME = $(current_dir)$(build)
|
||||
|
||||
# Safety net
|
||||
CPU_CORES := $(or $(CPU_CORES),1)
|
||||
CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1)
|
||||
CONAN_CPU_COUNT=$(CPU_CORES)
|
||||
|
||||
# ============================================================
|
||||
# Paths — profiles and cmake modules from .build submodule
|
||||
# ============================================================
|
||||
PROFILES :=$(patsubst $(CMAKE_DIR)/profiles/%,%,$(wildcard $(CMAKE_DIR)/profiles/*))
|
||||
SORTED_PROFILES :=$(sort $(PROFILES))
|
||||
CONAN_CACHE :=$(CURDIR)/build/sdk
|
||||
CONAN_URL :=http://forge.snider.dev:4000/api/packages/host-uk/conan
|
||||
CONAN_USER ?=$(shell echo $$CONAN_USER)
|
||||
CONAN_PASSWORD ?=$(shell echo $$CONAN_PASSWORD)
|
||||
CONAN_EXECUTABLE :=$(CURDIR)/build/bin/conan
|
||||
CC_DOCKER_FILE ?=utils/docker/images/lthn-chain/Dockerfile
|
||||
SDK_PACKAGES_JSON :=$(wildcard utils/sdk/packages/*.json)
|
||||
SDK_TARGETS :=$(patsubst utils/sdk/packages/%.json,%,$(SDK_PACKAGES_JSON))
|
||||
SORTED_SDK_TARGETS :=$(sort $(SDK_TARGETS))
|
||||
conan_profile_linux = $(CONAN_HOME)/profiles/linux-amd64
|
||||
conan_profile_windows = $(CONAN_HOME)/profiles/windows-amd64
|
||||
conan_toolchain = -DCMAKE_TOOLCHAIN_FILE=./build/release/conan/build/Release/generators/conan_toolchain.cmake
|
||||
|
||||
all: help
|
||||
|
||||
testnet:
|
||||
$(MAKE) configure TESTNET=1 STATIC=$(STATIC)
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) build .
|
||||
$(MAKE) package
|
||||
release: ## Build release non-static binaries
|
||||
$(eval command += $(cmake_release))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
mainnet:
|
||||
$(MAKE) configure TESTNET=0 STATIC=$(STATIC)
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) build .
|
||||
$(MAKE) package
|
||||
release-testnet: ## Build testnet non-static binaries
|
||||
$(eval command += $(cmake_release) $(cmake_testnet))
|
||||
$(call CMAKE,$(dir_release),$(command)) && "$(MAKE)"
|
||||
|
||||
release: docs build
|
||||
(cd $(BUILD_FOLDER) && cpack)
|
||||
@rm -rf $(CURDIR)/build/packages/_CPack_Packages
|
||||
debug:
|
||||
$(eval command += $(cmake_debug))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
||||
|
||||
build: configure
|
||||
cmake --build --preset $(PRESET_BUILD) --parallel=$(CPU_CORES)
|
||||
debug-testnet:
|
||||
$(eval command += $(cmake_debug) $(cmake_testnet))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
||||
|
||||
build-deps: conan-profile-detect
|
||||
@echo "Build Dependencies: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --build=missing -s build_type=$(BUILD_TYPE)
|
||||
static: static-release
|
||||
static-release: ## Build release static binaries
|
||||
$(eval command += $(cmake_release) $(cmake_static))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
package:
|
||||
@echo "Packaging: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||
(cd $(BUILD_FOLDER) && cpack)
|
||||
ifneq ($(OS),Windows_NT)
|
||||
@rm -rf $(CURDIR)/build/packages/_CPack_Packages
|
||||
endif
|
||||
static-release-testnet: ## Build testnet release static binaries
|
||||
$(eval command += $(cmake_release) $(cmake_static) $(cmake_testnet))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
configure: build-deps
|
||||
@echo "Running Configure: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||
cmake --preset $(PRESET_CONFIGURE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||
#
|
||||
# CI
|
||||
#
|
||||
|
||||
docs: configure
|
||||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=docs --config=Release --parallel=$(CPU_CORES)
|
||||
ci-package-linux:
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build/release/src/letheand lethean/letheand
|
||||
@cp -r build/release/src/lethean-wallet lethean/lethean-wallet
|
||||
@chmod +x lethean/lethean*
|
||||
|
||||
sdk:
|
||||
$(MAKE) -C utils/sdk $(filter-out $@,$(MAKECMDGOALS)) PACKAGE_VERSION=$(BUILD_VERSION)
|
||||
ci-package-windows:
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build\\release\\src\\letheand.exe lethean\\letheand.exe
|
||||
@cp -r build\\release\\src\\lethean-wallet.exe lethean\\lethean-wallet.exe
|
||||
|
||||
# Rule for each profile — uses .build/cmake/profiles/
|
||||
$(PROFILES): conan-profile-detect
|
||||
@echo "Building profile: $@"
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . -pr:h=$(CMAKE_DIR)/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE)
|
||||
cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||
cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
|
||||
(cd $(BUILD_FOLDER) && cpack)
|
||||
ci-windows-amd64-release: static-release ci-package-windows ## Build lethean-windows-amd64-cli.tar.bz2
|
||||
@tar -cjvf lethean-windows-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
help:
|
||||
@echo "Lethean VPN Blockchain"
|
||||
@echo "======================"
|
||||
@echo "Website: https://lt.hn"
|
||||
@echo "GitHub: https://github.com/letheanVPN/blockchain/"
|
||||
@echo "Discord: https://discord.lt.hn"
|
||||
@echo ""
|
||||
@echo "Available targets:"
|
||||
@printf " %-42s %s\n" "make clean" "Clean all build directories"
|
||||
@printf " %-42s %s\n" "make conan-get" "Download and install conan locally"
|
||||
@printf " %-42s %s\n" "make release" "Build release"
|
||||
@printf " %-42s %s\n" "make testnet" "Build testnet"
|
||||
@printf " %-42s %s\n" "make mainnet" "Build mainnet"
|
||||
@printf " %-42s %s\n" "make test" "Build & run tests"
|
||||
@printf " %-42s %s\n" "make docs" "Builds offline documentation website"
|
||||
@printf " %-42s %s\n" "make docs-dev" "Runs local doc server, for editing/adding docs"
|
||||
@printf " %-42s %s\n" "make conan-profile-detect" "Creates host config"
|
||||
@printf " %-42s %s\n" "make configure" "Runs a cmake configure within conan build flow"
|
||||
@printf "\n --- Conan Cross-Compilation Profiles ---\n"
|
||||
@$(foreach profile,$(SORTED_PROFILES),printf " %-42s %s\n" "make $(profile)" "Build the $(profile) profile";)
|
||||
@printf "\n --- SDK Generation ---\n"
|
||||
@printf " %-42s %s\n" "make sdk" "Build all SDK packages"
|
||||
@$(foreach sdk,$(SORTED_SDK_TARGETS),printf " %-42s %s\n" "make sdk $(sdk)" "Build the $(sdk) SDK package";)
|
||||
@printf "\n"
|
||||
@printf " %-42s %s\n" "make help" "Show this help message"
|
||||
ci-linux-amd64-release: static-release ci-package-linux ## Build lethean-linux-amd64-cli.tar.bz2
|
||||
@tar -cjvf lethean-linux-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-amd64-release: static-release ci-package-linux ## Build lethean-macos-amd64-cli.tar.bz2
|
||||
@tar -cjvf lethean-macos-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-arm64-release: static-release ci-package-linux ## Build lethean-macos-arm64-cli.tar.bz2
|
||||
@tar -cjvf lethean-macos-arm64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-linux-amd64-testnet: ## Build testnet-lethean-linux-amd64-cli.tar.bz2
|
||||
conan install ./contrib/cmake -of=./build/release/conan --profile:build=$(conan_profile_linux) --profile:host=$(conan_profile_linux) --build=missing
|
||||
(cd build/release && cmake ../../ -DCMAKE_BUILD_TYPE=Release $(conan_toolchain) $(cmake_static) $(cmake_testnet))
|
||||
(cd build/release && cmake --build .)
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build/release/src/letheand lethean/letheand
|
||||
@cp -r build/release/src/lethean-wallet lethean/lethean-wallet
|
||||
@chmod +x lethean/lethean*
|
||||
@tar -cjvf testnet-lethean-linux-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
|
||||
|
||||
ci-windows-amd64-testnet: ## Build testnet-lethean-windows-amd64-cli.tar.bz2
|
||||
conan install ./contrib/cmake -of=./build/release/conan --profile:build=$(conan_profile_windows) --profile:host=$(conan_profile_windows) --build=missing
|
||||
(cd build/release && cmake ../../ -DCMAKE_BUILD_TYPE=Release $(conan_toolchain) $(cmake_static) $(cmake_testnet))
|
||||
(cd build/release && cmake --build .)
|
||||
@rm -fr lethean && mkdir -p lethean
|
||||
@cp -r build/release/src/letheand lethean/letheand
|
||||
@cp -r build/release/src/lethean-wallet lethean/lethean-wallet
|
||||
@chmod +x lethean/lethean*
|
||||
@tar -cjvf testnet-lethean-windows-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-amd64-testnet: static-release-testnet ci-package-linux ## Build testnet-lethean-macos-amd64-cli.tar.bz2
|
||||
@tar -cjvf testnet-lethean-macos-amd64-cli.tar.bz2 lethean/
|
||||
|
||||
ci-macos-arm64-testnet: static-release-testnet ci-package-linux ## Build testnet-lethean-macos-arm64-cli.tar.bz2
|
||||
@tar -cjvf testnet-lethean-macos-arm64-cli.tar.bz2 lethean/
|
||||
|
||||
conan:
|
||||
@conan config install contrib/cmake/settings_user.yml
|
||||
|
||||
|
||||
#
|
||||
# Tests
|
||||
#
|
||||
|
||||
test: test-release
|
||||
test-release:
|
||||
@echo "Building profile: test-release"
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-release --build=missing -s build_type=$(BUILD_TYPE)
|
||||
cmake -S . -B build/test-release -DCMAKE_TOOLCHAIN_FILE=build/test-release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON
|
||||
cmake --build build/test-release --config=Release --parallel=$(CPU_CORES)
|
||||
$(MAKE) test
|
||||
$(eval command += $(cmake_release) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
test-debug:
|
||||
@echo "Building profile: test-debug"
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-debug --build=missing -s build_type=$(BUILD_TYPE)
|
||||
cmake -S . -B build/test-debug -DCMAKE_TOOLCHAIN_FILE=build/test-debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -D BUILD_TESTS=ON
|
||||
cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES)
|
||||
$(MAKE) test
|
||||
|
||||
# Conan management — cmake modules from .build submodule
|
||||
conan-get:
|
||||
cmake -P $(CMAKE_DIR)/ConanGet.cmake
|
||||
ifneq ($(CONAN_USER),)
|
||||
(CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) remote add conan_build $(CONAN_URL) && \
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) remote login conan_build $(CONAN_USER) -p $(CONAN_PASSWORD)) || true
|
||||
endif
|
||||
|
||||
conan-upload:
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) upload "*" -r=conan_build --confirm
|
||||
|
||||
conan-profile-detect: conan-get
|
||||
cmake -P $(CMAKE_DIR)/ConanProfileSetup.cmake
|
||||
|
||||
docs-dev: configure
|
||||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=serve_docs --config=Release
|
||||
|
||||
$(SDK_TARGETS):
|
||||
@# This is a proxy target. Handled by the 'sdk' rule.
|
||||
$(eval command += $(cmake_debug) $(cmake_tests))
|
||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE) && $(MAKE) test
|
||||
|
||||
clean:
|
||||
@cmake -P $(CMAKE_DIR)/CleanBuild.cmake
|
||||
rm -rf ./build/release/ ./build/debug/
|
||||
|
||||
clean-build: clean
|
||||
rm -rf build
|
||||
macos-gui:
|
||||
bash ./utils/build/testnet_mac_osx_gui.sh
|
||||
|
||||
tags:
|
||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||
|
||||
.PHONY: all release upload-conan-cache docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect conan-get $(PROFILES) sdk $(SDK_TARGETS)
|
||||
help: ## Show this help
|
||||
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m make %-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags macos-gui ci-testnet ci-release
|
||||
.PHONY: ci-package-linux ci-linux-amd64-release ci-macos-amd64-release ci-macos-arm64-release ci-linux-amd64-testnet ci-macos-amd64-testnet ci-macos-arm64-testnet
|
||||
.PHONY: ci-package-windows ci-windows-amd64-release ci-windows-amd64-testnet
|
||||
|
|
|
|||
246
README.md
246
README.md
|
|
@ -1,120 +1,194 @@
|
|||
# Lethean Network—Ethics, Encoded.
|
||||
# Addresses
|
||||
|
||||
> We are building upto a mainnet launch in 2026, documentation written as if mainnet is live.
|
||||
- `iT`/`0x73f7` - Main prefix
|
||||
- `iTH`/`0x6af7` - integrated paymennt_id address prefix
|
||||
- `iTHn`/`0xdeaf7` - auditable wallet address
|
||||
- `iTHa`/`0x7eaf7` - auditable integrated paymennt_id address prefix
|
||||
|
||||
A buildkit for deploying confidential information networks and commerce systems with immutable auditability.
|
||||
## Ports
|
||||
|
||||
Free for commercial, private, and patent use, self-host or join the community-run network that guarantees participant sovereignty by design.
|
||||
- STRATUM: `36941`
|
||||
- RPC: `36942`
|
||||
- P2P: `36943`
|
||||
## Cloning
|
||||
|
||||
Be sure to clone the repository properly:\
|
||||
`$ git clone --recursive https://github.com/letheanVPN/blockchain-iTw3.git`
|
||||
|
||||
|
||||
[](https://discord.gg/pfgT2Kz)
|
||||
|
||||
Web2 Website: https://lt.hn/
|
||||
|
||||
Web3 Network Gateway [HNS](https://handshake.org): [https://lthn](https://www.namebase.io/domains/lthn)
|
||||
<br/>_(our chain aliases will come with a working Web2(`*.lt.hn`)+Web3(`*.lthn`) domain name)_
|
||||
# Building
|
||||
--------
|
||||
|
||||
|
||||
### Dependencies
|
||||
| component / version | minimum <br>(not recommended but may work) | recommended | most recent of what we have ever tested |
|
||||
|-----------------------------------------------------------------------------|--------------------------------------------|----------------|-----------------------------------------|
|
||||
| gcc (Linux) | 8.4.0 | 9.4.0 | 12.3.0 |
|
||||
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
|
||||
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) |
|
||||
| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 |
|
||||
| [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 |
|
||||
| component / version | minimum <br>(not recommended but may work) | recommended | most recent of what we have ever tested |
|
||||
|--|--|--|--|
|
||||
| gcc (Linux) | 5.4.0 | 9.4.0 | 12.3.0 |
|
||||
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
|
||||
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2017 (15.9.30) | 2022 (17.7.5) |
|
||||
| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 14.3 |
|
||||
| [CMake](https://cmake.org/download/) | 3.15.5 | 3.22.1 | 3.26.3 |
|
||||
| [Boost](https://www.boost.org/users/download/) | 1.70 | 1.70 | 1.76 |
|
||||
| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | 1.1.1n | 1.1.1w | 1.1.1w |
|
||||
| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.11.2 | 5.15.2 |
|
||||
|
||||
## Cloning
|
||||
Note:\
|
||||
[*server version*] denotes steps required for building command-line tools (daemon, simplewallet, etc.).\
|
||||
[*GUI version*] denotes steps required for building LTHN executable with GUI.
|
||||
|
||||
Be sure to clone the repository properly, with `--recursive` flag, or you'll get angry:<br/>
|
||||
`git clone --recursive https://github.com/letheanVPN/blockchain.git`
|
||||
<br />
|
||||
|
||||
# Building
|
||||
### Linux
|
||||
|
||||
The project uses a `Makefile` that provides a simple and powerful interface for building.
|
||||
It automatically handles dependency installation with Conan and compilation with CMake.
|
||||
Recommended OS versions: Ubuntu 20.04, 22.04 LTS.
|
||||
|
||||
You need CMake and Make installed on your system, other than that you don't need to worry about Python, Conan, Boost, OpenSSL, or any other dependencies.
|
||||
1. Prerequisites
|
||||
|
||||
The final packages are created as they are due to a historical distribution method used in china: USB Stick, CD, DVD, etc.
|
||||
[*server version*]
|
||||
|
||||
sudo apt-get install -y build-essential g++ curl autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev
|
||||
|
||||
[*GUI version*]
|
||||
|
||||
We use CPack, so our packages are self-contained, have searchable HTML documentation, and are ready to be installed on any system.
|
||||
sudo apt-get install -y build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev mesa-common-dev libglu1-mesa-dev
|
||||
|
||||
To skip the packing step, use `make build` as defined in the section below for Advanced Build Customization
|
||||
2. Clone Zano into a local folder\
|
||||
(If for some reason you need to use alternative Zano branch, change 'master' to the required branch name.)
|
||||
|
||||
git clone --recursive https://github.com/hyle-team/zano.git -b master
|
||||
|
||||
## Simple Workflow Builds (Recommended)
|
||||
In the following steps we assume that you cloned Zano into '~/zano' folder in your home directory.
|
||||
|
||||
For most use cases, these two commands are all you need. They handle the entire build process from start to finish.
|
||||
3. Download and build Boost\
|
||||
(Assuming you have cloned Zano into the 'zano' folder. If you used a different location for Zano, **edit line 4** accordingly.)
|
||||
|
||||
* **Build for Mainnet:**
|
||||
```shell
|
||||
make mainnet
|
||||
```
|
||||
curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2
|
||||
echo "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2" | shasum -c && tar -xjf boost_1_70_0.tar.bz2
|
||||
rm boost_1_70_0.tar.bz2 && cd boost_1_70_0
|
||||
patch -p0 < ../zano/utils/boost_1.70_gcc_8.patch || cd ..
|
||||
./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log
|
||||
./b2 && cd ..
|
||||
Make sure that you see "The Boost C++ Libraries were successfully built!" message at the end.
|
||||
|
||||
* **Build for Testnet:**
|
||||
```shell
|
||||
make testnet
|
||||
```
|
||||
4. Install Qt\
|
||||
(*GUI version only, skip this step if you're building server version*)
|
||||
|
||||
## Creating Release Packages
|
||||
[*GUI version*]
|
||||
|
||||
To create distributable packages (e.g., `.zip`, `.msi`, `.pkg`, `.deb`), run the `release` target. This will build the project, build the documentation, and then package everything.
|
||||
curl -OL https://download.qt.io/new_archive/qt/5.11/5.11.2/qt-opensource-linux-x64-5.11.2.run
|
||||
chmod +x qt-opensource-linux-x64-5.11.2.run
|
||||
./qt-opensource-linux-x64-5.11.2.run
|
||||
Then follow the instructions in Wizard. Don't forget to tick the WebEngine module checkbox!
|
||||
|
||||
```shell
|
||||
make release TESTNET=1
|
||||
```
|
||||
The final packages will be located in the `build/packages/` directory
|
||||
|
||||
## Advanced Build Customization (Makefile Variables)
|
||||
5. Install OpenSSL
|
||||
|
||||
For advanced use cases, you can override variables in the `Makefile` to customize the build process.
|
||||
We recommend installing OpenSSL v1.1.1w locally unless you would like to use the same version system-wide.\
|
||||
(Assuming that `$HOME` environment variable is set to your home directory. Otherwise, edit line 4 accordingly.)
|
||||
|
||||
* **Build a `testnet` version:**
|
||||
```shell
|
||||
make build TESTNET=1
|
||||
```
|
||||
* **Build a statically-linked version:**
|
||||
```shell
|
||||
make build STATIC=1
|
||||
```
|
||||
* **Build a Debug build with 8 compile threads:**
|
||||
```shell
|
||||
make build BUILD_TYPE=Debug CPU_CORES=8
|
||||
```
|
||||
* **Use custom CMakePresets:**
|
||||
```shell
|
||||
make build PRESET_CONFIGURE=my-config-preset PRESET_BUILD=my-build-preset
|
||||
```
|
||||
curl -OL https://www.openssl.org/source/openssl-1.1.1w.tar.gz
|
||||
echo "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 openssl-1.1.1w.tar.gz" | shasum -c && tar xaf openssl-1.1.1w.tar.gz
|
||||
cd openssl-1.1.1w/
|
||||
./config --prefix=$HOME/openssl --openssldir=$HOME/openssl shared zlib
|
||||
make && make test && make install && cd ..
|
||||
|
||||
| Variable | Description | Default Value |
|
||||
|--------------------|------------------------------------------------------------------------|-------------------------|
|
||||
| `BUILD_TYPE` | Sets the build configuration (e.g., `Release`, `Debug`). | `Release` |
|
||||
| `TESTNET` | Set to `1` to build for the test network. | `0` |
|
||||
| `STATIC` | Set to `1` to link libraries statically. | `0` |
|
||||
| `CPU_CORES` | Number of CPU cores to use for parallel compilation. | Auto-detected |
|
||||
| `BUILD_VERSION` | The version string to embed in the binaries. | `6.0.1` |
|
||||
| `BUILD_FOLDER` | The output directory for the build. | `build/release` |
|
||||
| `PRESET_CONFIGURE` | The CMake preset to use for the `configure` step. | `conan-release` |
|
||||
| `PRESET_BUILD` | The CMake preset to use for the `build` step. | `conan-release` |
|
||||
| `CONAN_CACHE` | The path for the local Conan cache, where the dependencies are stored. | `./build/sdk` |
|
||||
| `CONAN_EXECUTABLE` | The path to the usable Conan executable. | `./build/bin/conan` |
|
||||
| `CONAN_URL` | The URL for the Conan remote repository. | `artifacts.host.uk.com` |
|
||||
| `CONAN_USER` | The username for the Conan remote. | `public` |
|
||||
| `CONAN_PASSWORD` | The password for the Conan remote. | |
|
||||
|
||||
## Cleaning the Build Directory
|
||||
6. [*OPTIONAL*] Set global environment variables for convenient use\
|
||||
For instance, by adding the following lines to `~/.bashrc`
|
||||
|
||||
ALWAYS USE `make clean` to clean the build directory, manually deleting the `build/release`, `build/SOME_FOLDER` will cause you issues.
|
||||
[*server version*]
|
||||
|
||||
Our `make clean` triggers a cmake script that completely resets the build directory & dynamically added CMakePresets to its cached warm-up state,
|
||||
the selective clean script can be edited here: `cmake/CleanBuild.cmake` or directly run from the repo root `cmake -P cmake/CleanBuild.cmake`
|
||||
export BOOST_ROOT=/home/user/boost_1_70_0
|
||||
export OPENSSL_ROOT_DIR=/home/user/openssl
|
||||
|
||||
You can NUKE the build directory with `make clean-build` which is `rm -rf build`.
|
||||
|
||||
If you do manually delete build folders and get CMake errors (if you have compiled anything previously, you will),
|
||||
the ConanPresets.json file has entries in the `include` property, delete them all and try again.
|
||||
[*GUI version*]
|
||||
|
||||
This happens because CMakePresets.json includes ConanPresets.json, that has the list of toolchains to use that gets populated during the CMake config step,
|
||||
when you manually delete a folder, the toolchain is now a broken path, and CMake throws a fatal error.
|
||||
export BOOST_ROOT=/home/user/boost_1_70_0
|
||||
export OPENSSL_ROOT_DIR=/home/user/openssl
|
||||
export QT_PREFIX_PATH=/home/user/Qt5.11.2/5.11.2/gcc_64
|
||||
|
||||
**NOTICE: Please edit the lines above according to your actual paths.**
|
||||
|
||||
**NOTICE 2:** Make sure you've restarted your terminal session (by reopening the terminal window or reconnecting the server) to apply these changes.
|
||||
|
||||
8. Build the binaries
|
||||
1. If you skipped step 6 and did not set the environment variables:
|
||||
|
||||
cd zano && mkdir build && cd build
|
||||
BOOST_ROOT=$HOME/boost_1_70_0 OPENSSL_ROOT_DIR=$HOME/openssl cmake ..
|
||||
make -j1 daemon simplewallet
|
||||
|
||||
cd lthn/ && make -j1
|
||||
or
|
||||
|
||||
cd lthn && mkdir build && cd build
|
||||
cmake ..
|
||||
make -j1 daemon simplewallet
|
||||
|
||||
or simply:
|
||||
|
||||
cd zano && make -j1
|
||||
|
||||
**NOTICE**: If you are building on a machine with a relatively high amount of RAM or with the proper setting of virtual memory, then you can use `-j2` or `-j` option to speed up the building process. Use with caution.
|
||||
|
||||
**NOTICE 2**: If you'd like to build binaries for the testnet, use `cmake -D TESTNET=TRUE ..` instead of `cmake ..` .
|
||||
|
||||
1. Build GUI:
|
||||
|
||||
cd lthn
|
||||
utils/build_script_linux.sh
|
||||
|
||||
Look for the binaries in `build` folder
|
||||
|
||||
<br />
|
||||
|
||||
### Windows
|
||||
Recommended OS versions: Windows 7+ x64, Windows 11 x64.
|
||||
|
||||
1. Install [Chocolatey](https://chocolatey.org/install)
|
||||
2. Install required prerequisites (Boost, Qt, CMake, OpenSSL).
|
||||
|
||||
_NOTE: At time of writing the following versions were available on Chocolatey_
|
||||
```
|
||||
choco install boost-msvc-14.2 --version 1.74.0 -y
|
||||
choco install qt5-default --version 5.15.2.20211228 -y
|
||||
choco install cmake --version 3.23.1 -y
|
||||
choco install openssl --version 1.1.1.1500 -y
|
||||
```
|
||||
|
||||
3. Clone repository, then complete the following:
|
||||
1. Edit paths in file `utils/configure_local_paths.cmd.example`.
|
||||
2. Rename `configure_local_paths.cmd.example` to `configure_local_paths.cmd` (do not commit).
|
||||
4. Run one of `utils/configure_win64_msvsNNNN_gui.cmd` according to your MSVC version.
|
||||
5. Go to the build folder and open generated Zano.sln in MSVC.
|
||||
6. Build.
|
||||
|
||||
In order to correctly deploy Qt GUI application, you also need to do the following:
|
||||
|
||||
6. Copy Lethean.exe to a folder (e.g. `depoy`).
|
||||
7. Run `PATH_TO_QT\bin\windeployqt.exe deploy\Lethean.exe`.
|
||||
8. Copy folder `\src\gui\qt-daemon\html` to `deploy\html`.
|
||||
9. Now you can run `Lethean.exe`
|
||||
|
||||
<br />
|
||||
|
||||
### macOS
|
||||
Recommended OS version: macOS Big Sur 11.4 x64.
|
||||
1. Install required prerequisites.
|
||||
2. Set environment variables as stated in `utils/macosx_build_config.command`.
|
||||
3. `mkdir build` <br> `cd build` <br> `cmake ..` <br> `make`
|
||||
|
||||
To build GUI application:
|
||||
|
||||
1. Create self-signing certificate via Keychain Access:\
|
||||
a. Run Keychain Access.\
|
||||
b. Choose Keychain Access > Certificate Assistant > Create a Certificate.\
|
||||
c. Use “LetheanVPN” (without quotes) as certificate name.\
|
||||
d. Choose “Code Signing” in “Certificate Type” field.\
|
||||
e. Press “Create”, then “Done”.\
|
||||
f. Make sure the certificate was added to keychain "System". If not—move it to "System".\
|
||||
g. Double click the certificate you've just added, enter the trust section and under "When using this certificate" select "Always trust".\
|
||||
h. Unfold the certificate in Keychain Access window and double click the underlying private key "LetheanVPN". Select "Access Control" tab, then select "Allow all applications to access this item". Click "Save Changes".
|
||||
2. Revise building script, comment out unwanted steps and run it: `utils/build_script_mac_osx.sh`
|
||||
3. The application should be here: `/buid_mac_osx_64/release/src`
|
||||
|
||||
|
|
|
|||
8
build/profiles/linux-amd64
Normal file
8
build/profiles/linux-amd64
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[settings]
|
||||
arch=x86_64
|
||||
build_type=Release
|
||||
compiler=gcc
|
||||
compiler.cppstd=gnu17
|
||||
compiler.libcxx=libstdc++11
|
||||
compiler.version=11
|
||||
os=Linux
|
||||
8
build/profiles/windows-amd64
Normal file
8
build/profiles/windows-amd64
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[settings]
|
||||
arch=x86_64
|
||||
build_type=Release
|
||||
compiler=msvc
|
||||
compiler.cppstd=14
|
||||
compiler.runtime=dynamic
|
||||
compiler.version=193
|
||||
os=Windows
|
||||
5
build/settings_user.yml
Normal file
5
build/settings_user.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
compiler:
|
||||
gcc:
|
||||
version: ["9.4.0","11.4.0"]
|
||||
apple-clang:
|
||||
version: ["13.0.0.13000029", "14.0.0.14000029", "15.0.0.15000040", "15.0.0.15000309"]
|
||||
70
conanfile.py
70
conanfile.py
|
|
@ -1,70 +0,0 @@
|
|||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake
|
||||
|
||||
|
||||
class BlockchainConan(ConanFile):
|
||||
name = "blockchain"
|
||||
version = "6.0.1"
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
|
||||
options = {
|
||||
"static": [True, False],
|
||||
"testnet": [True, False],
|
||||
"ci": [True, False]
|
||||
}
|
||||
default_options = {
|
||||
"static": False,
|
||||
"testnet": False,
|
||||
"ci": False,
|
||||
"boost/*:without_test": True
|
||||
}
|
||||
|
||||
tool_requires = [
|
||||
"cmake/3.31.9"
|
||||
]
|
||||
|
||||
requires = [
|
||||
"zlib/1.3.1",
|
||||
"boost/1.85.0",
|
||||
"openssl/3.2.0",
|
||||
"miniupnpc/2.2.5",
|
||||
"jwt-cpp/0.7.1",
|
||||
"oatpp/1.3.0.latest",
|
||||
"oatpp-swagger/1.3.0.latest"
|
||||
]
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
os_val = str(self.settings.os).lower()
|
||||
# arch_val = str(self.settings.arch).lower()
|
||||
# compiler_val = str(self.settings.compiler).lower()
|
||||
# tc.presets_prefix = f"{os_val}"
|
||||
|
||||
tc.user_presets_path = "ConanPresets.json"
|
||||
tc.variables["STATIC"] = self.options.static
|
||||
tc.variables["TESTNET"] = self.options.testnet
|
||||
# tc.preprocessor_definitions["TESTNET"] = None
|
||||
# tc.variables["BUILD_VERSION"] = self.options.build_version
|
||||
tc.generate()
|
||||
|
||||
deps = CMakeDeps(self)
|
||||
deps.generate()
|
||||
|
||||
def layout(self):
|
||||
if self.settings.compiler == "msvc":
|
||||
# For multi-config, all configurations go into the same "build" folder.
|
||||
self.folders.build = "build/release"
|
||||
self.folders.generators = "build/release/generators"
|
||||
else:
|
||||
# For single-config, we create a subfolder for each build type.
|
||||
build_type_str = str(self.settings.build_type).lower()
|
||||
self.folders.build = os.path.join("build", build_type_str)
|
||||
self.folders.generators = os.path.join(self.folders.build, "generators")
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
|
@ -1,23 +1,12 @@
|
|||
|
||||
set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library")
|
||||
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library")
|
||||
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables")
|
||||
add_subdirectory(zlib)
|
||||
add_subdirectory(db)
|
||||
add_subdirectory(ethereum)
|
||||
add_subdirectory(randomx)
|
||||
|
||||
if(USE_BITCOIN_SECP256K1_FOR_ECDSA)
|
||||
option(SECP256K1_BUILD_BENCHMARK "Build benchmarks." OFF)
|
||||
option(SECP256K1_BUILD_TESTS "Build tests." OFF)
|
||||
option(SECP256K1_BUILD_EXHAUSTIVE_TESTS "Build exhaustive tests." OFF)
|
||||
option(SECP256K1_BUILD_CTIME_TESTS "Build constant-time tests." OFF)
|
||||
option(SECP256K1_BUILD_EXAMPLES "Build examples." OFF)
|
||||
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
|
||||
|
||||
if(STATIC)
|
||||
set(SECP256K1_DISABLE_SHARED ON CACHE BOOL "Disable shared library for secp256k1")
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries by default" FORCE)
|
||||
endif()
|
||||
add_subdirectory(bitcoin-secp256k1)
|
||||
set_property(TARGET secp256k1 PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET secp256k1_precomputed PROPERTY FOLDER "contrib")
|
||||
if( NOT DISABLE_TOR)
|
||||
add_subdirectory(tor-connect)
|
||||
endif()
|
||||
|
||||
|
||||
|
|
@ -26,8 +15,46 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|||
return()
|
||||
endif()
|
||||
|
||||
|
||||
find_package(Miniupnpc REQUIRED)
|
||||
|
||||
message(STATUS "Using in-tree miniupnpc")
|
||||
set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
|
||||
add_subdirectory(miniupnp/miniupnpc)
|
||||
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
if(MSVC)
|
||||
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
|
||||
elseif(NOT MSVC)
|
||||
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
|
||||
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
|
||||
endif()
|
||||
|
||||
set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
|
||||
|
||||
|
||||
|
||||
#set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET zlibstatic PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET mdbx PROPERTY FOLDER "contrib")
|
||||
set_property(TARGET lmdb PROPERTY FOLDER "contrib")
|
||||
|
||||
if( NOT DISABLE_TOR)
|
||||
set_property(TARGET tor-connect PROPERTY FOLDER "contrib")
|
||||
endif()
|
||||
|
||||
set_property(TARGET mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTY FOLDER "unused")
|
||||
|
||||
if(MSVC)
|
||||
#set_property(TARGET ntdll_extra_target PROPERTY FOLDER "unused")
|
||||
endif()
|
||||
|
||||
|
||||
if(MSVC)
|
||||
# set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4244 /wd4267")
|
||||
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4267 /wd4267")
|
||||
else()
|
||||
# set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-ignored-qualifiers ")
|
||||
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-ignored-qualifiers ")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Subproject commit a5269373fa13ff845f654d81b90629dd78495641
|
||||
22
contrib/cmake/ConfigOpenSSL.cmake
Normal file
22
contrib/cmake/ConfigOpenSSL.cmake
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
if (APPLE AND NOT IOS)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default")
|
||||
if (NOT OPENSSL_ROOT_DIR)
|
||||
EXECUTE_PROCESS(COMMAND brew --prefix openssl
|
||||
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message(STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
message(STATUS "Using OpenSSL include dir at ${OPENSSL_INCLUDE_DIR}")
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
if(STATIC AND NOT IOS)
|
||||
if(UNIX)
|
||||
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS};${CMAKE_THREAD_LIBS_INIT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND OPENSSL_LIBRARIES ws2_32 crypt32)
|
||||
endif()
|
||||
67
contrib/cmake/FindCcache.cmake
Normal file
67
contrib/cmake/FindCcache.cmake
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# Copyright (c) 2014-2022, The Monero Project
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification, are
|
||||
# permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software without specific
|
||||
# prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# - Try to find readline include dirs and libraries
|
||||
#
|
||||
# Automatically finds ccache build accelerator, if it's found in PATH.
|
||||
#
|
||||
# Usage of this module as follows:
|
||||
#
|
||||
# project(monero)
|
||||
# include(FindCcache) # Include AFTER the project() macro to be able to reach the CMAKE_CXX_COMPILER variable
|
||||
#
|
||||
# Properties modified by this module:
|
||||
#
|
||||
# GLOBAL PROPERTY RULE_LAUNCH_COMPILE set to ccache, when ccache found
|
||||
# GLOBAL PROPERTY RULE_LAUNCH_LINK set to ccache, when ccache found
|
||||
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if (CCACHE_FOUND)
|
||||
# Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups)
|
||||
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp")
|
||||
file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(test)
|
||||
option (CCACHE "")
|
||||
file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}")
|
||||
add_executable(main test.cpp)
|
||||
]=])
|
||||
try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}")
|
||||
unset(TEST_PROJECT)
|
||||
if (${RET})
|
||||
# Success
|
||||
message(STATUS "Found usable ccache: ${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}")
|
||||
else()
|
||||
message(STATUS "Found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "ccache NOT found! Please install it for faster rebuilds.")
|
||||
endif()
|
||||
59
contrib/cmake/FindMiniupnpc.cmake
Normal file
59
contrib/cmake/FindMiniupnpc.cmake
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# --------------------------------- FindMiniupnpc Start ---------------------------------
|
||||
# Locate miniupnp library
|
||||
# This module defines
|
||||
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
|
||||
# MINIUPNP_LIBRARY, the miniupnp variant
|
||||
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
|
||||
# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
|
||||
#
|
||||
# Note that the expected include convention is
|
||||
# #include "miniupnpc.h"
|
||||
# and not
|
||||
# #include <miniupnpc/miniupnpc.h>
|
||||
# This is because, the miniupnpc location is not standardized and may exist
|
||||
# in locations other than miniupnpc/
|
||||
|
||||
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||
# Already in cache, be silent
|
||||
set(MINIUPNP_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
|
||||
HINTS $ENV{MINIUPNP_INCLUDE_DIR}
|
||||
PATH_SUFFIXES miniupnpc
|
||||
)
|
||||
|
||||
find_library(MINIUPNP_LIBRARY miniupnpc
|
||||
HINTS $ENV{MINIUPNP_LIBRARY}
|
||||
)
|
||||
|
||||
find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
|
||||
HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
|
||||
)
|
||||
|
||||
set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
|
||||
set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
MiniUPnPc DEFAULT_MSG
|
||||
MINIUPNP_INCLUDE_DIR
|
||||
MINIUPNP_LIBRARY
|
||||
)
|
||||
|
||||
IF(MINIUPNPC_FOUND)
|
||||
file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
|
||||
if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
|
||||
set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
|
||||
if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
|
||||
message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
|
||||
set(MINIUPNP_FOUND true)
|
||||
set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
|
||||
# --------------------------------- FindMiniupnpc End ---------------------------------
|
||||
631
contrib/cmake/conan_provider.cmake
Normal file
631
contrib/cmake/conan_provider.cmake
Normal file
|
|
@ -0,0 +1,631 @@
|
|||
# This file is managed by Conan, contents will be overwritten.
|
||||
# To keep your changes, remove these comment lines, but the plugin won't be able to modify your requirements
|
||||
|
||||
set(CONAN_MINIMUM_VERSION 2.0.5)
|
||||
|
||||
|
||||
function(detect_os OS OS_API_LEVEL OS_SDK OS_SUBSYSTEM OS_VERSION)
|
||||
# it could be cross compilation
|
||||
message(STATUS "CMake-Conan: cmake_system_name=${CMAKE_SYSTEM_NAME}")
|
||||
if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(${OS} Macos PARENT_SCOPE)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX")
|
||||
set(${OS} Neutrino PARENT_SCOPE)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
|
||||
set(${OS} Windows PARENT_SCOPE)
|
||||
set(${OS_SUBSYSTEM} cygwin PARENT_SCOPE)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "^MSYS")
|
||||
set(${OS} Windows PARENT_SCOPE)
|
||||
set(${OS_SUBSYSTEM} msys2 PARENT_SCOPE)
|
||||
else()
|
||||
set(${OS} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
if(DEFINED ANDROID_PLATFORM)
|
||||
string(REGEX MATCH "[0-9]+" _OS_API_LEVEL ${ANDROID_PLATFORM})
|
||||
elseif(DEFINED CMAKE_SYSTEM_VERSION)
|
||||
set(_OS_API_LEVEL ${CMAKE_SYSTEM_VERSION})
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: android api level=${_OS_API_LEVEL}")
|
||||
set(${OS_API_LEVEL} ${_OS_API_LEVEL} PARENT_SCOPE)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS")
|
||||
# CMAKE_OSX_SYSROOT contains the full path to the SDK for MakeFile/Ninja
|
||||
# generators, but just has the original input string for Xcode.
|
||||
if(NOT IS_DIRECTORY ${CMAKE_OSX_SYSROOT})
|
||||
set(_OS_SDK ${CMAKE_OSX_SYSROOT})
|
||||
else()
|
||||
if(CMAKE_OSX_SYSROOT MATCHES Simulator)
|
||||
set(apple_platform_suffix simulator)
|
||||
else()
|
||||
set(apple_platform_suffix os)
|
||||
endif()
|
||||
if(CMAKE_OSX_SYSROOT MATCHES AppleTV)
|
||||
set(_OS_SDK "appletv${apple_platform_suffix}")
|
||||
elseif(CMAKE_OSX_SYSROOT MATCHES iPhone)
|
||||
set(_OS_SDK "iphone${apple_platform_suffix}")
|
||||
elseif(CMAKE_OSX_SYSROOT MATCHES Watch)
|
||||
set(_OS_SDK "watch${apple_platform_suffix}")
|
||||
endif()
|
||||
endif()
|
||||
if(DEFINED _OS_SDK)
|
||||
message(STATUS "CMake-Conan: cmake_osx_sysroot=${CMAKE_OSX_SYSROOT}")
|
||||
set(${OS_SDK} ${_OS_SDK} PARENT_SCOPE)
|
||||
endif()
|
||||
if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
|
||||
message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||||
set(${OS_VERSION} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_arch ARCH)
|
||||
# CMAKE_OSX_ARCHITECTURES can contain multiple architectures, but Conan only supports one.
|
||||
# Therefore this code only finds one. If the recipes support multiple architectures, the
|
||||
# build will work. Otherwise, there will be a linker error for the missing architecture(s).
|
||||
if(DEFINED CMAKE_OSX_ARCHITECTURES)
|
||||
string(REPLACE " " ";" apple_arch_list "${CMAKE_OSX_ARCHITECTURES}")
|
||||
list(LENGTH apple_arch_list apple_arch_count)
|
||||
if(apple_arch_count GREATER 1)
|
||||
message(WARNING "CMake-Conan: Multiple architectures detected, this will only work if Conan recipe(s) produce fat binaries.")
|
||||
endif()
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS" AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "")
|
||||
set(host_arch ${CMAKE_OSX_ARCHITECTURES})
|
||||
elseif(MSVC)
|
||||
set(host_arch ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
|
||||
else()
|
||||
set(host_arch ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
if(host_arch MATCHES "aarch64|arm64|ARM64")
|
||||
set(_ARCH armv8)
|
||||
elseif(host_arch MATCHES "armv7|armv7-a|armv7l|ARMV7")
|
||||
set(_ARCH armv7)
|
||||
elseif(host_arch MATCHES armv7s)
|
||||
set(_ARCH armv7s)
|
||||
elseif(host_arch MATCHES "i686|i386|X86")
|
||||
set(_ARCH x86)
|
||||
elseif(host_arch MATCHES "AMD64|amd64|x86_64|x64")
|
||||
set(_ARCH x86_64)
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}")
|
||||
set(${ARCH} ${_ARCH} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_cxx_standard CXX_STANDARD)
|
||||
set(${CXX_STANDARD} ${CMAKE_CXX_STANDARD} PARENT_SCOPE)
|
||||
if(CMAKE_CXX_EXTENSIONS)
|
||||
set(${CXX_STANDARD} "gnu${CMAKE_CXX_STANDARD}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
macro(detect_gnu_libstdcxx)
|
||||
# _CONAN_IS_GNU_LIBSTDCXX true if GNU libstdc++
|
||||
check_cxx_source_compiles("
|
||||
#include <cstddef>
|
||||
#if !defined(__GLIBCXX__) && !defined(__GLIBCPP__)
|
||||
static_assert(false);
|
||||
#endif
|
||||
int main(){}" _CONAN_IS_GNU_LIBSTDCXX)
|
||||
|
||||
# _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI true if C++11 ABI
|
||||
check_cxx_source_compiles("
|
||||
#include <string>
|
||||
static_assert(sizeof(std::string) != sizeof(void*), \"using libstdc++\");
|
||||
int main () {}" _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
|
||||
|
||||
set(_CONAN_GNU_LIBSTDCXX_SUFFIX "")
|
||||
if(_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
|
||||
set(_CONAN_GNU_LIBSTDCXX_SUFFIX "11")
|
||||
endif()
|
||||
unset (_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(detect_libcxx)
|
||||
# _CONAN_IS_LIBCXX true if LLVM libc++
|
||||
check_cxx_source_compiles("
|
||||
#include <cstddef>
|
||||
#if !defined(_LIBCPP_VERSION)
|
||||
static_assert(false);
|
||||
#endif
|
||||
int main(){}" _CONAN_IS_LIBCXX)
|
||||
endmacro()
|
||||
|
||||
|
||||
function(detect_lib_cxx LIB_CXX)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||
message(STATUS "CMake-Conan: android_stl=${CMAKE_ANDROID_STL_TYPE}")
|
||||
set(${LIB_CXX} ${CMAKE_ANDROID_STL_TYPE} PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
detect_gnu_libstdcxx()
|
||||
set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
|
||||
set(${LIB_CXX} "libc++" PARENT_SCOPE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
# Check for libc++
|
||||
detect_libcxx()
|
||||
if(_CONAN_IS_LIBCXX)
|
||||
set(${LIB_CXX} "libc++" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Check for libstdc++
|
||||
detect_gnu_libstdcxx()
|
||||
if(_CONAN_IS_GNU_LIBSTDCXX)
|
||||
set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO: it would be an error if we reach this point
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
# Do nothing - compiler.runtime and compiler.runtime_type
|
||||
# should be handled separately: https://github.com/conan-io/cmake-conan/pull/516
|
||||
return()
|
||||
else()
|
||||
# TODO: unable to determine, ask user to provide a full profile file instead
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_compiler COMPILER COMPILER_VERSION COMPILER_RUNTIME COMPILER_RUNTIME_TYPE)
|
||||
if(DEFINED CMAKE_CXX_COMPILER_ID)
|
||||
set(_COMPILER ${CMAKE_CXX_COMPILER_ID})
|
||||
set(_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
|
||||
else()
|
||||
if(NOT DEFINED CMAKE_C_COMPILER_ID)
|
||||
message(FATAL_ERROR "C or C++ compiler not defined")
|
||||
endif()
|
||||
set(_COMPILER ${CMAKE_C_COMPILER_ID})
|
||||
set(_COMPILER_VERSION ${CMAKE_C_COMPILER_VERSION})
|
||||
endif()
|
||||
|
||||
message(STATUS "CMake-Conan: CMake compiler=${_COMPILER}")
|
||||
message(STATUS "CMake-Conan: CMake compiler version=${_COMPILER_VERSION}")
|
||||
|
||||
if(_COMPILER MATCHES MSVC)
|
||||
set(_COMPILER "msvc")
|
||||
string(SUBSTRING ${MSVC_VERSION} 0 3 _COMPILER_VERSION)
|
||||
# Configure compiler.runtime and compiler.runtime_type settings for MSVC
|
||||
if(CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY})
|
||||
else()
|
||||
set(_msvc_runtime_library MultiThreaded$<$<CONFIG:Debug>:Debug>DLL) # default value documented by CMake
|
||||
endif()
|
||||
|
||||
set(_KNOWN_MSVC_RUNTIME_VALUES "")
|
||||
list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded MultiThreadedDLL)
|
||||
list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreadedDebug MultiThreadedDebugDLL)
|
||||
list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded$<$<CONFIG:Debug>:Debug> MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
|
||||
|
||||
# only accept the 6 possible values, otherwise we don't don't know to map this
|
||||
if(NOT _msvc_runtime_library IN_LIST _KNOWN_MSVC_RUNTIME_VALUES)
|
||||
message(FATAL_ERROR "CMake-Conan: unable to map MSVC runtime: ${_msvc_runtime_library} to Conan settings")
|
||||
endif()
|
||||
|
||||
# Runtime is "dynamic" in all cases if it ends in DLL
|
||||
if(_msvc_runtime_library MATCHES ".*DLL$")
|
||||
set(_COMPILER_RUNTIME "dynamic")
|
||||
else()
|
||||
set(_COMPILER_RUNTIME "static")
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: CMake compiler.runtime=${_COMPILER_RUNTIME}")
|
||||
|
||||
# Only define compiler.runtime_type when explicitly requested
|
||||
# If a generator expression is used, let Conan handle it conditional on build_type
|
||||
if(NOT _msvc_runtime_library MATCHES "<CONFIG:Debug>:Debug>")
|
||||
if(_msvc_runtime_library MATCHES "Debug")
|
||||
set(_COMPILER_RUNTIME_TYPE "Debug")
|
||||
else()
|
||||
set(_COMPILER_RUNTIME_TYPE "Release")
|
||||
endif()
|
||||
message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}")
|
||||
endif()
|
||||
|
||||
unset(_KNOWN_MSVC_RUNTIME_VALUES)
|
||||
|
||||
elseif(_COMPILER MATCHES AppleClang)
|
||||
set(_COMPILER "apple-clang")
|
||||
string(REPLACE "src" ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 _COMPILER_VERSION)
|
||||
elseif(_COMPILER MATCHES Clang)
|
||||
set(_COMPILER "clang")
|
||||
string(REPLACE "src" ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 _COMPILER_VERSION)
|
||||
elseif(_COMPILER MATCHES GNU)
|
||||
set(_COMPILER "gcc")
|
||||
string(REPLACE "src" ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 _COMPILER_VERSION)
|
||||
endif()
|
||||
|
||||
message(STATUS "CMake-Conan: [settings] compiler=${_COMPILER}")
|
||||
message(STATUS "CMake-Conan: [settings] compiler.version=${_COMPILER_VERSION}")
|
||||
if (_COMPILER_RUNTIME)
|
||||
message(STATUS "CMake-Conan: [settings] compiler.runtime=${_COMPILER_RUNTIME}")
|
||||
endif()
|
||||
if (_COMPILER_RUNTIME_TYPE)
|
||||
message(STATUS "CMake-Conan: [settings] compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}")
|
||||
endif()
|
||||
|
||||
set(${COMPILER} ${_COMPILER} PARENT_SCOPE)
|
||||
set(${COMPILER_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE)
|
||||
set(${COMPILER_RUNTIME} ${_COMPILER_RUNTIME} PARENT_SCOPE)
|
||||
set(${COMPILER_RUNTIME_TYPE} ${_COMPILER_RUNTIME_TYPE} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(detect_build_type BUILD_TYPE)
|
||||
get_property(_MULTICONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT _MULTICONFIG_GENERATOR)
|
||||
# Only set when we know we are in a single-configuration generator
|
||||
# Note: we may want to fail early if `CMAKE_BUILD_TYPE` is not defined
|
||||
set(${BUILD_TYPE} ${CMAKE_BUILD_TYPE} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
macro(set_conan_compiler_if_appleclang lang command output_variable)
|
||||
if(CMAKE_${lang}_COMPILER_ID STREQUAL "AppleClang")
|
||||
execute_process(COMMAND xcrun --find ${command}
|
||||
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
cmake_path(GET _xcrun_out PARENT_PATH _xcrun_toolchain_path)
|
||||
cmake_path(GET CMAKE_${lang}_COMPILER PARENT_PATH _compiler_parent_path)
|
||||
if ("${_xcrun_toolchain_path}" STREQUAL "${_compiler_parent_path}")
|
||||
set(${output_variable} "")
|
||||
endif()
|
||||
unset(_xcrun_out)
|
||||
unset(_xcrun_toolchain_path)
|
||||
unset(_compiler_parent_path)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(append_compiler_executables_configuration)
|
||||
set(_conan_c_compiler "")
|
||||
set(_conan_cpp_compiler "")
|
||||
if(CMAKE_C_COMPILER)
|
||||
set(_conan_c_compiler "\"c\":\"${CMAKE_C_COMPILER}\",")
|
||||
set_conan_compiler_if_appleclang(C cc _conan_c_compiler)
|
||||
else()
|
||||
message(WARNING "CMake-Conan: The C compiler is not defined. "
|
||||
"Please define CMAKE_C_COMPILER or enable the C language.")
|
||||
endif()
|
||||
if(CMAKE_CXX_COMPILER)
|
||||
set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\"")
|
||||
set_conan_compiler_if_appleclang(CXX c++ _conan_cpp_compiler)
|
||||
else()
|
||||
message(WARNING "CMake-Conan: The C++ compiler is not defined. "
|
||||
"Please define CMAKE_CXX_COMPILER or enable the C++ language.")
|
||||
endif()
|
||||
|
||||
if(NOT "x${_conan_c_compiler}${_conan_cpp_compiler}" STREQUAL "x")
|
||||
string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n")
|
||||
endif()
|
||||
unset(_conan_c_compiler)
|
||||
unset(_conan_cpp_compiler)
|
||||
endmacro()
|
||||
|
||||
|
||||
function(detect_host_profile output_file)
|
||||
detect_os(MYOS MYOS_API_LEVEL MYOS_SDK MYOS_SUBSYSTEM MYOS_VERSION)
|
||||
detect_arch(MYARCH)
|
||||
detect_compiler(MYCOMPILER MYCOMPILER_VERSION MYCOMPILER_RUNTIME MYCOMPILER_RUNTIME_TYPE)
|
||||
detect_cxx_standard(MYCXX_STANDARD)
|
||||
detect_lib_cxx(MYLIB_CXX)
|
||||
detect_build_type(MYBUILD_TYPE)
|
||||
|
||||
set(PROFILE "")
|
||||
string(APPEND PROFILE "[settings]\n")
|
||||
if(MYARCH)
|
||||
string(APPEND PROFILE arch=${MYARCH} "\n")
|
||||
endif()
|
||||
if(MYOS)
|
||||
string(APPEND PROFILE os=${MYOS} "\n")
|
||||
endif()
|
||||
if(MYOS_API_LEVEL)
|
||||
string(APPEND PROFILE os.api_level=${MYOS_API_LEVEL} "\n")
|
||||
endif()
|
||||
if(MYOS_VERSION)
|
||||
string(APPEND PROFILE os.version=${MYOS_VERSION} "\n")
|
||||
endif()
|
||||
if(MYOS_SDK)
|
||||
string(APPEND PROFILE os.sdk=${MYOS_SDK} "\n")
|
||||
endif()
|
||||
if(MYOS_SUBSYSTEM)
|
||||
string(APPEND PROFILE os.subsystem=${MYOS_SUBSYSTEM} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER)
|
||||
string(APPEND PROFILE compiler=${MYCOMPILER} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER_VERSION)
|
||||
string(APPEND PROFILE compiler.version=${MYCOMPILER_VERSION} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER_RUNTIME)
|
||||
string(APPEND PROFILE compiler.runtime=${MYCOMPILER_RUNTIME} "\n")
|
||||
endif()
|
||||
if(MYCOMPILER_RUNTIME_TYPE)
|
||||
string(APPEND PROFILE compiler.runtime_type=${MYCOMPILER_RUNTIME_TYPE} "\n")
|
||||
endif()
|
||||
if(MYCXX_STANDARD)
|
||||
string(APPEND PROFILE compiler.cppstd=${MYCXX_STANDARD} "\n")
|
||||
endif()
|
||||
if(MYLIB_CXX)
|
||||
string(APPEND PROFILE compiler.libcxx=${MYLIB_CXX} "\n")
|
||||
endif()
|
||||
if(MYBUILD_TYPE)
|
||||
string(APPEND PROFILE "build_type=${MYBUILD_TYPE}\n")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED output_file)
|
||||
set(_FN "${CMAKE_BINARY_DIR}/profile")
|
||||
else()
|
||||
set(_FN ${output_file})
|
||||
endif()
|
||||
|
||||
string(APPEND PROFILE "[conf]\n")
|
||||
string(APPEND PROFILE "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n")
|
||||
|
||||
# propagate compilers via profile
|
||||
append_compiler_executables_configuration()
|
||||
|
||||
if(MYOS STREQUAL "Android")
|
||||
string(APPEND PROFILE "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n")
|
||||
endif()
|
||||
|
||||
message(STATUS "CMake-Conan: Creating profile ${_FN}")
|
||||
file(WRITE ${_FN} ${PROFILE})
|
||||
message(STATUS "CMake-Conan: Profile: \n${PROFILE}")
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_profile_detect_default)
|
||||
message(STATUS "CMake-Conan: Checking if a default profile exists")
|
||||
execute_process(COMMAND ${CONAN_COMMAND} profile path default
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE conan_stdout
|
||||
ERROR_VARIABLE conan_stderr
|
||||
ECHO_ERROR_VARIABLE # show the text output regardless
|
||||
ECHO_OUTPUT_VARIABLE
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
if(NOT ${return_code} EQUAL "0")
|
||||
message(STATUS "CMake-Conan: The default profile doesn't exist, detecting it.")
|
||||
execute_process(COMMAND ${CONAN_COMMAND} profile detect
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE conan_stdout
|
||||
ERROR_VARIABLE conan_stderr
|
||||
ECHO_ERROR_VARIABLE # show the text output regardless
|
||||
ECHO_OUTPUT_VARIABLE
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_install)
|
||||
cmake_parse_arguments(ARGS CONAN_ARGS ${ARGN})
|
||||
set(CONAN_OUTPUT_FOLDER ${CMAKE_BINARY_DIR}/conan)
|
||||
# Invoke "conan install" with the provided arguments
|
||||
set(CONAN_ARGS ${CONAN_ARGS} -of=${CONAN_OUTPUT_FOLDER})
|
||||
message(STATUS "CMake-Conan: conan install ${CMAKE_SOURCE_DIR} ${CONAN_ARGS} ${ARGN}")
|
||||
|
||||
|
||||
# In case there was not a valid cmake executable in the PATH, we inject the
|
||||
# same we used to invoke the provider to the PATH
|
||||
if(DEFINED PATH_TO_CMAKE_BIN)
|
||||
set(_OLD_PATH $ENV{PATH})
|
||||
set(ENV{PATH} "$ENV{PATH}:${PATH_TO_CMAKE_BIN}")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${CONAN_COMMAND} install ${CMAKE_SOURCE_DIR}/contrib/cmake ${CONAN_ARGS} ${ARGN} --format=json
|
||||
RESULT_VARIABLE return_code
|
||||
OUTPUT_VARIABLE conan_stdout
|
||||
ERROR_VARIABLE conan_stderr
|
||||
ECHO_ERROR_VARIABLE # show the text output regardless
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(DEFINED PATH_TO_CMAKE_BIN)
|
||||
set(ENV{PATH} "${_OLD_PATH}")
|
||||
endif()
|
||||
|
||||
if(NOT "${return_code}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Conan install failed='${return_code}'")
|
||||
endif()
|
||||
|
||||
# the files are generated in a folder that depends on the layout used, if
|
||||
# one is specified, but we don't know a priori where this is.
|
||||
# TODO: this can be made more robust if Conan can provide this in the json output
|
||||
string(JSON CONAN_GENERATORS_FOLDER GET ${conan_stdout} graph nodes 0 generators_folder)
|
||||
cmake_path(CONVERT ${CONAN_GENERATORS_FOLDER} TO_CMAKE_PATH_LIST CONAN_GENERATORS_FOLDER)
|
||||
# message("conan stdout: ${conan_stdout}")
|
||||
message(STATUS "CMake-Conan: CONAN_GENERATORS_FOLDER=${CONAN_GENERATORS_FOLDER}")
|
||||
set_property(GLOBAL PROPERTY CONAN_GENERATORS_FOLDER "${CONAN_GENERATORS_FOLDER}")
|
||||
# reconfigure on conanfile changes
|
||||
string(JSON CONANFILE GET ${conan_stdout} graph nodes 0 label)
|
||||
message(STATUS "CMake-Conan: CONANFILE=${CMAKE_SOURCE_DIR}/contrib/cmake/${CONANFILE}")
|
||||
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/contrib/cmake/${CONANFILE}")
|
||||
# success
|
||||
set_property(GLOBAL PROPERTY CONAN_INSTALL_SUCCESS TRUE)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_get_version conan_command conan_current_version)
|
||||
execute_process(
|
||||
COMMAND ${conan_command} --version
|
||||
OUTPUT_VARIABLE conan_output
|
||||
RESULT_VARIABLE conan_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(conan_result)
|
||||
message(FATAL_ERROR "CMake-Conan: Error when trying to run Conan")
|
||||
endif()
|
||||
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" conan_version ${conan_output})
|
||||
set(${conan_current_version} ${conan_version} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(conan_version_check)
|
||||
set(options )
|
||||
set(oneValueArgs MINIMUM CURRENT)
|
||||
set(multiValueArgs )
|
||||
cmake_parse_arguments(CONAN_VERSION_CHECK
|
||||
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if(NOT CONAN_VERSION_CHECK_MINIMUM)
|
||||
message(FATAL_ERROR "CMake-Conan: Required parameter MINIMUM not set!")
|
||||
endif()
|
||||
if(NOT CONAN_VERSION_CHECK_CURRENT)
|
||||
message(FATAL_ERROR "CMake-Conan: Required parameter CURRENT not set!")
|
||||
endif()
|
||||
|
||||
if(CONAN_VERSION_CHECK_CURRENT VERSION_LESS CONAN_VERSION_CHECK_MINIMUM)
|
||||
message(FATAL_ERROR "CMake-Conan: Conan version must be ${CONAN_VERSION_CHECK_MINIMUM} or later")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
macro(construct_profile_argument argument_variable profile_list)
|
||||
set(${argument_variable} "")
|
||||
if("${profile_list}" STREQUAL "CONAN_HOST_PROFILE")
|
||||
set(_arg_flag "--profile:host=")
|
||||
elseif("${profile_list}" STREQUAL "CONAN_BUILD_PROFILE")
|
||||
set(_arg_flag "--profile:build=")
|
||||
endif()
|
||||
|
||||
set(_profile_list "${${profile_list}}")
|
||||
list(TRANSFORM _profile_list REPLACE "auto-cmake" "${CMAKE_BINARY_DIR}/conan_host_profile")
|
||||
list(TRANSFORM _profile_list PREPEND ${_arg_flag})
|
||||
set(${argument_variable} ${_profile_list})
|
||||
|
||||
unset(_arg_flag)
|
||||
unset(_profile_list)
|
||||
endmacro()
|
||||
|
||||
|
||||
macro(conan_provide_dependency method package_name)
|
||||
set_property(GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED TRUE)
|
||||
get_property(_conan_install_success GLOBAL PROPERTY CONAN_INSTALL_SUCCESS)
|
||||
if(NOT _conan_install_success)
|
||||
find_program(CONAN_COMMAND "conan" REQUIRED)
|
||||
conan_get_version(${CONAN_COMMAND} CONAN_CURRENT_VERSION)
|
||||
conan_version_check(MINIMUM ${CONAN_MINIMUM_VERSION} CURRENT ${CONAN_CURRENT_VERSION})
|
||||
message(STATUS "CMake-Conan: first find_package() found. Installing dependencies with Conan")
|
||||
if("default" IN_LIST CONAN_HOST_PROFILE OR "default" IN_LIST CONAN_BUILD_PROFILE)
|
||||
conan_profile_detect_default()
|
||||
endif()
|
||||
if("auto-cmake" IN_LIST CONAN_HOST_PROFILE)
|
||||
detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile)
|
||||
endif()
|
||||
construct_profile_argument(_host_profile_flags CONAN_HOST_PROFILE)
|
||||
construct_profile_argument(_build_profile_flags CONAN_BUILD_PROFILE)
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/conanfile.py")
|
||||
file(READ "${CMAKE_SOURCE_DIR}/conanfile.py" outfile)
|
||||
if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
|
||||
message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile")
|
||||
endif()
|
||||
set(generator "")
|
||||
elseif (EXISTS "${CMAKE_SOURCE_DIR}/conanfile.txt")
|
||||
file(READ "${CMAKE_SOURCE_DIR}/conanfile.txt" outfile)
|
||||
if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
|
||||
message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile. "
|
||||
"Please define the generator as it will be mandatory in the future")
|
||||
endif()
|
||||
set(generator "-g;CMakeDeps")
|
||||
endif()
|
||||
get_property(_multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||
if(NOT _multiconfig_generator)
|
||||
message(STATUS "CMake-Conan: Installing single configuration ${CMAKE_BUILD_TYPE}")
|
||||
conan_install(${_host_profile_flags} ${_build_profile_flags} ${CONAN_INSTALL_ARGS} ${generator})
|
||||
else()
|
||||
message(STATUS "CMake-Conan: Installing both Debug and Release")
|
||||
conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Release ${CONAN_INSTALL_ARGS} ${generator})
|
||||
conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Debug ${CONAN_INSTALL_ARGS} ${generator})
|
||||
endif()
|
||||
unset(_host_profile_flags)
|
||||
unset(_build_profile_flags)
|
||||
unset(_multiconfig_generator)
|
||||
unset(_conan_install_success)
|
||||
else()
|
||||
message(STATUS "CMake-Conan: find_package(${ARGV1}) found, 'conan install' already ran")
|
||||
unset(_conan_install_success)
|
||||
endif()
|
||||
|
||||
get_property(_conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER)
|
||||
|
||||
# Ensure that we consider Conan-provided packages ahead of any other,
|
||||
# irrespective of other settings that modify the search order or search paths
|
||||
# This follows the guidelines from the find_package documentation
|
||||
# (https://cmake.org/cmake/help/latest/command/find_package.html):
|
||||
# find_package (<PackageName> PATHS paths... NO_DEFAULT_PATH)
|
||||
# find_package (<PackageName>)
|
||||
|
||||
# Filter out `REQUIRED` from the argument list, as the first call may fail
|
||||
set(_find_args_${package_name} "${ARGN}")
|
||||
list(REMOVE_ITEM _find_args_${package_name} "REQUIRED")
|
||||
if(NOT "MODULE" IN_LIST _find_args_${package_name})
|
||||
find_package(${package_name} ${_find_args_${package_name}} BYPASS_PROVIDER PATHS "${_conan_generators_folder}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
unset(_find_args_${package_name})
|
||||
endif()
|
||||
|
||||
# Invoke find_package a second time - if the first call succeeded,
|
||||
# this will simply reuse the result. If not, fall back to CMake default search
|
||||
# behaviour, also allowing modules to be searched.
|
||||
if(NOT ${package_name}_FOUND)
|
||||
list(FIND CMAKE_MODULE_PATH "${_conan_generators_folder}" _index)
|
||||
if(_index EQUAL -1)
|
||||
list(PREPEND CMAKE_MODULE_PATH "${_conan_generators_folder}")
|
||||
endif()
|
||||
unset(_index)
|
||||
find_package(${package_name} ${ARGN} BYPASS_PROVIDER)
|
||||
list(REMOVE_ITEM CMAKE_MODULE_PATH "${_conan_generators_folder}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
cmake_language(
|
||||
SET_DEPENDENCY_PROVIDER conan_provide_dependency
|
||||
SUPPORTED_METHODS FIND_PACKAGE
|
||||
)
|
||||
|
||||
|
||||
macro(conan_provide_dependency_check)
|
||||
set(_CONAN_PROVIDE_DEPENDENCY_INVOKED FALSE)
|
||||
get_property(_CONAN_PROVIDE_DEPENDENCY_INVOKED GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED)
|
||||
if(NOT _CONAN_PROVIDE_DEPENDENCY_INVOKED)
|
||||
message(WARNING "Conan is correctly configured as dependency provider, "
|
||||
"but Conan has not been invoked. Please add at least one "
|
||||
"call to `find_package()`.")
|
||||
if(DEFINED CONAN_COMMAND)
|
||||
# supress warning in case `CONAN_COMMAND` was specified but unused.
|
||||
set(_CONAN_COMMAND ${CONAN_COMMAND})
|
||||
unset(_CONAN_COMMAND)
|
||||
endif()
|
||||
endif()
|
||||
unset(_CONAN_PROVIDE_DEPENDENCY_INVOKED)
|
||||
endmacro()
|
||||
|
||||
|
||||
# Add a deferred call at the end of processing the top-level directory
|
||||
# to check if the dependency provider was invoked at all.
|
||||
cmake_language(DEFER DIRECTORY "${CMAKE_SOURCE_DIR}" CALL conan_provide_dependency_check)
|
||||
|
||||
# Configurable variables for Conan profiles
|
||||
set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile")
|
||||
set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile")
|
||||
set(CONAN_INSTALL_ARGS "--build=missing" CACHE STRING "Command line arguments for conan install")
|
||||
|
||||
find_program(_cmake_program NAMES cmake NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)
|
||||
if(NOT _cmake_program)
|
||||
get_filename_component(PATH_TO_CMAKE_BIN "${CMAKE_COMMAND}" DIRECTORY)
|
||||
set(PATH_TO_CMAKE_BIN "${PATH_TO_CMAKE_BIN}" CACHE INTERNAL "Path where the CMake executable is")
|
||||
endif()
|
||||
|
||||
3
contrib/cmake/conandata.yml
Normal file
3
contrib/cmake/conandata.yml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
requirements:
|
||||
- "openssl/3.2.1"
|
||||
- "boost/1.84.0"
|
||||
25
contrib/cmake/conanfile.py
Normal file
25
contrib/cmake/conanfile.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# This file is managed by Conan, contents will be overwritten.
|
||||
# To keep your changes, remove these comment lines, but the plugin won't be able to modify your requirements
|
||||
import os
|
||||
from io import StringIO
|
||||
from conan import ConanFile
|
||||
from conan.tools.files import load, copy
|
||||
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
|
||||
|
||||
class ConanApplication(ConanFile):
|
||||
package_type = "application"
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "CMakeDeps", "CMakeToolchain"
|
||||
|
||||
def layout(self):
|
||||
# The root of the project is one level above
|
||||
#self.folders.root = os.path.dirname(os.path.dirname('.'))
|
||||
# The source of the project (the root CMakeLists.txt) is the source folder
|
||||
#self.folders.source = "."
|
||||
#self.folders.build = "build"
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
requirements = self.conan_data.get('requirements', [])
|
||||
for requirement in requirements:
|
||||
self.requires(requirement)
|
||||
2
contrib/cmake/requirements.txt
Normal file
2
contrib/cmake/requirements.txt
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
conan
|
||||
pytest
|
||||
5
contrib/cmake/settings_user.yml
Normal file
5
contrib/cmake/settings_user.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
compiler:
|
||||
gcc:
|
||||
version: ["11.4.0"]
|
||||
apple-clang:
|
||||
version: ["15.0.0.15000040"]
|
||||
|
|
@ -6,18 +6,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|||
endif()
|
||||
|
||||
|
||||
message("DB ENGINE: lmdb")
|
||||
add_subdirectory(liblmdb)
|
||||
if(MSVC)
|
||||
target_compile_options(lmdb PRIVATE /wd4996 /wd4503 /wd4345 /wd4267 /wd4244 /wd4146 /wd4333 /wd4172)
|
||||
else()
|
||||
# Warnings as used by LMDB itself (LMDB_0.9.23)
|
||||
target_compile_options(lmdb PRIVATE -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized)
|
||||
endif()
|
||||
|
||||
if(NOT DISABLE_MDBX)
|
||||
message("DB ENGINE: mdbx")
|
||||
add_subdirectory(libmdbx)
|
||||
# remove mdbx tools from the default MSVC build
|
||||
set_target_properties(mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
|
||||
endif()
|
||||
message("DB ENGINE: lmdb")
|
||||
add_subdirectory(liblmdb)
|
||||
if(MSVC)
|
||||
target_compile_options(lmdb PRIVATE /wd4996 /wd4503 /wd4345 /wd4267 /wd4244 /wd4146 /wd4333 /wd4172)
|
||||
else()
|
||||
# Warnings as used by LMDB itself (LMDB_0.9.23)
|
||||
target_compile_options(lmdb PRIVATE -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized)
|
||||
endif()
|
||||
if(NOT DISABLE_MDBX)
|
||||
message("DB ENGINE: mdbx")
|
||||
add_subdirectory(libmdbx)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ if(UNIX AND NOT APPLE)
|
|||
target_link_libraries(${TARGET}_SHARED rt)
|
||||
endif()
|
||||
|
||||
#install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
||||
#install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
||||
#install(FILES mdbx.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include COMPONENT mdbx-devel)
|
||||
install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
||||
install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
||||
install(FILES mdbx.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include COMPONENT mdbx-devel)
|
||||
|
||||
add_subdirectory(src/tools)
|
||||
add_subdirectory(test)
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ if(CC_HAS_VISIBILITY)
|
|||
target_compile_options(mdbx PRIVATE "-fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
#install(TARGETS mdbx
|
||||
# LIBRARY DESTINATION lib COMPONENT runtime
|
||||
# RUNTIME DESTINATION bin COMPONENT runtime
|
||||
# ARCHIVE DESTINATION lib/static COMPONENT devel
|
||||
# PUBLIC_HEADER DESTINATION include
|
||||
# INCLUDES DESTINATION include COMPONENT devel)
|
||||
install(TARGETS mdbx
|
||||
LIBRARY DESTINATION lib COMPONENT runtime
|
||||
RUNTIME DESTINATION bin COMPONENT runtime
|
||||
ARCHIVE DESTINATION lib/static COMPONENT devel
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
INCLUDES DESTINATION include COMPONENT devel)
|
||||
|
||||
################################################################################
|
||||
#
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ foreach(TOOL ${MDBX_TOOLS})
|
|||
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
|
||||
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
||||
|
||||
# install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
|
||||
# install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
|
||||
install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
|
||||
endforeach()
|
||||
|
||||
if(LIB_MATH)
|
||||
|
|
|
|||
|
|
@ -60,35 +60,25 @@ namespace epee
|
|||
template<bool is_ordered_container, typename t_key, typename t_value, uint64_t max_elements>
|
||||
class cache_base
|
||||
{
|
||||
uint64_t max_allowed_elements;
|
||||
std::list<t_key> most_recent_accessed;
|
||||
uint64_t mac_allowed_elements;
|
||||
std::list<t_key> most_recet_acessed;
|
||||
typename container_selector<is_ordered_container, t_key, std::pair<t_value, typename std::list<t_key>::iterator> >::container data;
|
||||
protected:
|
||||
critical_section m_lock;
|
||||
public:
|
||||
|
||||
cache_base() : max_allowed_elements(max_elements)
|
||||
cache_base() : mac_allowed_elements(max_elements)
|
||||
{}
|
||||
|
||||
size_t size() const
|
||||
size_t size()
|
||||
{
|
||||
|
||||
return data.size();
|
||||
}
|
||||
|
||||
size_t most_recent_accessed_container_size() const
|
||||
{
|
||||
return most_recent_accessed.size();
|
||||
}
|
||||
|
||||
uint64_t get_max_elements() const
|
||||
{
|
||||
return max_allowed_elements;
|
||||
}
|
||||
|
||||
void set_max_elements(uint64_t e)
|
||||
{
|
||||
max_allowed_elements = e;
|
||||
mac_allowed_elements = e;
|
||||
}
|
||||
|
||||
bool get(const t_key& k, t_value& v)
|
||||
|
|
@ -98,11 +88,7 @@ namespace epee
|
|||
if (it == data.end())
|
||||
return false;
|
||||
|
||||
//most_recent_accessed.splice(most_recent_accessed.begin(), most_recent_accessed, it->second.second);
|
||||
most_recent_accessed.erase(it->second.second);
|
||||
most_recent_accessed.push_front(k);
|
||||
it->second.second = most_recent_accessed.begin();
|
||||
|
||||
most_recet_acessed.splice(most_recet_acessed.begin(), most_recet_acessed, it->second.second);
|
||||
v = it->second.first;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -110,19 +96,8 @@ namespace epee
|
|||
bool set(const t_key& k, const t_value& v)
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_lock);
|
||||
auto it = data.find(k);
|
||||
if (it == data.end())
|
||||
{
|
||||
most_recent_accessed.push_front(k);
|
||||
data.insert(std::make_pair(k, std::make_pair(v, most_recent_accessed.begin())));
|
||||
}
|
||||
else
|
||||
{
|
||||
most_recent_accessed.erase(it->second.second);
|
||||
most_recent_accessed.push_front(k);
|
||||
it->second.first = v;
|
||||
it->second.second = most_recent_accessed.begin();
|
||||
}
|
||||
most_recet_acessed.push_front(k);
|
||||
data[k] = std::pair<t_value, typename std::list<t_key>::iterator>(v, most_recet_acessed.begin());
|
||||
|
||||
trim();
|
||||
return true;
|
||||
|
|
@ -132,7 +107,7 @@ namespace epee
|
|||
{
|
||||
CRITICAL_REGION_LOCAL(m_lock);
|
||||
data.clear();
|
||||
most_recent_accessed.clear();
|
||||
most_recet_acessed.clear();
|
||||
}
|
||||
|
||||
bool erase(const t_key& k)
|
||||
|
|
@ -142,21 +117,20 @@ namespace epee
|
|||
if (data_it == data.end())
|
||||
return false;
|
||||
|
||||
most_recent_accessed.erase(data_it->second.second);
|
||||
most_recet_acessed.erase(data_it->second.second);
|
||||
data.erase(data_it);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
void trim()
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_lock);
|
||||
while (most_recent_accessed.size() > max_allowed_elements)
|
||||
while (most_recet_acessed.size() > mac_allowed_elements)
|
||||
{
|
||||
auto data_it = data.find(most_recent_accessed.back());
|
||||
auto data_it = data.find(most_recet_acessed.back());
|
||||
if (data_it != data.end())
|
||||
data.erase(data_it);
|
||||
most_recent_accessed.erase(--most_recent_accessed.end());
|
||||
most_recet_acessed.erase(--most_recet_acessed.end());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -264,10 +238,7 @@ namespace epee
|
|||
|
||||
bool erase(const t_key& k)
|
||||
{
|
||||
return m_isolation.isolated_write_access<bool>([&]()
|
||||
{
|
||||
return base_class::erase(k);
|
||||
});
|
||||
return m_isolation.isolated_write_access<bool>([&](){return base_class::erase(k); });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace epee
|
|||
m_run.store(false, std::memory_order_relaxed);
|
||||
|
||||
#if defined(WIN32)
|
||||
// ::CloseHandle(::GetStdHandle(STD_INPUT_HANDLE)); -- commented out by sowle, I belive we don't need to close this handle here
|
||||
::CloseHandle(::GetStdHandle(STD_INPUT_HANDLE));
|
||||
#endif
|
||||
|
||||
m_request_cv.notify_one();
|
||||
|
|
|
|||
|
|
@ -36,19 +36,6 @@
|
|||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
|
||||
|
||||
#if __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
namespace stdfs = std::filesystem;
|
||||
#else
|
||||
#if TARGET_OS_IOS
|
||||
#error "This should never happen on ios."
|
||||
#endif
|
||||
namespace stdfs = boost::filesystem;
|
||||
#endif
|
||||
|
||||
//#include <filesystem>
|
||||
|
||||
#ifndef MAKE64
|
||||
#define MAKE64(low,high) ((__int64)(((DWORD)(low)) | ((__int64)((DWORD)(high))) << 32))
|
||||
#endif
|
||||
|
|
@ -574,15 +561,16 @@ namespace file_io_utils
|
|||
try
|
||||
{
|
||||
|
||||
stdfs::directory_iterator end_itr; // default construction yields past-the-end
|
||||
for (stdfs::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
|
||||
boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
|
||||
for ( boost::filesystem::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
|
||||
{
|
||||
if ( only_files && stdfs::is_directory(itr->status()) )
|
||||
if ( only_files && boost::filesystem::is_directory(itr->status()) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
target_list.push_back(itr->path().filename().string());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch(...)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#define _GZIP_ENCODING_H_
|
||||
#include "boost/core/ignore_unused.hpp"
|
||||
#include "net/http_client_base.h"
|
||||
#include "zlib.h"
|
||||
#include "zlib/zlib.h"
|
||||
|
||||
|
||||
namespace epee
|
||||
|
|
@ -182,7 +182,7 @@ namespace net_utils
|
|||
*
|
||||
*/
|
||||
inline
|
||||
virtual void stop(std::string& OUT collect_remains) override
|
||||
virtual void stop(std::string& OUT collect_remains)
|
||||
{
|
||||
}
|
||||
protected:
|
||||
|
|
@ -260,10 +260,6 @@ namespace net_utils
|
|||
m_pcb.reset(new abstract_callback<callback_t>(cb));
|
||||
return content_encoding_gzip::update_in(piece_of_transfer);
|
||||
}
|
||||
|
||||
virtual void stop(std::string& OUT collect_remains) override
|
||||
{}
|
||||
|
||||
template<class callback_t>
|
||||
bool stop(callback_t cb)
|
||||
{return true;}
|
||||
|
|
|
|||
|
|
@ -30,3 +30,5 @@
|
|||
#define ENABLE_RELEASE_LOGGING
|
||||
|
||||
#include "misc_log_ex.h"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
|
||||
// Copyright (c) 2019, anonimal, <anonimal@lethean.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -82,13 +82,6 @@ namespace epee
|
|||
|
||||
namespace misc_utils
|
||||
{
|
||||
|
||||
template<typename t_type_a, typename t_type_b>
|
||||
void cast_assign_a_to_b(const t_type_a& a, t_type_b& b)
|
||||
{
|
||||
*static_cast<t_type_a*>(&b) = a;
|
||||
}
|
||||
|
||||
template<class _Ty1,
|
||||
class _Ty2,
|
||||
class _Ty3>
|
||||
|
|
@ -371,7 +364,7 @@ namespace misc_utils
|
|||
}
|
||||
|
||||
|
||||
#define ON_FUNC_EXIT misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler
|
||||
#define ON_EXIT misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler
|
||||
|
||||
|
||||
template< typename t_contaner, typename t_redicate>
|
||||
|
|
@ -539,105 +532,7 @@ namespace misc_utils
|
|||
|
||||
};
|
||||
|
||||
template<typename key, typename expiration_type>
|
||||
struct expirating_set
|
||||
{
|
||||
typedef std::set<key> main_set;
|
||||
main_set m_set;
|
||||
std::multimap<expiration_type, typename main_set::iterator> m_expirations;
|
||||
|
||||
const main_set& get_set()
|
||||
{
|
||||
return m_set;
|
||||
}
|
||||
void add(const key& k, const expiration_type& e)
|
||||
{
|
||||
auto res = m_set.insert(k);
|
||||
m_expirations.insert({ e, res.first });
|
||||
}
|
||||
|
||||
void remove_if_expiration_less_than(const expiration_type& e)
|
||||
{
|
||||
while(m_expirations.size() && m_expirations.begin()->first < e)
|
||||
{
|
||||
m_set.erase(m_expirations.begin()->second);
|
||||
m_expirations.erase(m_expirations.begin());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename key, typename expiration_type, typename value_type>
|
||||
struct expirating_map
|
||||
{
|
||||
typedef std::map<key, value_type> main_map;
|
||||
main_map m_map;
|
||||
std::multimap<expiration_type, typename main_map::iterator> m_expirations;
|
||||
|
||||
const main_map& get_map()
|
||||
{
|
||||
return m_map;
|
||||
}
|
||||
void add(const key& k, const value_type& v, const expiration_type& e)
|
||||
{
|
||||
auto res = m_map.insert(k, v);
|
||||
m_expirations.insert({ e, res.first });
|
||||
}
|
||||
|
||||
void remove_if_expiration_less_than(const expiration_type& e)
|
||||
{
|
||||
while (m_expirations.size() && m_expirations.begin()->first < e)
|
||||
{
|
||||
m_map.erase(m_expirations.begin()->second);
|
||||
m_expirations.erase(m_expirations.begin());
|
||||
}
|
||||
}
|
||||
|
||||
template <class t_archive>
|
||||
inline void serialize(t_archive& a, const unsigned int ver)
|
||||
{
|
||||
std::vector<std::tuple<key, value_type, expiration_type> > items;
|
||||
if constexpr (t_archive::is_saving::value)
|
||||
{
|
||||
for (const auto& item: m_expirations)
|
||||
{
|
||||
items.resize(items.size + 1);
|
||||
std::get<2>(items.back()) = item.first;
|
||||
std::get<0>(items.back()) = item.second.first;
|
||||
std::get<1>(items.back()) = item.second.second;
|
||||
}
|
||||
}
|
||||
a & items;
|
||||
|
||||
if constexpr (!t_archive::is_saving::value)
|
||||
{
|
||||
for (const auto& item : items)
|
||||
{
|
||||
this->add(std::get<0>(item), std::get<1>(item), std::get<2>(item));
|
||||
|
||||
|
||||
items.resize(items.size + 1);
|
||||
std::get<2>(items.back()) = item.first;
|
||||
std::get<0>(items.back()) = item.second.first;
|
||||
std::get<1>(items.back()) = item.second.second;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// helper class mainly intended for using with std::atomic to repair copy-construction in classes where std::atomic is aggregated
|
||||
template<typename parent_t>
|
||||
struct void_copy : public parent_t
|
||||
{
|
||||
void_copy() = default;
|
||||
void_copy(void_copy&&) noexcept = default;
|
||||
void_copy& operator=(void_copy&&) noexcept = default;
|
||||
|
||||
void_copy(const void_copy&) : parent_t{} {}
|
||||
void_copy& operator=(const void_copy&) { return *this; }
|
||||
};
|
||||
|
||||
} // namespace misc_utils
|
||||
} // namespace epee
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) 2019-2024, Zano Project
|
||||
// Copyright (c) 2019, anonimal <anonimal@zano.org>
|
||||
// Copyright (c) 2019, Zano Project
|
||||
// Copyright (c) 2019, anonimal <anonimal@lethean.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -90,7 +90,7 @@ DISABLE_VS_WARNINGS(4100)
|
|||
#define LOG_JOURNAL_MAX_ELEMENTS 100
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define _ASSERTE__(expr) if(!(expr)) {__debugbreak();}
|
||||
#define _ASSERTE__(expr) if(!expr) {__debugbreak();}
|
||||
#else
|
||||
#define _ASSERTE__(expr)
|
||||
#endif
|
||||
|
|
@ -244,6 +244,11 @@ DISABLE_VS_WARNINGS(4100)
|
|||
#define CHECK_AND_ASSERT_MES_CUSTOM(expr, fail_ret_val, custom_code, message) do{if(!(expr)) {LOG_ERROR(message); custom_code; return fail_ret_val;};}while(0)
|
||||
#endif
|
||||
|
||||
/*#ifndef CHECK_AND_ASSERT_MES_AND_THROW
|
||||
#define CHECK_AND_ASSERT_MES_AND_THROW(expr, message) do{if(!(expr)) {LOG_ERROR(message); throw std::runtime_error(message);};}while(0)
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifndef CHECK_AND_NO_ASSERT_MES
|
||||
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_PRINT_MAGENTA(message, LOG_LEVEL_0); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
|
||||
#endif
|
||||
|
|
@ -260,22 +265,6 @@ DISABLE_VS_WARNINGS(4100)
|
|||
#define CHECK_AND_ASSERT_MES2(expr, message) do{if(!(expr)) {LOG_ERROR(message); };}while(0)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_AND_ASSERT_EQ
|
||||
#define CHECK_AND_ASSERT_EQ(A, B) CHECK_AND_ASSERT_MES((A) == (B), false, STR(A) " != " STR(B) " because " << A << " != " << B)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_AND_ASSERT_NEQ
|
||||
#define CHECK_AND_ASSERT_NEQ(A, B) CHECK_AND_ASSERT_MES((A) != (B), false, STR(A) " == " STR(B) " because " << A << " == " << B)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_AND_ASSERT_LESS
|
||||
#define CHECK_AND_ASSERT_LESS(A, B) CHECK_AND_ASSERT_MES((A) < (B), false, STR(A) " >= " STR(B) " because " << A << " >= " << B)
|
||||
#endif
|
||||
|
||||
#ifndef CHECK_AND_ASSERT_GREATER
|
||||
#define CHECK_AND_ASSERT_GREATER(A, B) CHECK_AND_ASSERT_MES((A) > (B), false, STR(A) " <= " STR(B) " because " << A << " <= " << B)
|
||||
#endif
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace debug
|
||||
|
|
|
|||
|
|
@ -114,33 +114,26 @@ namespace misc_utils
|
|||
#include <execinfo.h>
|
||||
#include <boost/core/demangle.hpp>
|
||||
#endif
|
||||
inline std::string print_trace_default() noexcept
|
||||
inline std::string print_trace_default()
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::stringstream ss;
|
||||
#if defined(__GNUC__) && !defined(__ANDROID__)
|
||||
ss << std::endl << "STACK" << std::endl;
|
||||
const size_t max_depth = 100;
|
||||
size_t stack_depth;
|
||||
void *stack_addrs[max_depth];
|
||||
char **stack_strings;
|
||||
ss << std::endl << "STACK" << std::endl;
|
||||
const size_t max_depth = 100;
|
||||
size_t stack_depth;
|
||||
void *stack_addrs[max_depth];
|
||||
char **stack_strings;
|
||||
|
||||
stack_depth = backtrace(stack_addrs, max_depth);
|
||||
stack_strings = backtrace_symbols(stack_addrs, stack_depth);
|
||||
stack_depth = backtrace(stack_addrs, max_depth);
|
||||
stack_strings = backtrace_symbols(stack_addrs, stack_depth);
|
||||
|
||||
for (size_t i = 1; i < stack_depth; i++)
|
||||
{
|
||||
ss << boost::core::demangle(stack_strings[i]) << std::endl;
|
||||
}
|
||||
free(stack_strings); // malloc()ed by backtrace_symbols
|
||||
for (size_t i = 1; i < stack_depth; i++)
|
||||
{
|
||||
ss << boost::core::demangle(stack_strings[i]) << std::endl;
|
||||
}
|
||||
free(stack_strings); // malloc()ed by backtrace_symbols
|
||||
#endif
|
||||
return ss.str();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return std::string("(no callstack due to an exception)");
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
typedef std::string (stack_retrieving_function_t)();
|
||||
|
|
@ -148,35 +141,27 @@ namespace misc_utils
|
|||
//
|
||||
// To get stack trace call it with the defaults.
|
||||
//
|
||||
inline std::string get_callstack(stack_retrieving_function_t* p_stack_retrieving_function_to_be_added = nullptr, bool remove_func = false) noexcept
|
||||
inline std::string get_callstack(stack_retrieving_function_t* p_stack_retrieving_function_to_be_added = nullptr, bool remove_func = false)
|
||||
{
|
||||
static stack_retrieving_function_t* p_srf = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (remove_func)
|
||||
{
|
||||
p_srf = nullptr;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (p_stack_retrieving_function_to_be_added != nullptr)
|
||||
{
|
||||
p_srf = p_stack_retrieving_function_to_be_added;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (p_srf != nullptr)
|
||||
return p_srf();
|
||||
|
||||
return print_trace_default();
|
||||
}
|
||||
catch(...)
|
||||
if (remove_func)
|
||||
{
|
||||
return std::string("(no callstack due to an exception)");
|
||||
p_srf = nullptr;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (p_stack_retrieving_function_to_be_added != nullptr)
|
||||
{
|
||||
p_srf = p_stack_retrieving_function_to_be_added;
|
||||
return "";
|
||||
}
|
||||
|
||||
if (p_srf != nullptr)
|
||||
return p_srf();
|
||||
|
||||
return print_trace_default();
|
||||
}
|
||||
|
||||
} // namespace misc_utils
|
||||
} // namespace epee
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace epee {
|
|||
namespace net_utils {
|
||||
|
||||
struct i_connection_filter {
|
||||
virtual bool is_remote_ip_allowed(uint32_t adress, bool is_incoming) = 0;
|
||||
virtual bool is_remote_ip_allowed(uint32_t adress) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~i_connection_filter()
|
||||
|
|
|
|||
|
|
@ -44,18 +44,6 @@ namespace net_utils {
|
|||
/************************************************************************/
|
||||
DISABLE_VS_WARNINGS(4355)
|
||||
|
||||
|
||||
|
||||
template <typename, typename = std::void_t<>>
|
||||
struct has_pre_destructor_handler : std::false_type {};
|
||||
|
||||
// This specialization is selected if T has a valid 'b()' that can be called
|
||||
template <typename T>
|
||||
struct has_pre_destructor_handler<T, std::void_t<decltype(std::declval<T&>().on_pre_destroy())>>
|
||||
: std::true_type {};
|
||||
|
||||
|
||||
|
||||
template<class t_protocol_handler>
|
||||
connection<t_protocol_handler>::connection(boost::asio::io_service& io_service,
|
||||
typename t_protocol_handler::config_type& config, volatile uint32_t& sock_count, i_connection_filter*& pfilter)
|
||||
|
|
@ -78,12 +66,6 @@ connection<t_protocol_handler>::~connection()
|
|||
{
|
||||
NESTED_TRY_ENTRY();
|
||||
|
||||
if constexpr (has_pre_destructor_handler<t_protocol_handler>::value)
|
||||
{
|
||||
m_protocol_handler.on_pre_destroy();
|
||||
}
|
||||
|
||||
|
||||
if(!m_was_shutdown) {
|
||||
LOG_PRINT_L3("[sock " << socket_.native_handle() << "] Socket destroyed without shutdown.");
|
||||
shutdown();
|
||||
|
|
@ -146,7 +128,7 @@ bool connection<t_protocol_handler>::start(bool is_income, bool is_multithreaded
|
|||
|
||||
LOG_PRINT_L3("[sock " << socket_.native_handle() << "] new connection, remote end_point: " << print_connection_context_short(context) << " local end_point: " << local_ep.address().to_string() << ':' << local_ep.port() << ", total sockets objects " << m_ref_sockets_count);
|
||||
|
||||
if(is_income && m_pfilter && !m_pfilter->is_remote_ip_allowed(context.m_remote_ip, is_income)) {
|
||||
if(is_income && m_pfilter && !m_pfilter->is_remote_ip_allowed(context.m_remote_ip)) {
|
||||
LOG_PRINT_L0("[sock " << socket_.native_handle() << "] ip denied " << string_tools::get_ip_string_from_int32(context.m_remote_ip) << ", shutdowning connection");
|
||||
close();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace net_utils
|
|||
std::string m_transfer_encoding;//"Transfer-Encoding:"
|
||||
std::string m_content_encoding; //"Content-Encoding:"
|
||||
std::string m_host; //"Host:"
|
||||
std::string m_cookie; //"Cookie:"
|
||||
std::string m_cookie; //"Cookie:"
|
||||
fields_list m_etc_fields;
|
||||
|
||||
void clear()
|
||||
|
|
@ -147,10 +147,10 @@ namespace net_utils
|
|||
std::string m_http_method_str;
|
||||
std::string m_full_request_str;
|
||||
std::string m_replace_html;
|
||||
std::string m_request_head;
|
||||
std::string m_request_head;
|
||||
int m_http_ver_hi;
|
||||
int m_http_ver_lo;
|
||||
bool m_have_to_block;
|
||||
bool m_have_to_block;
|
||||
http_header_info m_header_info;
|
||||
uri_content m_uri_content;
|
||||
size_t m_full_request_buf_size;
|
||||
|
|
@ -166,11 +166,11 @@ namespace net_utils
|
|||
|
||||
struct http_response_info
|
||||
{
|
||||
int m_response_code;
|
||||
std::string m_response_comment;
|
||||
int m_response_code;
|
||||
std::string m_response_comment;
|
||||
fields_list m_additional_fields;
|
||||
std::string m_body;
|
||||
std::string m_mime_tipe;
|
||||
std::string m_body;
|
||||
std::string m_mime_tipe;
|
||||
http_header_info m_header_info;
|
||||
int m_http_ver_hi;// OUT paramter only
|
||||
int m_http_ver_lo;// OUT paramter only
|
||||
|
|
|
|||
|
|
@ -200,26 +200,8 @@ namespace epee
|
|||
|
||||
namespace http
|
||||
{
|
||||
|
||||
|
||||
struct i_http_client
|
||||
{
|
||||
virtual void set_host_name(const std::string& name) = 0;
|
||||
virtual boost::asio::ip::tcp::socket& get_socket() = 0;
|
||||
virtual bool connect(const std::string& host, int port, unsigned int timeout) = 0;
|
||||
virtual bool set_timeouts(unsigned int connection_timeout, unsigned int recv_timeout) = 0;
|
||||
virtual bool connect(const std::string& host, std::string port) = 0;
|
||||
virtual bool connect(const std::string& host, const std::string& port, unsigned int timeout) = 0;
|
||||
virtual bool disconnect() = 0;
|
||||
virtual bool is_connected() = 0;
|
||||
virtual bool invoke_get(const std::string& uri, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
|
||||
virtual bool invoke(const std::string& uri, const std::string& method, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
|
||||
virtual bool invoke_post(const std::string& uri, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
|
||||
};
|
||||
|
||||
template<bool is_ssl>
|
||||
class http_simple_client_t : public i_target_handler,
|
||||
public i_http_client
|
||||
class http_simple_client_t : public i_target_handler
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
@ -911,90 +893,25 @@ namespace epee
|
|||
typedef http_simple_client_t<true> https_simple_client;
|
||||
|
||||
|
||||
//suitable for both http and https
|
||||
class http_universal_client: public i_http_client
|
||||
{
|
||||
public:
|
||||
http_universal_client(): m_pclient(new http_simple_client())
|
||||
{}
|
||||
// Forward all calls to m_pclient
|
||||
void set_host_name(const std::string& name) override
|
||||
{
|
||||
m_pclient->set_host_name(name);
|
||||
}
|
||||
bool connect(const std::string& host, int port, unsigned int timeout) override
|
||||
{
|
||||
return m_pclient->connect(host, port, timeout);
|
||||
}
|
||||
boost::asio::ip::tcp::socket& get_socket() override { return m_pclient->get_socket(); }
|
||||
bool set_timeouts(unsigned int connection_timeout, unsigned int recv_timeout) override { return m_pclient->set_timeouts(connection_timeout, recv_timeout); }
|
||||
bool connect(const std::string& host, std::string port) override { return m_pclient->connect(host, port); }
|
||||
bool connect(const std::string& host, const std::string& port, unsigned int timeout) override { return m_pclient->connect(host, port, timeout); }
|
||||
bool disconnect() override { return m_pclient->disconnect(); }
|
||||
bool is_connected() override { return m_pclient->is_connected(); }
|
||||
bool invoke_get(const std::string& uri, const std::string& body = std::string(), const http_response_info** ppresponse_info = nullptr, const fields_list& additional_params = fields_list()) override { return m_pclient->invoke_get(uri, body, ppresponse_info, additional_params); }
|
||||
bool invoke(const std::string& uri, const std::string& method, const std::string& body, const http_response_info** ppresponse_info = nullptr, const fields_list& additional_params = fields_list()) override { return m_pclient->invoke(uri, method, body, ppresponse_info, additional_params); }
|
||||
bool invoke_post(const std::string& uri, const std::string& body, const http_response_info** ppresponse_info = nullptr, const fields_list& additional_params = fields_list()) override { return m_pclient->invoke_post(uri, body, ppresponse_info, additional_params); }
|
||||
|
||||
void set_is_ssl(bool is_ssl)
|
||||
{
|
||||
if (m_is_ssl != is_ssl)
|
||||
{
|
||||
if (is_ssl)
|
||||
{
|
||||
m_pclient.reset(new https_simple_client());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pclient.reset(new http_simple_client());
|
||||
}
|
||||
m_is_ssl = is_ssl;
|
||||
}
|
||||
}
|
||||
private:
|
||||
bool m_is_ssl = false;
|
||||
std::shared_ptr<i_http_client> m_pclient;
|
||||
};
|
||||
|
||||
|
||||
template<typename transport>
|
||||
void configure_transport(const std::string schema, transport& tr)
|
||||
{}
|
||||
inline void configure_transport(const std::string schema, http_universal_client& tr)
|
||||
{
|
||||
if (schema == "https")
|
||||
tr.set_is_ssl(true);
|
||||
else
|
||||
tr.set_is_ssl(false);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
template<class t_transport>
|
||||
bool invoke_request(const std::string& url, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||
{
|
||||
http::url_content u_c{};
|
||||
bool r = parse_url(url, u_c);
|
||||
CHECK_AND_ASSERT_MES(tr.is_connected() || u_c.host.empty() || r, false, "failed to parse url: " << url);
|
||||
r = invoke_request(u_c, tr, timeout, ppresponse_info, method, body, additional_params);
|
||||
return r;
|
||||
}
|
||||
http::url_content u_c;
|
||||
bool res = parse_url(url, u_c);
|
||||
|
||||
template<class t_transport>
|
||||
bool invoke_request(const http::url_content& u_c, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||
{
|
||||
if (!tr.is_connected() && !u_c.host.empty())
|
||||
{
|
||||
int port = static_cast<int>(u_c.port);
|
||||
if (!port)
|
||||
port = 80;//default for http
|
||||
CHECK_AND_ASSERT_MES(res, false, "failed to parse url: " << url);
|
||||
|
||||
configure_transport(u_c.schema, tr);
|
||||
if (!tr.connect(u_c.host, port, timeout))
|
||||
if (!u_c.port)
|
||||
u_c.port = 80;//default for http
|
||||
|
||||
if (!tr.connect(u_c.host, static_cast<int>(u_c.port), timeout))
|
||||
{
|
||||
LOG_PRINT_L2("invoke_request: cannot connect to " << u_c.host << ":" << port);
|
||||
LOG_PRINT_L2("invoke_request: cannot connect to " << u_c.host << ":" << u_c.port);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1020,67 +937,28 @@ namespace epee
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
class http_https_simple_client_wrapper : virtual public http_simple_client, virtual public https_simple_client
|
||||
class interruptible_http_client : public http_simple_client
|
||||
{
|
||||
public:
|
||||
http_https_simple_client_wrapper(bool is_ssl, std::shared_ptr<idle_handler_base> ihb_cb)
|
||||
: m_ssl(is_ssl)
|
||||
, m_ihb_cb(ihb_cb)
|
||||
{}
|
||||
std::shared_ptr<idle_handler_base> m_pcb;
|
||||
bool m_permanent_error = false;
|
||||
|
||||
bool invoke_request(const http::url_content& u_c, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||
virtual bool handle_target_data(std::string& piece_of_transfer)
|
||||
{
|
||||
bool r = false;
|
||||
if (m_ssl)
|
||||
r = epee::net_utils::http::invoke_request(u_c, static_cast<https_simple_client&>(*this), timeout, ppresponse_info, method, body, additional_params);
|
||||
else
|
||||
r = epee::net_utils::http::invoke_request(u_c, static_cast<http_simple_client&>(*this), timeout, ppresponse_info, method, body, additional_params);
|
||||
return r;
|
||||
}
|
||||
|
||||
private:
|
||||
// class i_target_handler
|
||||
virtual bool handle_target_data(std::string& piece_of_transfer) override
|
||||
{
|
||||
bool r = false;
|
||||
if (m_ssl)
|
||||
r = m_ihb_cb->do_call(piece_of_transfer, https_simple_client::m_len_in_summary, https_simple_client::m_len_in_summary - https_simple_client::m_len_in_remain);
|
||||
else
|
||||
r = m_ihb_cb->do_call(piece_of_transfer, http_simple_client::m_len_in_summary, http_simple_client::m_len_in_summary - http_simple_client::m_len_in_remain);
|
||||
bool r = m_pcb->do_call(piece_of_transfer, m_len_in_summary, m_len_in_summary - m_len_in_remain);
|
||||
piece_of_transfer.clear();
|
||||
return r;
|
||||
}
|
||||
|
||||
bool m_ssl;
|
||||
std::shared_ptr<idle_handler_base> m_ihb_cb;
|
||||
};
|
||||
|
||||
|
||||
class interruptible_http_client
|
||||
{
|
||||
bool m_permanent_error = false;
|
||||
public:
|
||||
template<typename callback_t>
|
||||
bool invoke_cb(callback_t cb, const std::string& url, uint64_t timeout, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||
{
|
||||
http::url_content uc{};
|
||||
if (!parse_url(url, uc))
|
||||
{
|
||||
LOG_PRINT_L0("HTTP request to " << url << " failed because the URL couldn't be parsed.");
|
||||
m_permanent_error = true;
|
||||
return false;
|
||||
}
|
||||
bool is_ssl = uc.schema == "https";
|
||||
|
||||
http_https_simple_client_wrapper wrapper(is_ssl, std::make_shared<idle_handler<callback_t>>(cb));
|
||||
|
||||
m_pcb.reset(new idle_handler<callback_t>(cb));
|
||||
const http_response_info* p_hri = nullptr;
|
||||
bool r = wrapper.invoke_request(uc, timeout, &p_hri, method, body, additional_params);
|
||||
|
||||
bool r = invoke_request(url, *this, timeout, &p_hri, method, body, additional_params);
|
||||
if (p_hri && !(p_hri->m_response_code >= 200 && p_hri->m_response_code < 300))
|
||||
{
|
||||
LOG_PRINT_L0(boost::to_upper_copy(uc.schema) << " request to " << url << " failed with code: " << p_hri->m_response_code);
|
||||
LOG_PRINT_L0("HTTP request to " << url << " failed with code: " << p_hri->m_response_code);
|
||||
m_permanent_error = true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,133 @@
|
|||
#include "storages/portable_storage_template_helper.h"
|
||||
#include "http_base.h"
|
||||
#include "net/net_utils_base.h"
|
||||
#include "storages/portable_storage_extended_for_doc.h"
|
||||
|
||||
|
||||
|
||||
namespace epee
|
||||
template<typename typename_t>
|
||||
typename_t get_documentation_json_struct()
|
||||
{
|
||||
return AUTO_VAL_INIT_T(typename_t);
|
||||
}
|
||||
|
||||
template<typename request_t, typename response_t>
|
||||
bool auto_doc_t(const std::string& prefix_name, std::string& generate_reference)
|
||||
{
|
||||
if (!generate_reference.size()) return true;
|
||||
request_t req = get_documentation_json_struct<request_t>();
|
||||
response_t res = get_documentation_json_struct<response_t>();
|
||||
std::stringstream ss;
|
||||
ss << prefix_name << ENDL
|
||||
<< "REQUEST: " << ENDL << epee::serialization::store_t_to_json(req) << ENDL << "--------------------------------" << ENDL
|
||||
<< "RESPONSE: " << ENDL << epee::serialization::store_t_to_json(res) << ENDL << "################################" << ENDL;
|
||||
generate_reference += ss.str();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<typename command_type_t>
|
||||
bool auto_doc(const std::string& prefix_name, std::string& generate_reference)
|
||||
{
|
||||
return auto_doc_t<typename command_type_t::request, typename command_type_t::response>(prefix_name, generate_reference);
|
||||
}
|
||||
|
||||
namespace epee {
|
||||
namespace net_utils {
|
||||
namespace http {
|
||||
struct i_chain_handler
|
||||
{
|
||||
virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, epee::net_utils::http::http_response_info& response_info,
|
||||
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, std::string& generate_reference) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define CHAIN_HTTP_TO_MAP2(context_type) bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, \
|
||||
epee::net_utils::http::http_response_info& response, \
|
||||
context_type& m_conn_context) \
|
||||
{\
|
||||
response.m_response_code = 200; \
|
||||
response.m_response_comment = "Ok"; \
|
||||
std::string reference_stub; \
|
||||
bool call_found = false; \
|
||||
if(!handle_http_request_map(query_info, response, m_conn_context, call_found, reference_stub) && response.m_response_code == 200) \
|
||||
{ response.m_response_code = 500; response.m_response_comment = "Internal Server Error"; return true; } \
|
||||
if (!call_found) \
|
||||
{ response.m_response_code = 404; response.m_response_comment = "Not Found"; return true; } \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define BEGIN_URI_MAP2() template<class t_context> bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
||||
epee::net_utils::http::http_response_info& response_info, \
|
||||
t_context& m_conn_context, bool& call_found, std::string& generate_reference) { \
|
||||
call_found = false; \
|
||||
if(false) return true; //just a stub to have "else if"
|
||||
|
||||
#define BEGIN_URI_MAP2_VIRTUAL() virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
||||
epee::net_utils::http::http_response_info& response_info, \
|
||||
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, std::string& generate_reference) { \
|
||||
call_found = false; \
|
||||
if(false) return true; //just a stub to have "else if"
|
||||
|
||||
|
||||
#define MAP_URI2(pattern, callback) else if(std::string::npos != query_info.m_URI.find(pattern)) return callback(query_info, response_info, m_conn_context);
|
||||
|
||||
#define MAP_URI_AUTO_XML2(s_pattern, callback_f, command_type) //TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
||||
|
||||
#define MAP_URI_AUTO_JON2(s_pattern, callback_f, command_type) \
|
||||
else if(auto_doc<command_type>(s_pattern "[JSON]", generate_reference) && query_info.m_URI == s_pattern) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
uint64_t ticks = misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::request> req; \
|
||||
bool res = epee::serialization::load_t_from_json(static_cast<command_type::request&>(req), query_info.m_body); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to parse json: \r\n" << query_info.m_body); \
|
||||
uint64_t ticks1 = epee::misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::response> resp;\
|
||||
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
||||
uint64_t ticks2 = epee::misc_utils::get_tick_count(); \
|
||||
epee::serialization::store_t_to_json(static_cast<command_type::response&>(resp), response_info.m_body); \
|
||||
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
||||
response_info.m_mime_tipe = "application/json"; \
|
||||
response_info.m_header_info.m_content_type = " application/json"; \
|
||||
LOG_PRINT("[HTTP/JSON][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
||||
}
|
||||
|
||||
#define MAP_URI_AUTO_BIN2(s_pattern, callback_f, command_type) \
|
||||
else if(auto_doc<command_type>(s_pattern "[BIN]", generate_reference) && query_info.m_URI == s_pattern) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
uint64_t ticks = misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::request> req; \
|
||||
bool res = epee::serialization::load_t_from_binary(static_cast<command_type::request&>(req), query_info.m_body); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to parse bin body data, body size=" << query_info.m_body.size()); \
|
||||
uint64_t ticks1 = misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::response> resp;\
|
||||
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
||||
uint64_t ticks2 = misc_utils::get_tick_count(); \
|
||||
epee::serialization::store_t_to_binary(static_cast<command_type::response&>(resp), response_info.m_body); \
|
||||
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
||||
response_info.m_mime_tipe = " application/octet-stream"; \
|
||||
response_info.m_header_info.m_content_type = " application/octet-stream"; \
|
||||
LOG_PRINT( "[HTTP/BIN][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
||||
}
|
||||
|
||||
#define CHAIN_TO_PHANDLER(pi_chain_handler) else if (pi_chain_handler && pi_chain_handler->handle_http_request_map(query_info, response_info, m_conn_context, call_found, generate_reference) && call_found) { return true;}
|
||||
|
||||
#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);call_found = true;}
|
||||
|
||||
#define END_URI_MAP2() return true;}
|
||||
|
||||
|
||||
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace json_rpc
|
||||
{
|
||||
|
|
@ -47,7 +169,7 @@ namespace epee
|
|||
t_param params;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(jsonrpc) DOC_DSCR("") DOC_EXMP("2.0") DOC_END
|
||||
KV_SERIALIZE(jsonrpc)
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(method)
|
||||
KV_SERIALIZE(params)
|
||||
|
|
@ -63,7 +185,7 @@ namespace epee
|
|||
KV_SERIALIZE(message)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
||||
struct dummy_error
|
||||
{
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
|
|
@ -98,7 +220,7 @@ namespace epee
|
|||
t_param result;
|
||||
epee::serialization::storage_entry id;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(jsonrpc) DOC_DSCR("") DOC_EXMP("2.0") DOC_END
|
||||
KV_SERIALIZE(jsonrpc)
|
||||
KV_SERIALIZE(id)
|
||||
KV_SERIALIZE(result)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
|
|
@ -123,277 +245,20 @@ namespace epee
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename typename_t>
|
||||
typename_t get_documentation_json_struct()
|
||||
template<typename command_type_t>
|
||||
struct json_command_type_t
|
||||
{
|
||||
return AUTO_VAL_INIT_T(typename_t);
|
||||
}
|
||||
|
||||
struct documentation_entry
|
||||
{
|
||||
std::string uri;
|
||||
bool is_binary = false; //if not - then it's JSON
|
||||
std::string json_method_name;
|
||||
std::string request_json_example;
|
||||
std::string request_json_descriptions;
|
||||
|
||||
std::string response_json_example;
|
||||
std::string response_json_descriptions;
|
||||
|
||||
std::string method_general_decription;
|
||||
typedef typename epee::json_rpc::request<typename command_type_t::request> request;
|
||||
typedef typename epee::json_rpc::request<typename command_type_t::response> response;
|
||||
};
|
||||
|
||||
struct documentation
|
||||
{
|
||||
bool do_generate_documentation = false;
|
||||
std::list<documentation_entry> entries;
|
||||
};
|
||||
|
||||
// Primary template
|
||||
template<typename T>
|
||||
struct has_static_member_description {
|
||||
private:
|
||||
// SFINAE test function
|
||||
template<typename U>
|
||||
static auto test(int) -> decltype(U::description, std::true_type{});
|
||||
|
||||
// Fallback function
|
||||
template<typename>
|
||||
static auto test(...) -> std::false_type;
|
||||
|
||||
public:
|
||||
// Member constant indicating whether T has a static member
|
||||
static constexpr bool value = decltype(test<T>(0))::value;
|
||||
};
|
||||
#define JSON_RPC_REFERENCE_MARKER "JSON_RPC"
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
const char* get_command_description()
|
||||
{
|
||||
if constexpr (has_static_member_description<T>::value)
|
||||
{
|
||||
return T::description;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "NO DESCRIPTION";
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void f(T) {} // Definition #2
|
||||
|
||||
|
||||
// Base template
|
||||
template<typename T>
|
||||
struct is_std_simple_container : std::false_type {};
|
||||
|
||||
// Specializations for each container
|
||||
template<typename T, typename Alloc>
|
||||
struct is_std_simple_container<std::vector<T, Alloc>> : std::true_type {};
|
||||
|
||||
template<typename T, typename Alloc>
|
||||
struct is_std_simple_container<std::deque<T, Alloc>> : std::true_type {};
|
||||
|
||||
template<typename T, typename Alloc>
|
||||
struct is_std_simple_container<std::list<T, Alloc>> : std::true_type {};
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct is_std_simple_container<std::array<T, N>> : std::true_type {};
|
||||
|
||||
|
||||
template<typename command_type_t, bool is_json_rpc_method>
|
||||
bool auto_doc(const std::string& uri, const std::string& method, bool is_json, documentation& docs)
|
||||
{
|
||||
if (!docs.do_generate_documentation) return true;
|
||||
|
||||
docs.entries.resize(docs.entries.size()+1);
|
||||
docs.entries.back().is_binary = !is_json;
|
||||
docs.entries.back().uri = uri;
|
||||
docs.entries.back().json_method_name = method;
|
||||
docs.entries.back().method_general_decription = get_command_description<command_type_t>();
|
||||
|
||||
if constexpr (is_json_rpc_method)
|
||||
{
|
||||
//json rpc-like call
|
||||
typedef typename epee::json_rpc::request<typename command_type_t::request> request_t;
|
||||
typedef typename epee::json_rpc::response<typename command_type_t::response, typename epee::json_rpc::dummy_error> response_t;
|
||||
request_t req = AUTO_VAL_INIT(req); //get_documentation_json_struct<request_t>();
|
||||
if constexpr (is_std_simple_container<typename command_type_t::request>::value)
|
||||
{
|
||||
req.params.resize(1);
|
||||
}
|
||||
|
||||
response_t res = AUTO_VAL_INIT(res);
|
||||
if constexpr (is_std_simple_container<typename command_type_t::response>::value)
|
||||
{
|
||||
req.result.resize(1);
|
||||
}
|
||||
|
||||
req.method = method;
|
||||
epee::serialization::portable_storage_extended_doc ps;
|
||||
req.store(ps, nullptr);
|
||||
ps.dump_as_json(docs.entries.back().request_json_example);
|
||||
ps.dump_as_decriptions(docs.entries.back().request_json_descriptions);
|
||||
|
||||
epee::serialization::portable_storage_extended_doc ps_res;
|
||||
res.store(ps_res, nullptr);
|
||||
ps_res.dump_as_json(docs.entries.back().response_json_example);
|
||||
ps_res.dump_as_decriptions(docs.entries.back().response_json_descriptions);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//json/bin uri/based
|
||||
typedef typename command_type_t::request request_t;
|
||||
typedef typename command_type_t::response response_t;
|
||||
|
||||
request_t req = AUTO_VAL_INIT(req); //get_documentation_json_struct<request_t>();
|
||||
response_t res = AUTO_VAL_INIT(res); //get_documentation_json_struct<response_t>();
|
||||
|
||||
|
||||
epee::serialization::portable_storage_extended_doc ps;
|
||||
req.store(ps, nullptr);
|
||||
ps.dump_as_json(docs.entries.back().request_json_example);
|
||||
ps.dump_as_decriptions(docs.entries.back().request_json_descriptions);
|
||||
|
||||
epee::serialization::portable_storage_extended_doc ps_res;
|
||||
res.store(ps_res, nullptr);
|
||||
ps_res.dump_as_json(docs.entries.back().response_json_example);
|
||||
ps_res.dump_as_decriptions(docs.entries.back().response_json_descriptions);
|
||||
}
|
||||
|
||||
|
||||
// std::stringstream ss;
|
||||
// ss << prefix_name << ENDL
|
||||
// << "REQUEST: " << ENDL << req_str << ENDL << req_str_descr << "--------------------------------" << ENDL
|
||||
// << "RESPONSE: " << ENDL << res_str << ENDL << res_str_descr << "################################" << ENDL;
|
||||
// generate_reference += ss.str();
|
||||
return true;
|
||||
|
||||
//return auto_doc_t<typename command_type_t::request, typename command_type_t::response>(prefix_name, generate_reference);
|
||||
}
|
||||
|
||||
namespace epee {
|
||||
namespace net_utils {
|
||||
namespace http {
|
||||
struct i_chain_handler
|
||||
{
|
||||
virtual bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, epee::net_utils::http::http_response_info& response_info,
|
||||
epee::net_utils::connection_context_base& conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation)
|
||||
{
|
||||
return this->handle_http_request_map(query_info, response_info, conn_context, call_found, docs);
|
||||
}
|
||||
|
||||
virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, epee::net_utils::http::http_response_info& response_info,
|
||||
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation) = 0;
|
||||
|
||||
|
||||
static inline documentation m_empty_documentation;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#define CHAIN_HTTP_TO_MAP2(context_type) bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, \
|
||||
epee::net_utils::http::http_response_info& response, \
|
||||
context_type& m_conn_context) \
|
||||
{\
|
||||
response.m_response_code = 200; \
|
||||
response.m_response_comment = "Ok"; \
|
||||
bool call_found = false; \
|
||||
if(!handle_http_request_map(query_info, response, m_conn_context, call_found) && response.m_response_code == 200) \
|
||||
{ response.m_response_code = 500; response.m_response_comment = "Internal Server Error"; return true; } \
|
||||
if (!call_found) \
|
||||
{ response.m_response_code = 404; response.m_response_comment = "Not Found"; return true; } \
|
||||
return true; \
|
||||
}
|
||||
|
||||
#define BEGIN_URI_MAP2() template<class t_context> bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
||||
epee::net_utils::http::http_response_info& response_info, \
|
||||
t_context& m_conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation) { \
|
||||
call_found = false; \
|
||||
if(false) return true; //just a stub to have "else if"
|
||||
|
||||
#define BEGIN_URI_MAP2_VIRTUAL() virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
||||
epee::net_utils::http::http_response_info& response_info, \
|
||||
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation) { \
|
||||
call_found = false; \
|
||||
if(false) return true; //just a stub to have "else if"
|
||||
|
||||
|
||||
#define MAP_URI2(pattern, callback) else if(std::string::npos != query_info.m_URI.find(pattern)) return callback(query_info, response_info, m_conn_context);
|
||||
|
||||
#define MAP_URI_AUTO_XML2(s_pattern, callback_f, command_type) //TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
||||
|
||||
#define MAP_URI_AUTO_JON2(s_pattern, callback_f, command_type) \
|
||||
else if(auto_doc<command_type, false>(s_pattern, "", true, docs) && query_info.m_URI == s_pattern) \
|
||||
#define BEGIN_JSON_RPC_MAP(uri) else if(query_info.m_URI == JSON_RPC_REFERENCE_MARKER || query_info.m_URI == uri) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
uint64_t ticks = misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::request> req; \
|
||||
bool res = epee::serialization::load_t_from_json(static_cast<command_type::request&>(req), query_info.m_body); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to parse json: \r\n" << query_info.m_body); \
|
||||
uint64_t ticks1 = epee::misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::response> resp;\
|
||||
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
||||
uint64_t ticks2 = epee::misc_utils::get_tick_count(); \
|
||||
epee::serialization::store_t_to_json(static_cast<command_type::response&>(resp), response_info.m_body); \
|
||||
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
||||
response_info.m_mime_tipe = "application/json"; \
|
||||
response_info.m_header_info.m_content_type = " application/json"; \
|
||||
LOG_PRINT("[HTTP/JSON][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
||||
}
|
||||
|
||||
#define MAP_URI_AUTO_BIN2(s_pattern, callback_f, command_type) \
|
||||
else if(auto_doc<command_type, false>(s_pattern, "", false, docs) && query_info.m_URI == s_pattern) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
uint64_t ticks = misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::request> req; \
|
||||
bool res = epee::serialization::load_t_from_binary(static_cast<command_type::request&>(req), query_info.m_body); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to parse bin body data, body size=" << query_info.m_body.size()); \
|
||||
uint64_t ticks1 = misc_utils::get_tick_count(); \
|
||||
boost::value_initialized<command_type::response> resp;\
|
||||
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
||||
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
||||
uint64_t ticks2 = misc_utils::get_tick_count(); \
|
||||
epee::serialization::store_t_to_binary(static_cast<command_type::response&>(resp), response_info.m_body); \
|
||||
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
||||
response_info.m_mime_tipe = " application/octet-stream"; \
|
||||
response_info.m_header_info.m_content_type = " application/octet-stream"; \
|
||||
LOG_PRINT( "[HTTP/BIN][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
||||
}
|
||||
|
||||
#define CHAIN_TO_PHANDLER(pi_chain_handler) else if (pi_chain_handler && pi_chain_handler->handle_http_request(query_info, response_info, m_conn_context, call_found, docs) && call_found) { return true;}
|
||||
|
||||
#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);call_found = true;}
|
||||
|
||||
#define END_URI_MAP2() return true;}
|
||||
|
||||
|
||||
|
||||
//template<typename command_type_t>
|
||||
//struct json_command_type_t
|
||||
//{
|
||||
// typedef typename epee::json_rpc::request<typename command_type_t::request> request;
|
||||
// typedef typename epee::json_rpc::request<typename command_type_t::response> response;
|
||||
//};
|
||||
|
||||
//#define JSON_RPC_REFERENCE_MARKER "JSON_RPC"
|
||||
|
||||
// if(query_info.m_URI == JSON_RPC_REFERENCE_MARKER) {generate_reference = "JSON RPC URL: " uri "\n";} \
|
||||
|
||||
#define BEGIN_JSON_RPC_MAP(uri) else if(docs.do_generate_documentation || query_info.m_URI == uri) \
|
||||
{ \
|
||||
const char* current_zone_json_uri = uri;\
|
||||
if(query_info.m_URI == JSON_RPC_REFERENCE_MARKER) {generate_reference = "JSON RPC URL: " uri "\n";} \
|
||||
LOG_PRINT_L4("[JSON_REQUEST_BODY]: " << ENDL << query_info.m_body); \
|
||||
uint64_t ticks = epee::misc_utils::get_tick_count(); \
|
||||
epee::serialization::portable_storage ps; \
|
||||
|
|
@ -452,7 +317,7 @@ namespace epee {
|
|||
LOG_PRINT( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2);
|
||||
|
||||
#define MAP_JON_RPC_WE(method_name, callback_f, command_type) \
|
||||
else if(auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||
else if(auto_doc<json_command_type_t<command_type>>("[" method_name "]", generate_reference) && callback_name == method_name) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||
|
|
@ -470,7 +335,7 @@ namespace epee {
|
|||
}
|
||||
|
||||
#define MAP_JON_RPC_WERI(method_name, callback_f, command_type) \
|
||||
else if(auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||
else if(auto_doc<json_command_type_t<command_type>>("[" method_name "]", generate_reference) && callback_name == method_name) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||
|
|
@ -488,27 +353,7 @@ namespace epee {
|
|||
}
|
||||
|
||||
#define MAP_JON_RPC(method_name, callback_f, command_type) \
|
||||
else if(auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||
if(!callback_f(req.params, resp.result, m_conn_context)) \
|
||||
{ \
|
||||
epee::json_rpc::error_response fail_resp = AUTO_VAL_INIT(fail_resp); \
|
||||
fail_resp.jsonrpc = "2.0"; \
|
||||
fail_resp.method = req.method; \
|
||||
fail_resp.id = req.id; \
|
||||
fail_resp.error.code = -32603; \
|
||||
fail_resp.error.message = "Internal error"; \
|
||||
epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(fail_resp), response_info.m_body); \
|
||||
return true; \
|
||||
} \
|
||||
FINALIZE_OBJECTS_TO_JSON(method_name) \
|
||||
return true;\
|
||||
}
|
||||
|
||||
#define MAP_JON_RPC_CONDITIONAL(method_name, callback_f, command_type, predicate) \
|
||||
else if(predicate && auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||
else if(auto_doc<json_command_type_t<command_type>>(std::string("[") + method_name + "]", generate_reference) && callback_name == method_name) \
|
||||
{ \
|
||||
call_found = true; \
|
||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||
|
|
@ -541,53 +386,4 @@ namespace epee {
|
|||
return true; \
|
||||
}
|
||||
|
||||
namespace epee
|
||||
{
|
||||
template<typename t_rpc_server>
|
||||
bool generate_doc_as_md_files(const std::string& folder, t_rpc_server& server, const std::string& sufix = std::string())
|
||||
{
|
||||
LOG_PRINT_L0("Dumping RPC auto-generated documents!");
|
||||
epee::net_utils::http::http_request_info query_info;
|
||||
epee::net_utils::http::http_response_info response_info;
|
||||
epee::net_utils::connection_context_base conn_context;
|
||||
//std::string generate_reference = std::string("WALLET_RPC_COMMANDS_LIST:\n");
|
||||
bool call_found = false;
|
||||
|
||||
documentation docs;
|
||||
docs.do_generate_documentation = true;
|
||||
// query_info.m_URI = JSON_RPC_REFERENCE_MARKER;
|
||||
query_info.m_body = "{\"jsonrpc\": \"2.0\", \"method\": \"nonexisting_method\", \"params\": {}},";
|
||||
server.handle_http_request_map(query_info, response_info, conn_context, call_found, docs);
|
||||
|
||||
for (const auto& de : docs.entries)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << de.method_general_decription << ENDL << ENDL;;
|
||||
|
||||
ss << "URL: ```http:://127.0.0.1:11211" << de.uri << "```" << ENDL;
|
||||
|
||||
ss << "### Request: " << ENDL << "```json" << ENDL << de.request_json_example << ENDL << "```" << ENDL;
|
||||
ss << "### Request description: " << ENDL << "```" << ENDL << de.request_json_descriptions << ENDL << "```" << ENDL;
|
||||
ss << "### Response: " << ENDL << "```json" << ENDL << de.response_json_example << ENDL << "```" << ENDL;
|
||||
ss << "### Response description: " << ENDL << "```" << ENDL << de.response_json_descriptions << ENDL << "```" << ENDL;
|
||||
|
||||
ss << sufix;
|
||||
|
||||
std::string filename = de.json_method_name;
|
||||
if (!filename.size())
|
||||
{
|
||||
filename = de.uri;
|
||||
if (filename.front() == '/')
|
||||
filename.erase(filename.begin());
|
||||
}
|
||||
filename += ".md";
|
||||
bool r = epee::file_io_utils::save_string_to_file(folder + "/" + filename, ss.str());
|
||||
if (!r)
|
||||
{
|
||||
LOG_ERROR("Failed to save file " << filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,25 +33,6 @@
|
|||
|
||||
#define LEVIN_SIGNATURE 0x0101010101012101LL //Bender's nightmare
|
||||
|
||||
|
||||
|
||||
#define LEVIN_OK 0
|
||||
#define LEVIN_ERROR_CONNECTION -1
|
||||
#define LEVIN_ERROR_CONNECTION_NOT_FOUND -2
|
||||
#define LEVIN_ERROR_CONNECTION_DESTROYED -3
|
||||
#define LEVIN_ERROR_CONNECTION_TIMEDOUT -4
|
||||
#define LEVIN_ERROR_CONNECTION_NO_DUPLEX_PROTOCOL -5
|
||||
#define LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED -6
|
||||
#define LEVIN_ERROR_FORMAT -7
|
||||
#define LEVIN_ERROR_EXCEPTION -8
|
||||
#define LEVIN_ERROR_UNKNOWN_ERROR -9
|
||||
#define LEVIN_ERROR_INTERNAL -10
|
||||
#define LEVIN_ERROR_PROTOCOL_INCONSISTENT -11
|
||||
#define LEVIN_ERROR_NET_ERROR -12
|
||||
#define LEVIN_ERROR_SIGNATURE_MISMATCH -13
|
||||
|
||||
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace levin
|
||||
|
|
@ -105,15 +86,23 @@ namespace levin
|
|||
|
||||
virtual void on_connection_new(t_connection_context& context){};
|
||||
virtual void on_connection_close(t_connection_context& context){};
|
||||
|
||||
};
|
||||
|
||||
template<class t_connection_context = net_utils::connection_context_base>
|
||||
struct levin_commands_handler_dummy: public levin_commands_handler<t_connection_context>
|
||||
{
|
||||
virtual int invoke(int command, const std::string& in_buff, std::string& buff_out, t_connection_context& context) { return LEVIN_OK; }
|
||||
virtual int notify(int command, const std::string& in_buff, t_connection_context& context) { return LEVIN_OK; }
|
||||
};
|
||||
|
||||
#define LEVIN_OK 0
|
||||
#define LEVIN_ERROR_CONNECTION -1
|
||||
#define LEVIN_ERROR_CONNECTION_NOT_FOUND -2
|
||||
#define LEVIN_ERROR_CONNECTION_DESTROYED -3
|
||||
#define LEVIN_ERROR_CONNECTION_TIMEDOUT -4
|
||||
#define LEVIN_ERROR_CONNECTION_NO_DUPLEX_PROTOCOL -5
|
||||
#define LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED -6
|
||||
#define LEVIN_ERROR_FORMAT -7
|
||||
#define LEVIN_ERROR_EXCEPTION -8
|
||||
#define LEVIN_ERROR_UNKNOWN_ERROR -9
|
||||
#define LEVIN_ERROR_INTERNAL -10
|
||||
#define LEVIN_ERROR_PROTOCOL_INCONSISTENT -11
|
||||
#define LEVIN_ERROR_NET_ERROR -12
|
||||
#define LEVIN_ERROR_SIGNATURE_MISMATCH -13
|
||||
|
||||
#define DESCRIBE_RET_CODE(code) case code: return #code;
|
||||
inline
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class async_protocol_handler_config
|
|||
critical_section m_connects_lock;
|
||||
std::atomic<bool> m_is_in_sendstop_loop;
|
||||
connections_map m_connects;
|
||||
levin_commands_handler_dummy<t_connection_context> m_commands_handler_dummy;
|
||||
|
||||
void add_connection(async_protocol_handler<t_connection_context>* pc);
|
||||
void del_connection(async_protocol_handler<t_connection_context>* pc);
|
||||
|
|
@ -88,7 +87,7 @@ public:
|
|||
bool foreach_connection(callback_t cb);
|
||||
size_t get_connections_count();
|
||||
|
||||
async_protocol_handler_config() :m_pcommands_handler(&m_commands_handler_dummy), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{}
|
||||
async_protocol_handler_config() :m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{}
|
||||
{}
|
||||
~async_protocol_handler_config()
|
||||
{
|
||||
|
|
@ -253,7 +252,6 @@ public:
|
|||
LOG_PRINT_CC(m_connection_context, "[LEVIN_PROTOCOL" << this << "] CONSTRUCTED", LOG_LEVEL_4);
|
||||
}
|
||||
|
||||
|
||||
virtual ~async_protocol_handler()
|
||||
{
|
||||
NESTED_TRY_ENTRY();
|
||||
|
|
@ -280,11 +278,6 @@ public:
|
|||
NESTED_CATCH_ENTRY(__func__);
|
||||
}
|
||||
|
||||
void on_pre_destroy()
|
||||
{
|
||||
m_config.del_connection(this);
|
||||
}
|
||||
|
||||
bool start_outer_call()
|
||||
{
|
||||
LOG_PRINT_CC_L4(m_connection_context, "[LEVIN_PROTOCOL" << this << "] -->> start_outer_call");
|
||||
|
|
@ -356,7 +349,7 @@ public:
|
|||
//update threads name to see connection context where errors came from
|
||||
std::string original_prefix = epee::log_space::log_singletone::get_thread_log_prefix();
|
||||
epee::log_space::log_singletone::set_thread_log_prefix(original_prefix + "[" + epee::net_utils::print_connection_context_short(m_connection_context) + "]");
|
||||
ON_FUNC_EXIT([&](){epee::log_space::log_singletone::set_thread_log_prefix(original_prefix); });
|
||||
ON_EXIT([&](){epee::log_space::log_singletone::set_thread_log_prefix(original_prefix); });
|
||||
|
||||
//create_scope_leave_handler()
|
||||
|
||||
|
|
@ -817,9 +810,7 @@ template<class t_connection_context> template<class callback_t>
|
|||
bool async_protocol_handler_config<t_connection_context>::foreach_connection(callback_t cb)
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_connects_lock);
|
||||
//in case any of the cb() leads to erasing items from m_connects, let's go over local copy of it
|
||||
auto connects_local = m_connects;
|
||||
for(auto& c: connects_local)
|
||||
for(auto& c: m_connects)
|
||||
{
|
||||
async_protocol_handler<t_connection_context>* aph = c.second;
|
||||
if(!cb(aph->get_context_ref()))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
|
||||
// Copyright (c) 2019, anonimal, <anonimal@zano.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -116,9 +116,7 @@ namespace epee
|
|||
|
||||
void on_after_connect()
|
||||
{
|
||||
LOG_PRINT_L2("SSL Handshake....");
|
||||
m_socket.handshake(boost::asio::ssl::stream_base::client);
|
||||
LOG_PRINT_L2("SSL Handshake OK");
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -151,52 +149,11 @@ namespace epee
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
|
||||
}
|
||||
private:
|
||||
boost::asio::ip::tcp::socket m_socket;
|
||||
};
|
||||
|
||||
|
||||
template<bool is_ssl>
|
||||
struct socket_backend_resetable
|
||||
{
|
||||
socket_backend_resetable(boost::asio::io_service& _io_service) : mr_io_service(_io_service), m_pbackend(std::make_shared<socket_backend<is_ssl>>(_io_service))
|
||||
{}
|
||||
|
||||
boost::asio::ip::tcp::socket& get_socket()
|
||||
{
|
||||
return m_pbackend->get_socket();
|
||||
}
|
||||
|
||||
void set_domain(const std::string& domain_name)
|
||||
{
|
||||
return m_pbackend->set_domain(domain_name);
|
||||
}
|
||||
|
||||
auto& get_stream()
|
||||
{
|
||||
return m_pbackend->get_stream();
|
||||
}
|
||||
|
||||
void on_after_connect()
|
||||
{
|
||||
return m_pbackend->on_after_connect();
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_pbackend = std::make_shared<socket_backend<is_ssl>>(mr_io_service);
|
||||
}
|
||||
|
||||
private:
|
||||
boost::asio::io_service& mr_io_service;
|
||||
std::shared_ptr<socket_backend<is_ssl>> m_pbackend;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<bool is_ssl>
|
||||
|
|
@ -270,7 +227,6 @@ namespace epee
|
|||
inline
|
||||
bool connect(const std::string& addr, const std::string& port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
|
||||
{
|
||||
LOG_PRINT_L1("Connecting to " << addr << ":" << port << ", cn_timeout: " << connect_timeout << ", rv_timeout: " << reciev_timeout);
|
||||
m_connect_timeout = connect_timeout;
|
||||
m_reciev_timeout = reciev_timeout;
|
||||
m_connected = false;
|
||||
|
|
@ -282,7 +238,7 @@ namespace epee
|
|||
m_sct_back.get_socket().close();
|
||||
// Get a list of endpoints corresponding to the server name.
|
||||
|
||||
m_sct_back.reset();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
boost::asio::ip::tcp::resolver resolver(m_io_service);
|
||||
|
|
@ -325,14 +281,13 @@ namespace epee
|
|||
if (!ec && m_sct_back.get_socket().is_open())
|
||||
{
|
||||
m_sct_back.on_after_connect();
|
||||
m_connected = true;
|
||||
m_connected = true;
|
||||
m_deadline.expires_at(boost::posix_time::pos_infin);
|
||||
LOG_PRINT_L1("Connected OK: " << addr << ":" << port);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_PRINT("Error on connect to " << addr << ":" << port << ", message: " << ec.message(), LOG_LEVEL_3);
|
||||
LOG_PRINT("Some problems at connect, message: " << ec.message(), LOG_LEVEL_3);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -697,7 +652,7 @@ namespace epee
|
|||
// The deadline has passed. The socket is closed so that any outstanding
|
||||
// asynchronous operations are cancelled. This allows the blocked
|
||||
// connect(), read_line() or write_line() functions to return.
|
||||
LOG_PRINT_L2("Timed out socket");
|
||||
LOG_PRINT_L3("Timed out socket");
|
||||
m_connected = false;
|
||||
m_sct_back.get_socket().close();
|
||||
|
||||
|
|
@ -714,7 +669,7 @@ namespace epee
|
|||
|
||||
protected:
|
||||
boost::asio::io_service m_io_service;
|
||||
socket_backend_resetable<is_ssl> m_sct_back;//socket_backend<is_ssl> m_sct_back;
|
||||
socket_backend<is_ssl> m_sct_back;
|
||||
int m_connect_timeout;
|
||||
int m_reciev_timeout;
|
||||
bool m_initialized;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
// Copyright (c) 2024, Zano Project
|
||||
// Copyright (c) 2006-2017, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -36,14 +35,11 @@ namespace epee
|
|||
inline std::string print_fixed_decimal_point(t_number amount, size_t decimal_point)
|
||||
{
|
||||
std::string s = boost::lexical_cast<std::string>(amount);
|
||||
if (decimal_point > 32)
|
||||
return std::string("!!") + s; // avoiding overflow issues
|
||||
if (s.size() < decimal_point + 1)
|
||||
{
|
||||
s.insert(0, decimal_point + 1 - s.size(), '0');
|
||||
}
|
||||
if (decimal_point > 0)
|
||||
s.insert(s.size() - decimal_point, ".");
|
||||
s.insert(s.size() - decimal_point, ".");
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019, anonimal <anonimal@zano.org>
|
||||
// Copyright (c) 2019, anonimal <anonimal@lethean.org>
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
//
|
||||
|
||||
#pragma once
|
||||
#include <type_traits>
|
||||
#include <optional>
|
||||
#include "misc_language.h"
|
||||
namespace epee
|
||||
{
|
||||
|
|
@ -53,73 +51,24 @@ namespace epee
|
|||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_std_optional : std::false_type {};
|
||||
|
||||
template<typename T>
|
||||
struct is_std_optional<std::optional<T>> : std::true_type {};
|
||||
|
||||
|
||||
template<typename T>
|
||||
struct is_std_optional<boost::optional<T>> : std::true_type {};
|
||||
|
||||
|
||||
//basic helpers for pod-to-hex serialization
|
||||
template<class t_pod_type>
|
||||
std::string transform_t_pod_to_str_internal(const t_pod_type& a)
|
||||
{
|
||||
return epee::string_tools::pod_to_hex(a);
|
||||
}
|
||||
|
||||
template<class t_pod_type>
|
||||
std::string transform_t_pod_to_str_internal(const std::optional<t_pod_type>& a)
|
||||
{
|
||||
if (a.has_value())
|
||||
return epee::string_tools::pod_to_hex(*a);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
template<class t_pod_type>
|
||||
std::string transform_t_pod_to_str_internal(const boost::optional<t_pod_type>& a)
|
||||
{
|
||||
if (a.has_value())
|
||||
return epee::string_tools::pod_to_hex(*a);
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
//basic helpers for pod-to-hex serialization
|
||||
template<class t_pod_type>
|
||||
std::string transform_t_pod_to_str(const t_pod_type & a)
|
||||
{
|
||||
return transform_t_pod_to_str_internal(a);
|
||||
return epee::string_tools::pod_to_hex(a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class t_pod_type>
|
||||
template<class t_pod_type>
|
||||
t_pod_type transform_str_to_t_pod(const std::string& a)
|
||||
{
|
||||
t_pod_type res = AUTO_VAL_INIT(res);
|
||||
t_pod_type res = AUTO_VAL_INIT(res);
|
||||
if (a.empty())
|
||||
return res;
|
||||
if constexpr (is_std_optional<t_pod_type>::value)
|
||||
{
|
||||
typename t_pod_type::value_type v = AUTO_VAL_INIT(v);
|
||||
if (!epee::string_tools::hex_to_pod(a, v))
|
||||
throw std::runtime_error(std::string("Unable to transform \"") + a + "\" to pod type " + typeid(typename t_pod_type::value_type).name());
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
if (!epee::string_tools::hex_to_pod(a, res))
|
||||
throw std::runtime_error(std::string("Unable to transform \"") + a + "\" to pod type " + typeid(t_pod_type).name());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//basic helpers for blob-to-hex serialization
|
||||
|
||||
inline std::string transform_binbuf_to_hexstr(const std::string& a)
|
||||
|
|
@ -136,57 +85,6 @@ namespace epee
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// helper for blob-to-base64 serialization
|
||||
inline std::string transfrom_binbuf_to_base64(const std::string& a)
|
||||
{
|
||||
return epee::string_encoding::base64_encode(a);
|
||||
}
|
||||
|
||||
inline std::string transform_base64_to_binbuf(const std::string& a)
|
||||
{
|
||||
return epee::string_encoding::base64_decode(a);
|
||||
}
|
||||
|
||||
|
||||
//basic helpers for pod-to-hex serialization
|
||||
template<class t_pod_container_type>
|
||||
std::string transform_t_pod_array_to_hex_str_array(const t_pod_container_type& a)
|
||||
{
|
||||
std::string res;
|
||||
for (const auto& item : a)
|
||||
{
|
||||
res += epee::string_tools::pod_to_hex(item) + ", ";
|
||||
}
|
||||
if (a.size())
|
||||
{
|
||||
res.erase(res.size() - 2);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
template<class t_pod_container_type>
|
||||
t_pod_container_type transform_hex_str_array_to_t_pod_array(const std::string& a)
|
||||
{
|
||||
std::vector<std::string> pod_items;
|
||||
boost::split(pod_items, a, boost::is_any_of(", ][\""));
|
||||
|
||||
t_pod_container_type res;
|
||||
if (!a.size())
|
||||
return res;
|
||||
for (const auto& item : pod_items)
|
||||
{
|
||||
if(!item.size())
|
||||
continue;
|
||||
|
||||
res.resize(res.size() + 1);
|
||||
typename t_pod_container_type::value_type& pod_val = res.back();
|
||||
|
||||
if (!epee::string_tools::hex_to_pod(item, pod_val))
|
||||
throw std::runtime_error(std::string("Unable to transform \"") + item + "\" to pod type " + typeid(typename t_pod_container_type::value_type).name());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
#pragma pack(push, 1)
|
||||
template<class first_t, class second_t>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#include "keyvalue_helpers.h"
|
||||
#include "keyvalue_serialization_overloads.h"
|
||||
namespace epee
|
||||
{
|
||||
{
|
||||
/************************************************************************/
|
||||
/* Serialize map declarations */
|
||||
/************************************************************************/
|
||||
|
|
@ -65,72 +65,13 @@ public: \
|
|||
static bool serialize_map(this_type& this_ref, t_storage& stg, typename t_storage::hsection hparent_section) \
|
||||
{
|
||||
|
||||
|
||||
#define KV_CAT_(a, b) a ## b
|
||||
#define KV_CAT(a, b) KV_CAT_(a, b)
|
||||
#define VARNAME(Var) KV_CAT(Var, __LINE__)
|
||||
|
||||
#define KV_MAKE_ALIAS_NAME() VARNAME(alias_tmp_name)
|
||||
#define KV_MAKE_VAR_NAME() VARNAME(val_tmp_name)
|
||||
|
||||
#define KV_SERIALIZE_N(varialble, val_name) \
|
||||
using KV_MAKE_ALIAS_NAME() [[maybe_unused]] = decltype(this_ref.varialble); \
|
||||
[[maybe_unused]] const char* KV_MAKE_VAR_NAME() = val_name;\
|
||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
|
||||
|
||||
//#define KV_SERIALIZE_N_DOC(varialble, val_name) \
|
||||
// using KV_MAKE_ALIAS_NAME() = decltype(this_ref.varialble); \
|
||||
// epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); \
|
||||
// if constexpr (t_storage::use_descriptions::value) \
|
||||
// { \
|
||||
// epee::serialization::selector<is_store>::template serialize_and_doc<KV_MAKE_ALIAS_NAME()>(stg, hparent_section, val_name
|
||||
|
||||
|
||||
#define DOC_DSCR(description) if constexpr (t_storage::use_descriptions::value) \
|
||||
{ \
|
||||
epee::serialization::selector<is_store>::template serialize_and_doc<KV_MAKE_ALIAS_NAME()>(stg, hparent_section, KV_MAKE_VAR_NAME(), description
|
||||
|
||||
|
||||
/*
|
||||
{using var_type = decltype(this_ref.varialble); \
|
||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); \
|
||||
if constexpr (t_storage::use_descriptions::value) \
|
||||
{ \
|
||||
epee::serialization::selector<is_store>::set_descr<var_type>(stg, hparent_section, val_name, description, default = var_type()); \
|
||||
} \
|
||||
}
|
||||
*/
|
||||
|
||||
//#define DOC_DSCR(description) , description
|
||||
#define DOC_EXMP(substitute) , substitute
|
||||
//#define DOC_EXMP_AUTO_1(arg_1) , KV_MAKE_ALIAS_NAME() (arg_1)
|
||||
//#define DOC_EXMP_AUTO_2(arg_1, arg_2) , KV_MAKE_ALIAS_NAME() (arg_1, arg_2)
|
||||
#define DOC_END ); }
|
||||
#define DOC_EXMP_AUTO(...) , epee::create_t_object<KV_MAKE_ALIAS_NAME() >(__VA_ARGS__)
|
||||
#define DOC_EXMP_AGGR(...) , epee::create_t_object<KV_MAKE_ALIAS_NAME() >(KV_MAKE_ALIAS_NAME(){__VA_ARGS__})
|
||||
|
||||
|
||||
// Function template to create an object with forwarded constructor arguments
|
||||
template<typename T, typename... Args>
|
||||
T create_t_object(Args&&... args) {
|
||||
return T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
//substitute, description);
|
||||
//#define DOC_EXAMPLE(substitute) substitute,
|
||||
//#define DOC_EX(substitute__) var_type(substitute__),
|
||||
|
||||
//#define DOC_COMMAND(command_general_description) static const char* explain_yourseflf = command_general_description;
|
||||
|
||||
|
||||
#define KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, val_name) \
|
||||
using KV_MAKE_ALIAS_NAME() [[maybe_unused]] = stored_type; \
|
||||
[[maybe_unused]] const char* VARNAME(val_tmp_name) = val_name;\
|
||||
epee::serialization::selector<is_store>::template serialize_custom<stored_type>(this_ref.varialble, stg, hparent_section, val_name, from_v_to_stored, from_stored_to_v);
|
||||
|
||||
#define KV_SERIALIZE_EPHEMERAL_N(stored_type, from_v_to_stored, val_name) \
|
||||
using KV_MAKE_ALIAS_NAME() [[maybe_unused]] = stored_type; \
|
||||
[[maybe_unused]] const char* VARNAME(val_tmp_name) = val_name;\
|
||||
epee::serialization::selector<is_store>::template serialize_ephemeral<stored_type>(this_ref, stg, hparent_section, val_name, from_v_to_stored);
|
||||
|
||||
|
||||
|
|
@ -140,8 +81,6 @@ public: \
|
|||
#define KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, val_name) \
|
||||
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_binbuf_to_hexstr, epee::transform_hexstr_to_binbuff, val_name)
|
||||
|
||||
#define KV_SERIALIZE_BLOB_AS_BASE64_STRING_N(varialble, val_name) \
|
||||
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transfrom_binbuf_to_base64, epee::transform_base64_to_binbuf, val_name)
|
||||
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \
|
||||
epee::serialization::selector<is_store>::serialize_t_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
|
||||
|
|
@ -150,30 +89,19 @@ public: \
|
|||
static_assert(std::is_pod<decltype(this_ref.varialble)>::value, "t_type must be a POD type."); \
|
||||
KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name)
|
||||
|
||||
#define KV_SERIALIZE_CONTAINER_POD_AS_HEX_N(varialble, val_name) \
|
||||
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_t_pod_array_to_hex_str_array<decltype(varialble)>, epee::transform_hex_str_array_to_t_pod_array<decltype(varialble)>, val_name)
|
||||
|
||||
|
||||
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, val_name) \
|
||||
epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
|
||||
|
||||
#define END_KV_SERIALIZE_MAP() return true;}
|
||||
|
||||
#define KV_SERIALIZE(varialble) KV_SERIALIZE_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_DOC(varialble) KV_SERIALIZE_N_DOC( varialble, #varialble)
|
||||
|
||||
#define DOC_COMMAND(desciption_text) inline static const char* description = desciption_text;
|
||||
|
||||
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
|
||||
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_CONTAINER_POD_AS_HEX(varialble) KV_SERIALIZE_CONTAINER_POD_AS_HEX_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE(varialble) KV_SERIALIZE_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
|
||||
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_CUSTOM(varialble, stored_type, from_v_to_stored, from_stored_to_v) KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, #varialble)
|
||||
#define KV_SERIALIZE_POD_AS_HEX_STRING(varialble) KV_SERIALIZE_POD_AS_HEX_STRING_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_BLOB_AS_HEX_STRING(varialble) KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_BLOB_AS_BASE64_STRING(variable) KV_SERIALIZE_BLOB_AS_BASE64_STRING_N(variable, #variable)
|
||||
|
||||
#define KV_SERIALIZE_POD_AS_HEX_STRING(varialble) KV_SERIALIZE_POD_AS_HEX_STRING_N(varialble, #varialble)
|
||||
#define KV_SERIALIZE_BLOB_AS_HEX_STRING(varialble) KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, #varialble)
|
||||
|
||||
|
||||
|
||||
#define KV_CHAIN_MAP(variable_obj) epee::namespace_accessor<decltype(this_ref.variable_obj)>::template serialize_map<is_store>(this_ref.variable_obj, stg, hparent_section);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
// Copyright (c) 2024, Zano Project
|
||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
|
|
@ -117,7 +116,7 @@ namespace epee
|
|||
static bool unserialize_stl_container_t_val(stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
container.clear();
|
||||
typename stl_container::value_type exchange_val{};
|
||||
typename stl_container::value_type exchange_val;
|
||||
typename t_storage::harray hval_array = stg.get_first_value(pname, exchange_val, hparent_section);
|
||||
if(!hval_array) return false;
|
||||
container.push_back(std::move(exchange_val));
|
||||
|
|
@ -316,28 +315,9 @@ namespace epee
|
|||
struct selector<true>
|
||||
{
|
||||
template<class t_type, class t_storage>
|
||||
static bool serialize(const t_type& d, t_storage& stg, [[maybe_unused]] typename t_storage::hsection hparent_section, [[maybe_unused]] const char* pname)
|
||||
static bool serialize(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
//if constexpr (!t_storage::use_descriptions::value)
|
||||
//{
|
||||
return kv_serialize(d, stg, hparent_section, pname);
|
||||
//}
|
||||
//else
|
||||
// return false;
|
||||
|
||||
}
|
||||
//const t_type& doc_substitute = t_type(), const std::string& description = std::string()
|
||||
template<class t_type, class t_storage>
|
||||
static bool serialize_and_doc(t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, const std::string& description = std::string(), const t_type& doc_substitute = t_type())
|
||||
{
|
||||
if constexpr (t_storage::use_descriptions::value)
|
||||
{
|
||||
stg.set_entry_description(hparent_section, pname, description);
|
||||
return kv_serialize(doc_substitute, stg, hparent_section, pname);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
return kv_serialize(d, stg, hparent_section, pname);
|
||||
}
|
||||
|
||||
template<class t_type, class t_storage>
|
||||
|
|
@ -360,12 +340,8 @@ namespace epee
|
|||
template< class t_type_stored, class t_type, class t_storage, typename cb_serialize>
|
||||
static bool serialize_ephemeral(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, cb_serialize cb_s)
|
||||
{
|
||||
t_type_stored a = AUTO_VAL_INIT(a);
|
||||
bool add_val = cb_s(d, a);
|
||||
if (add_val)
|
||||
return epee::serialization::selector<true>::serialize(a, stg, hparent_section, pname);
|
||||
else
|
||||
return true;
|
||||
t_type_stored a = cb_s(d);
|
||||
return epee::serialization::selector<true>::serialize(a, stg, hparent_section, pname);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -478,29 +454,6 @@ namespace epee
|
|||
return r;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//std::optional
|
||||
template<class t_type, class t_storage>
|
||||
bool kv_serialize(const std::optional<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
if(d.has_value())
|
||||
{
|
||||
return kv_serialize(*d, stg, hparent_section, pname);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
template<class t_type, class t_storage>
|
||||
bool kv_unserialize(std::optional<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
d = t_type{};
|
||||
bool r = kv_unserialize(*d, stg, hparent_section, pname);
|
||||
if (!r)
|
||||
{
|
||||
d = std::nullopt;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//boost::shared_ptr
|
||||
template<class t_type, class t_storage>
|
||||
bool kv_serialize(const boost::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
|
|
@ -524,30 +477,7 @@ namespace epee
|
|||
}
|
||||
return r;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
//std::shared_ptr
|
||||
template<class t_type, class t_storage>
|
||||
bool kv_serialize(const std::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
if (d.get())
|
||||
{
|
||||
return kv_serialize(*d, stg, hparent_section, pname);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
template<class t_type, class t_storage>
|
||||
bool kv_unserialize(std::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||
{
|
||||
d.reset();
|
||||
t_type* ptr = new t_type();
|
||||
bool r = kv_unserialize(*ptr, stg, hparent_section, pname);
|
||||
if (!r)
|
||||
{
|
||||
d.reset(ptr);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -23,8 +23,10 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
|
||||
namespace epee
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,20 +44,15 @@ namespace epee
|
|||
/************************************************************************/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
template<typename t_section>
|
||||
class portable_storage_base
|
||||
class portable_storage
|
||||
{
|
||||
public:
|
||||
//typedef epee::serialization::hsection hsection;
|
||||
using use_descriptions = std::false_type;
|
||||
typedef t_section* hsection;
|
||||
typedef epee::serialization::hsection hsection;
|
||||
typedef epee::serialization::harray harray;
|
||||
typedef storage_entry meta_entry;
|
||||
|
||||
portable_storage_base
|
||||
(){}
|
||||
virtual ~portable_storage_base
|
||||
(){}
|
||||
portable_storage(){}
|
||||
virtual ~portable_storage(){}
|
||||
hsection open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist = false);
|
||||
template<class t_value>
|
||||
bool get_value(const std::string& value_name, t_value& val, hsection hparent_section);
|
||||
|
|
@ -68,18 +63,18 @@ namespace epee
|
|||
//serial access for arrays of values --------------------------------------
|
||||
//values
|
||||
template<class t_value>
|
||||
harray get_first_value(const std::string& value_name, t_value& target, hsection hparent_section);
|
||||
harray get_first_value(const std::string& value_name, t_value& target, hsection hparent_section);
|
||||
template<class t_value>
|
||||
bool get_next_value(harray hval_array, t_value& target);
|
||||
template<class t_value>
|
||||
harray insert_first_value(const std::string& value_name, const t_value& target, hsection hparent_section);
|
||||
harray insert_first_value(const std::string& value_name, const t_value& target, hsection hparent_section);
|
||||
template<class t_value>
|
||||
bool insert_next_value(harray hval_array, const t_value& target);
|
||||
//sections
|
||||
harray get_first_section(const std::string& pSectionName, hsection& h_child_section, hsection hparent_section);
|
||||
bool get_next_section(harray hSecArray, hsection& h_child_section);
|
||||
harray insert_first_section(const std::string& pSectionName, hsection& hinserted_childsection, hsection hparent_section);
|
||||
bool insert_next_section(harray hSecArray, hsection& hinserted_childsection);
|
||||
harray get_first_section(const std::string& pSectionName, hsection& h_child_section, hsection hparent_section);
|
||||
bool get_next_section(harray hSecArray, hsection& h_child_section);
|
||||
harray insert_first_section(const std::string& pSectionName, hsection& hinserted_childsection, hsection hparent_section);
|
||||
bool insert_next_section(harray hSecArray, hsection& hinserted_childsection);
|
||||
//------------------------------------------------------------------------
|
||||
//delete entry (section, value or array)
|
||||
bool delete_entry(const std::string& pentry_name, hsection hparent_section = nullptr);
|
||||
|
|
@ -88,13 +83,12 @@ namespace epee
|
|||
bool load_from_binary(const binarybuffer& target);
|
||||
template<class trace_policy>
|
||||
bool dump_as_xml(std::string& targetObj, const std::string& root_name = "");
|
||||
bool dump_as_json(std::string& targetObj, size_t indent = 0/*, end_of_line_t eol = eol_crlf*/);
|
||||
bool dump_as_json(std::string& targetObj, size_t indent = 0, end_of_line_t eol = eol_crlf);
|
||||
bool load_from_json(const std::string& source);
|
||||
void set_entry_description(hsection hparent_section, const std::string& name, const std::string& description) {}
|
||||
|
||||
template<typename cb_t>
|
||||
bool enum_entries(hsection hparent_section, cb_t cb);
|
||||
protected:
|
||||
private:
|
||||
section m_root;
|
||||
hsection get_root_section() {return &m_root;}
|
||||
storage_entry* find_storage_entry(const std::string& pentry_name, hsection psection);
|
||||
|
|
@ -113,36 +107,32 @@ namespace epee
|
|||
};
|
||||
#pragma pack(pop)
|
||||
};
|
||||
|
||||
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::dump_as_json(std::string& buff, size_t indent /* = 0 *//*, end_of_line_t eol *//* = eol_crlf */)
|
||||
inline
|
||||
bool portable_storage::dump_as_json(std::string& buff, size_t indent /* = 0 */, end_of_line_t eol /* = eol_crlf */)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
std::stringstream ss;
|
||||
epee::serialization::recursive_visitor<strategy_json>::dump_as_(ss, m_root, indent/*, eol*/);
|
||||
epee::serialization::dump_as_json(ss, m_root, indent, eol);
|
||||
buff = ss.str();
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::dump_as_json", false)
|
||||
CATCH_ENTRY("portable_storage::dump_as_json", false)
|
||||
}
|
||||
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::load_from_json(const std::string& source)
|
||||
inline
|
||||
bool portable_storage::load_from_json(const std::string& source)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
return json::load_from_json(source, *this);
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::load_from_json", false)
|
||||
CATCH_ENTRY("portable_storage::load_from_json", false)
|
||||
}
|
||||
|
||||
template<typename t_section>
|
||||
template<class trace_policy>
|
||||
bool portable_storage_base<t_section>::dump_as_xml(std::string& targetObj, const std::string& root_name)
|
||||
bool portable_storage::dump_as_xml(std::string& targetObj, const std::string& root_name)
|
||||
{
|
||||
return false;//TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
||||
}
|
||||
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::store_to_binary(binarybuffer& target)
|
||||
inline
|
||||
bool portable_storage::store_to_binary(binarybuffer& target)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
std::stringstream ss;
|
||||
|
|
@ -154,10 +144,10 @@ namespace epee
|
|||
pack_entry_to_buff(ss, m_root);
|
||||
target = ss.str();
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::store_to_binary", false)
|
||||
CATCH_ENTRY("portable_storage::store_to_binary", false)
|
||||
}
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::load_from_binary(const binarybuffer& source)
|
||||
inline
|
||||
bool portable_storage::load_from_binary(const binarybuffer& source)
|
||||
{
|
||||
m_root.m_entries.clear();
|
||||
if(source.size() < sizeof(storage_block_header))
|
||||
|
|
@ -182,11 +172,11 @@ namespace epee
|
|||
throwable_buffer_reader buf_reader(source.data()+sizeof(storage_block_header), source.size()-sizeof(storage_block_header));
|
||||
buf_reader.read(m_root);
|
||||
return true;//TODO:
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::load_from_binary", false);
|
||||
CATCH_ENTRY("portable_storage::load_from_binary", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
typename portable_storage_base<t_section>::hsection portable_storage_base<t_section>::open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist)
|
||||
inline
|
||||
hsection portable_storage::open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
hparent_section = hparent_section ? hparent_section:&m_root;
|
||||
|
|
@ -207,7 +197,7 @@ namespace epee
|
|||
return nullptr;
|
||||
}
|
||||
return &boost::get<section>(*pentry);
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::open_section", nullptr);
|
||||
CATCH_ENTRY("portable_storage::open_section", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<class to_type>
|
||||
|
|
@ -219,9 +209,8 @@ namespace epee
|
|||
void operator()(const from_type& v){convert_t(v, m_target);}
|
||||
};
|
||||
|
||||
template<typename t_section>
|
||||
template<class t_value>
|
||||
bool portable_storage_base<t_section>::get_value(const std::string& value_name, t_value& val, hsection hparent_section)
|
||||
bool portable_storage::get_value(const std::string& value_name, t_value& val, hsection hparent_section)
|
||||
{
|
||||
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
||||
//TRY_ENTRY();
|
||||
|
|
@ -233,11 +222,11 @@ namespace epee
|
|||
get_value_visitor<t_value> gvv(val);
|
||||
boost::apply_visitor(gvv, *pentry);
|
||||
return true;
|
||||
//CATCH_ENTRY("portable_storage_base<t_section>::template<>get_value", false);
|
||||
//CATCH_ENTRY("portable_storage::template<>get_value", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::get_value(const std::string& value_name, storage_entry& val, hsection hparent_section)
|
||||
inline
|
||||
bool portable_storage::get_value(const std::string& value_name, storage_entry& val, hsection hparent_section)
|
||||
{
|
||||
//TRY_ENTRY();
|
||||
if(!hparent_section) hparent_section = &m_root;
|
||||
|
|
@ -247,12 +236,11 @@ namespace epee
|
|||
|
||||
val = *pentry;
|
||||
return true;
|
||||
//CATCH_ENTRY("portable_storage_base<t_section>::template<>get_value", false);
|
||||
//CATCH_ENTRY("portable_storage::template<>get_value", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
template<class t_value>
|
||||
bool portable_storage_base<t_section>::set_value(const std::string& value_name, const t_value& v, hsection hparent_section)
|
||||
bool portable_storage::set_value(const std::string& value_name, const t_value& v, hsection hparent_section)
|
||||
{
|
||||
BOOST_MPL_ASSERT(( boost::mpl::contains<boost::mpl::push_front<storage_entry::types, storage_entry>::type, t_value> ));
|
||||
TRY_ENTRY();
|
||||
|
|
@ -268,11 +256,11 @@ namespace epee
|
|||
}
|
||||
*pentry = storage_entry(v);
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::template<>set_value", false);
|
||||
CATCH_ENTRY("portable_storage::template<>set_value", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
storage_entry* portable_storage_base<t_section>::find_storage_entry(const std::string& pentry_name, hsection psection)
|
||||
inline
|
||||
storage_entry* portable_storage::find_storage_entry(const std::string& pentry_name, hsection psection)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
CHECK_AND_ASSERT(psection, nullptr);
|
||||
|
|
@ -281,28 +269,27 @@ namespace epee
|
|||
return nullptr;
|
||||
|
||||
return &it->second;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::find_storage_entry", nullptr);
|
||||
CATCH_ENTRY("portable_storage::find_storage_entry", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
template<class entry_type>
|
||||
storage_entry* portable_storage_base<t_section>::insert_new_entry_get_storage_entry(const std::string& pentry_name, hsection psection, const entry_type& entry)
|
||||
storage_entry* portable_storage::insert_new_entry_get_storage_entry(const std::string& pentry_name, hsection psection, const entry_type& entry)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
CHECK_AND_ASSERT(psection, nullptr);
|
||||
auto ins_res = psection->m_entries.insert(std::pair<std::string, storage_entry>(pentry_name, entry));
|
||||
return &ins_res.first->second;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::insert_new_entry_get_storage_entry", nullptr);
|
||||
CATCH_ENTRY("portable_storage::insert_new_entry_get_storage_entry", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
typename portable_storage_base<t_section>::hsection portable_storage_base<t_section>::insert_new_section(const std::string& pentry_name, hsection psection)
|
||||
inline
|
||||
hsection portable_storage::insert_new_section(const std::string& pentry_name, hsection psection)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
storage_entry* pse = insert_new_entry_get_storage_entry(pentry_name, psection, section());
|
||||
if(!pse) return nullptr;
|
||||
return &boost::get<section>(*pse);
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::insert_new_section", nullptr);
|
||||
CATCH_ENTRY("portable_storage::insert_new_section", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<class to_type>
|
||||
|
|
@ -321,9 +308,8 @@ namespace epee
|
|||
}
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
template<class t_value>
|
||||
harray portable_storage_base<t_section>::get_first_value(const std::string& value_name, t_value& target, hsection hparent_section)
|
||||
harray portable_storage::get_first_value(const std::string& value_name, t_value& target, hsection hparent_section)
|
||||
{
|
||||
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
||||
//TRY_ENTRY();
|
||||
|
|
@ -339,7 +325,7 @@ namespace epee
|
|||
if(!boost::apply_visitor(gfv, ar_entry))
|
||||
return nullptr;
|
||||
return &ar_entry;
|
||||
//CATCH_ENTRY("portable_storage_base<t_section>::get_first_value", nullptr);
|
||||
//CATCH_ENTRY("portable_storage::get_first_value", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<class to_type>
|
||||
|
|
@ -358,10 +344,10 @@ namespace epee
|
|||
return true;
|
||||
}
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
|
||||
|
||||
template<class t_value>
|
||||
bool portable_storage_base<t_section>::get_next_value(harray hval_array, t_value& target)
|
||||
bool portable_storage::get_next_value(harray hval_array, t_value& target)
|
||||
{
|
||||
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
||||
//TRY_ENTRY();
|
||||
|
|
@ -371,12 +357,11 @@ namespace epee
|
|||
if(!boost::apply_visitor(gnv, ar_entry))
|
||||
return false;
|
||||
return true;
|
||||
//CATCH_ENTRY("portable_storage_base<t_section>::get_next_value", false);
|
||||
//CATCH_ENTRY("portable_storage::get_next_value", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
template<class t_value>
|
||||
harray portable_storage_base<t_section>::insert_first_value(const std::string& value_name, const t_value& target, hsection hparent_section)
|
||||
harray portable_storage::insert_first_value(const std::string& value_name, const t_value& target, hsection hparent_section)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
if(!hparent_section) hparent_section = &m_root;
|
||||
|
|
@ -397,12 +382,11 @@ namespace epee
|
|||
array_entry_t<t_value>& arr_typed = boost::get<array_entry_t<t_value> >(arr);
|
||||
arr_typed.insert_first_val(target);
|
||||
return &arr;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::insert_first_value", nullptr);
|
||||
CATCH_ENTRY("portable_storage::insert_first_value", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
template<typename cb_t>
|
||||
bool portable_storage_base<t_section>::enum_entries(hsection hparent_section, cb_t cb)
|
||||
bool portable_storage::enum_entries(hsection hparent_section, cb_t cb)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
if (!hparent_section) hparent_section = &m_root;
|
||||
|
|
@ -412,12 +396,11 @@ namespace epee
|
|||
break;
|
||||
}
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::enum_entries", false);
|
||||
CATCH_ENTRY("portable_storage::enum_entries", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
|
||||
template<class t_value>
|
||||
bool portable_storage_base<t_section>::insert_next_value(harray hval_array, const t_value& target)
|
||||
bool portable_storage::insert_next_value(harray hval_array, const t_value& target)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
CHECK_AND_ASSERT(hval_array, false);
|
||||
|
|
@ -428,12 +411,12 @@ namespace epee
|
|||
array_entry_t<t_value>& arr_typed = boost::get<array_entry_t<t_value> >(*hval_array);
|
||||
arr_typed.insert_next_value(target);
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::insert_next_value", false);
|
||||
CATCH_ENTRY("portable_storage::insert_next_value", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
//sections
|
||||
template<typename t_section>
|
||||
harray portable_storage_base<t_section>::get_first_section(const std::string& sec_name, hsection& h_child_section, hsection hparent_section)
|
||||
inline
|
||||
harray portable_storage::get_first_section(const std::string& sec_name, hsection& h_child_section, hsection hparent_section)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
if(!hparent_section) hparent_section = &m_root;
|
||||
|
|
@ -451,11 +434,11 @@ namespace epee
|
|||
return nullptr;
|
||||
h_child_section = psec;
|
||||
return &ar_entry;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::get_first_section", nullptr);
|
||||
CATCH_ENTRY("portable_storage::get_first_section", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::get_next_section(harray hsec_array, hsection& h_child_section)
|
||||
inline
|
||||
bool portable_storage::get_next_section(harray hsec_array, hsection& h_child_section)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
CHECK_AND_ASSERT(hsec_array, false);
|
||||
|
|
@ -466,11 +449,11 @@ namespace epee
|
|||
if(!h_child_section)
|
||||
return false;
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::get_next_section", false);
|
||||
CATCH_ENTRY("portable_storage::get_next_section", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
harray portable_storage_base<t_section>::insert_first_section(const std::string& sec_name, hsection& hinserted_childsection, hsection hparent_section)
|
||||
inline
|
||||
harray portable_storage::insert_first_section(const std::string& sec_name, hsection& hinserted_childsection, hsection hparent_section)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
if(!hparent_section) hparent_section = &m_root;
|
||||
|
|
@ -491,11 +474,11 @@ namespace epee
|
|||
array_entry_t<section>& sec_array = boost::get<array_entry_t<section>>(ar_entry);
|
||||
hinserted_childsection = &sec_array.insert_first_val(section());
|
||||
return &ar_entry;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::insert_first_section", nullptr);
|
||||
CATCH_ENTRY("portable_storage::insert_first_section", nullptr);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
template<typename t_section>
|
||||
bool portable_storage_base<t_section>::insert_next_section(harray hsec_array, hsection& hinserted_childsection)
|
||||
inline
|
||||
bool portable_storage::insert_next_section(harray hsec_array, hsection& hinserted_childsection)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
CHECK_AND_ASSERT(hsec_array, false);
|
||||
|
|
@ -505,9 +488,8 @@ namespace epee
|
|||
array_entry_t<section>& sec_array = boost::get<array_entry_t<section>>(*hsec_array);
|
||||
hinserted_childsection = &sec_array.insert_next_value(section());
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::insert_next_section", false);
|
||||
CATCH_ENTRY("portable_storage::insert_next_section", false);
|
||||
}
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
typedef portable_storage_base<section> portable_storage;
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ namespace epee
|
|||
/************************************************************************/
|
||||
struct section
|
||||
{
|
||||
std::map<std::string, std::string> m_descriptions;
|
||||
std::map<std::string, storage_entry> m_entries;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||
// names of its contributors may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "portable_storage.h"
|
||||
#include "portable_storage_to_description.h"
|
||||
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
class portable_storage_extended_doc: public portable_storage
|
||||
{
|
||||
public:
|
||||
using use_descriptions = std::true_type;
|
||||
|
||||
void set_entry_description(hsection hparent_section, const std::string& name, const std::string& description)
|
||||
{
|
||||
if (!hparent_section)
|
||||
hparent_section = &m_root;
|
||||
hparent_section->m_descriptions[name] = description;
|
||||
}
|
||||
|
||||
bool dump_as_decriptions(std::string& buff, size_t indent = 0 , end_of_line_t eol = eol_crlf)
|
||||
{
|
||||
TRY_ENTRY();
|
||||
std::stringstream ss;
|
||||
recursive_visitor<strategy_descriptin>::dump_as_(ss, m_root, indent);
|
||||
buff = ss.str();
|
||||
return true;
|
||||
CATCH_ENTRY("portable_storage_base<t_section>::dump_as_json", false)
|
||||
}
|
||||
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,6 @@ namespace epee
|
|||
storage_entry load_storage_entry();
|
||||
void read(section& sec);
|
||||
void read(std::string& str);
|
||||
void read(array_entry &ae);
|
||||
private:
|
||||
struct recursuion_limitation_guard
|
||||
{
|
||||
|
|
@ -115,7 +114,6 @@ namespace epee
|
|||
void throwable_buffer_reader::read(t_pod_type& pod_val)
|
||||
{
|
||||
RECURSION_LIMITATION();
|
||||
static_assert(std::is_pod<t_pod_type>::value, "POD type expected");
|
||||
read(&pod_val, sizeof(pod_val));
|
||||
}
|
||||
|
||||
|
|
@ -279,11 +277,5 @@ namespace epee
|
|||
m_ptr+=len;
|
||||
m_count -= len;
|
||||
}
|
||||
inline
|
||||
void throwable_buffer_reader::read(array_entry &ae)
|
||||
{
|
||||
RECURSION_LIMITATION();
|
||||
CHECK_AND_ASSERT_THROW_MES(false, "Reading array entry is not supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -28,38 +28,22 @@
|
|||
#include "parserse_base_utils.h"
|
||||
#include "file_io_utils.h"
|
||||
|
||||
#define EPEE_JSON_RECURSION_LIMIT_INTERNAL 100
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
namespace json
|
||||
{
|
||||
|
||||
namespace details
|
||||
{
|
||||
inline bool report_wrong_char_with_context(const std::string::const_iterator begin, const std::string::const_iterator it, const std::string::const_iterator end)
|
||||
{
|
||||
auto before_it = it - std::min(it - begin, static_cast<ptrdiff_t>(8));
|
||||
auto after_it = it + std::min(end - it, static_cast<ptrdiff_t>(8));
|
||||
std::string escaped_str(before_it, after_it);
|
||||
std::replace_if(escaped_str.begin(), escaped_str.end(), [](int c){ return std::isprint(c); }, '?');
|
||||
ASSERT_MES_AND_THROW("Wrong JSON character 0x" << std::hex << (int)*it << ", context: " << escaped_str);
|
||||
}
|
||||
}
|
||||
|
||||
#define CHECK_ISSPACE() if (!isspace(*it)) details::report_wrong_char_with_context(sec_buf_begin, it, buf_end)
|
||||
#define CHECK_ISSPACE() if(!isspace(*it)){ ASSERT_MES_AND_THROW("Wrong JSON character at: " << std::string(it, buf_end));}
|
||||
|
||||
/*inline void parse_error()
|
||||
{
|
||||
ASSERT_MES_AND_THROW("json parse error");
|
||||
}*/
|
||||
template<class t_storage>
|
||||
inline void run_handler(typename t_storage::hsection current_section, std::string::const_iterator& sec_buf_begin, std::string::const_iterator buf_end, t_storage& stg, unsigned int recursion)
|
||||
inline void run_handler(typename t_storage::hsection current_section, std::string::const_iterator& sec_buf_begin, std::string::const_iterator buf_end, t_storage& stg)
|
||||
{
|
||||
CHECK_AND_ASSERT_THROW_MES(recursion < EPEE_JSON_RECURSION_LIMIT_INTERNAL,
|
||||
"Wrong JSON data: recursion limitation (" << EPEE_JSON_RECURSION_LIMIT_INTERNAL << ") exceeded");
|
||||
|
||||
std::string::const_iterator sub_element_start;
|
||||
std::string name;
|
||||
typename t_storage::harray h_array = nullptr;
|
||||
|
|
@ -170,7 +154,7 @@ namespace epee
|
|||
//sub section here
|
||||
typename t_storage::hsection new_sec = stg.open_section(name, current_section, true);
|
||||
CHECK_AND_ASSERT_THROW_MES(new_sec, "Failed to insert new section in json: " << std::string(it, buf_end));
|
||||
run_handler(new_sec, it, buf_end, stg, recursion + 1);
|
||||
run_handler(new_sec, it, buf_end, stg);
|
||||
state = match_state_wonder_after_value;
|
||||
}else if(*it == '[')
|
||||
{//array of something
|
||||
|
|
@ -199,7 +183,7 @@ namespace epee
|
|||
typename t_storage::hsection new_sec = nullptr;
|
||||
h_array = stg.insert_first_section(name, new_sec, current_section);
|
||||
CHECK_AND_ASSERT_THROW_MES(h_array&&new_sec, "failed to create new section");
|
||||
run_handler(new_sec, it, buf_end, stg, recursion + 1);
|
||||
run_handler(new_sec, it, buf_end, stg);
|
||||
state = match_state_array_after_value;
|
||||
array_md = array_mode_sections;
|
||||
}else if(*it == '"')
|
||||
|
|
@ -273,7 +257,7 @@ namespace epee
|
|||
typename t_storage::hsection new_sec = NULL;
|
||||
bool res = stg.insert_next_section(h_array, new_sec);
|
||||
CHECK_AND_ASSERT_THROW_MES(res&&new_sec, "failed to insert next section");
|
||||
run_handler(new_sec, it, buf_end, stg, recursion + 1);
|
||||
run_handler(new_sec, it, buf_end, stg);
|
||||
state = match_state_array_after_value;
|
||||
}else CHECK_ISSPACE();
|
||||
break;
|
||||
|
|
@ -375,7 +359,7 @@ namespace epee
|
|||
std::string::const_iterator sec_buf_begin = buff_json.begin();
|
||||
try
|
||||
{
|
||||
run_handler(nullptr, sec_buf_begin, buff_json.end(), stg, 0);
|
||||
run_handler(nullptr, sec_buf_begin, buff_json.end(), stg);
|
||||
return true;
|
||||
}
|
||||
catch(const std::exception& ex)
|
||||
|
|
|
|||
|
|
@ -56,16 +56,16 @@ namespace epee
|
|||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
template<class t_struct>
|
||||
bool store_t_to_json(const t_struct& str_in, std::string& json_buff, size_t indent = 0)
|
||||
bool store_t_to_json(const t_struct& str_in, std::string& json_buff, size_t indent = 0, end_of_line_t eol = eol_crlf)
|
||||
{
|
||||
portable_storage ps;
|
||||
str_in.store(ps);
|
||||
ps.dump_as_json(json_buff, indent);
|
||||
ps.dump_as_json(json_buff, indent, eol);
|
||||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
template<class t_struct>
|
||||
std::string store_t_to_json(const t_struct& str_in, size_t indent = 0)
|
||||
std::string store_t_to_json(const t_struct& str_in, size_t indent = 0, end_of_line_t eol = eol_crlf)
|
||||
{
|
||||
std::string json_buff;
|
||||
store_t_to_json(str_in, json_buff, indent);
|
||||
|
|
|
|||
|
|
@ -1,149 +0,0 @@
|
|||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||
// names of its contributors may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "misc_language.h"
|
||||
#include "portable_storage_base.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
template <typename t_strategy_layout_strategy>
|
||||
class recursive_visitor
|
||||
{
|
||||
public:
|
||||
template<class t_stream>
|
||||
struct array_entry_store_to_json_visitor : public boost::static_visitor<void>
|
||||
{
|
||||
t_stream& m_strm;
|
||||
size_t m_indent;
|
||||
|
||||
array_entry_store_to_json_visitor(t_stream& strm, size_t indent)
|
||||
: m_strm(strm)
|
||||
, m_indent(indent)
|
||||
{}
|
||||
|
||||
template<class t_type>
|
||||
void operator()(const array_entry_t<t_type>& a)
|
||||
{
|
||||
|
||||
t_strategy_layout_strategy::handle_array_start(m_strm, m_indent);
|
||||
if (a.m_array.size())
|
||||
{
|
||||
auto last_it = --a.m_array.end();
|
||||
for (auto it = a.m_array.begin(); it != a.m_array.end(); it++)
|
||||
{
|
||||
dump_as_(m_strm, *it, m_indent);
|
||||
if (it != last_it)
|
||||
t_strategy_layout_strategy::handle_array_entry_separator(m_strm, m_indent);
|
||||
}
|
||||
}
|
||||
t_strategy_layout_strategy::handle_array_end(m_strm, m_indent);
|
||||
}
|
||||
};
|
||||
|
||||
template<class t_stream>
|
||||
struct storage_entry_store_to_json_visitor : public boost::static_visitor<void>
|
||||
{
|
||||
t_stream& m_strm;
|
||||
size_t m_indent;
|
||||
|
||||
storage_entry_store_to_json_visitor(t_stream& strm, size_t indent)
|
||||
: m_strm(strm)
|
||||
, m_indent(indent)
|
||||
{}
|
||||
|
||||
//section, array_entry
|
||||
template<class visited_type>
|
||||
void operator()(const visited_type& v)
|
||||
{
|
||||
dump_as_(m_strm, v, m_indent);
|
||||
}
|
||||
};
|
||||
|
||||
template<class t_stream>
|
||||
void static dump_as_(t_stream& strm, const array_entry& ae, size_t indent)
|
||||
{
|
||||
array_entry_store_to_json_visitor<t_stream> aesv(strm, indent);
|
||||
boost::apply_visitor(aesv, ae);
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void static dump_as_(t_stream& strm, const storage_entry& se, size_t indent)
|
||||
{
|
||||
storage_entry_store_to_json_visitor<t_stream> sv(strm, indent);
|
||||
boost::apply_visitor(sv, se);
|
||||
}
|
||||
|
||||
template<class t_stream, class t_type>
|
||||
void static dump_as_(t_stream& strm, const t_type& v, size_t indent)
|
||||
{
|
||||
t_strategy_layout_strategy::handle_value(strm, v, indent);
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void static dump_as_(t_stream& strm, const section& sec, size_t indent)
|
||||
{
|
||||
size_t local_indent = indent + 1;
|
||||
t_strategy_layout_strategy::handle_obj_begin(strm, indent);
|
||||
t_strategy_layout_strategy::handle_line_break(strm, indent);
|
||||
|
||||
if (sec.m_entries.size())
|
||||
{
|
||||
auto it_last = --sec.m_entries.end();
|
||||
for (auto it = sec.m_entries.begin(); it != sec.m_entries.end(); it++)
|
||||
{
|
||||
if constexpr (t_strategy_layout_strategy::use_descriptions::value)
|
||||
{
|
||||
std::string descr;
|
||||
auto it_descr = sec.m_descriptions.find(it->first);
|
||||
if (it_descr != sec.m_descriptions.end())
|
||||
descr = it_descr->second;
|
||||
|
||||
t_strategy_layout_strategy::handle_print_key(strm, it->first, descr, local_indent);
|
||||
}
|
||||
else
|
||||
{
|
||||
t_strategy_layout_strategy::handle_print_key(strm, it->first, local_indent);
|
||||
}
|
||||
|
||||
dump_as_(strm, it->second, local_indent);
|
||||
if (it_last != it)
|
||||
t_strategy_layout_strategy::handle_section_entry_separator(strm, indent);
|
||||
|
||||
t_strategy_layout_strategy::handle_line_break(strm, indent);
|
||||
}
|
||||
}
|
||||
t_strategy_layout_strategy::handle_obj_end(strm, indent);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
// Copyright (c) 2006-2024, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||
// names of its contributors may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
|
||||
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "misc_language.h"
|
||||
#include "portable_storage_base.h"
|
||||
#include "portable_storage_to_.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
class strategy_descriptin
|
||||
{
|
||||
public:
|
||||
using use_descriptions = std::true_type;
|
||||
|
||||
inline static const char* eol = get_endline(eol_crlf);
|
||||
//static const end_of_line_t eol = eol_crlf;
|
||||
|
||||
template<class t_stream, class t_type>
|
||||
static void handle_value(t_stream& strm, const t_type& v, size_t indent)
|
||||
{}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_start(t_stream& strm, size_t indent)
|
||||
{
|
||||
//strm << "[";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_end(t_stream& strm, size_t indent)
|
||||
{
|
||||
//strm << "]";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_obj_begin(t_stream& strm, size_t indent)
|
||||
{}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_obj_end(t_stream& strm, size_t indent)
|
||||
{}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_print_key(t_stream& strm, const std::string& key, const std::string& description, size_t indent)
|
||||
{
|
||||
if (description.size())
|
||||
{
|
||||
const std::string indent_str = make_indent(indent);
|
||||
strm << indent_str << "\"" << key << "\"" << ": " << description << eol;
|
||||
}
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_print_description(t_stream& strm, const std::string& description, size_t indent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_section_entry_separator(t_stream& strm, size_t indent)
|
||||
{
|
||||
//strm << ",";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_entry_separator(t_stream& strm, size_t indent)
|
||||
{
|
||||
//strm << ",";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_line_break(t_stream& strm, size_t indent)
|
||||
{
|
||||
//strm << eol;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -30,121 +30,174 @@
|
|||
|
||||
#include "misc_language.h"
|
||||
#include "portable_storage_base.h"
|
||||
#include "portable_storage_to_.h"
|
||||
|
||||
namespace epee
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
inline const char* get_endline(end_of_line_t eol)
|
||||
{
|
||||
switch (eol)
|
||||
{
|
||||
case eol_lf: return "\n";
|
||||
case eol_cr: return "\r";
|
||||
case eol_space: return " ";
|
||||
default: return "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const array_entry& ae, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const storage_entry& se, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const std::string& v, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const int8_t& v, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const uint8_t& v, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const bool& v, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const double& v, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream, class t_type>
|
||||
void dump_as_json(t_stream& strm, const t_type& v, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const section& sec, size_t indent, end_of_line_t eol = eol_crlf);
|
||||
|
||||
|
||||
inline std::string make_indent(size_t indent)
|
||||
{
|
||||
return std::string(indent * 2, ' ');
|
||||
return std::string(indent*2, ' ');
|
||||
}
|
||||
|
||||
class strategy_json
|
||||
template<class t_stream>
|
||||
struct array_entry_store_to_json_visitor: public boost::static_visitor<void>
|
||||
{
|
||||
public:
|
||||
using use_descriptions = std::false_type;
|
||||
t_stream& m_strm;
|
||||
size_t m_indent;
|
||||
end_of_line_t m_eol;
|
||||
|
||||
inline static const char* eol = get_endline(eol_crlf);
|
||||
//static const end_of_line_t eol = eol_crlf;
|
||||
template<class t_stream>
|
||||
static void handle_value(t_stream& strm, const std::string& v, size_t indent)
|
||||
{
|
||||
strm << "\"" << misc_utils::parse::transform_to_json_escape_sequence(v) << "\"";
|
||||
}
|
||||
template<class t_stream>
|
||||
static void handle_value(t_stream& strm, const int8_t& v, size_t indent)
|
||||
{
|
||||
strm << static_cast<int32_t>(v);
|
||||
}
|
||||
template<class t_stream>
|
||||
static void handle_value(t_stream& strm, const uint8_t& v, size_t indent)
|
||||
{
|
||||
strm << static_cast<int32_t>(v);
|
||||
}
|
||||
template<class t_stream>
|
||||
static void handle_value(t_stream& strm, const bool& v, size_t indent)
|
||||
{
|
||||
if (v)
|
||||
strm << "true";
|
||||
else
|
||||
strm << "false";
|
||||
}
|
||||
template<class t_stream>
|
||||
static void handle_value(t_stream& strm, const double& v, size_t indent)
|
||||
{
|
||||
boost::io::ios_flags_saver ifs(strm);
|
||||
strm.precision(8);
|
||||
strm << std::fixed << v;
|
||||
}
|
||||
template<class t_stream, class t_type>
|
||||
static void handle_value(t_stream& strm, const t_type& v, size_t indent)
|
||||
{
|
||||
strm << v;
|
||||
}
|
||||
array_entry_store_to_json_visitor(t_stream& strm, size_t indent, end_of_line_t eol)
|
||||
: m_strm(strm)
|
||||
, m_indent(indent)
|
||||
, m_eol(eol)
|
||||
{}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_start(t_stream& strm, size_t indent)
|
||||
template<class t_type>
|
||||
void operator()(const array_entry_t<t_type>& a)
|
||||
{
|
||||
strm << "[";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_end(t_stream& strm, size_t indent)
|
||||
{
|
||||
strm << "]";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_obj_begin(t_stream& strm, size_t indent)
|
||||
{
|
||||
strm << "{";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_obj_end(t_stream& strm, size_t indent)
|
||||
{
|
||||
strm << make_indent(indent) << "}";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_print_key(t_stream& strm, const std::string& key, size_t indent)
|
||||
{
|
||||
const std::string indent_str = make_indent(indent);
|
||||
strm << indent_str << "\"" << misc_utils::parse::transform_to_json_escape_sequence(key) << "\"" << ": ";
|
||||
}
|
||||
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_section_entry_separator(t_stream& strm, size_t indent)
|
||||
{
|
||||
strm << ",";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_array_entry_separator(t_stream& strm, size_t indent)
|
||||
{
|
||||
strm << ",";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
static void handle_line_break(t_stream& strm, size_t indent)
|
||||
{
|
||||
strm << eol;
|
||||
m_strm << "[";
|
||||
if(a.m_array.size())
|
||||
{
|
||||
auto last_it = --a.m_array.end();
|
||||
for(auto it = a.m_array.begin(); it != a.m_array.end(); it++)
|
||||
{
|
||||
dump_as_json(m_strm, *it, m_indent, m_eol);
|
||||
if(it != last_it)
|
||||
m_strm << ",";
|
||||
}
|
||||
}
|
||||
m_strm << "]";
|
||||
}
|
||||
};
|
||||
|
||||
template<class t_stream>
|
||||
struct storage_entry_store_to_json_visitor: public boost::static_visitor<void>
|
||||
{
|
||||
t_stream& m_strm;
|
||||
size_t m_indent;
|
||||
end_of_line_t m_eol;
|
||||
|
||||
storage_entry_store_to_json_visitor(t_stream& strm, size_t indent, end_of_line_t eol)
|
||||
: m_strm(strm)
|
||||
, m_indent(indent)
|
||||
, m_eol(eol)
|
||||
{}
|
||||
|
||||
//section, array_entry
|
||||
template<class visited_type>
|
||||
void operator()(const visited_type& v)
|
||||
{
|
||||
dump_as_json(m_strm, v, m_indent, m_eol);
|
||||
}
|
||||
};
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const array_entry& ae, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
array_entry_store_to_json_visitor<t_stream> aesv(strm, indent, eol);
|
||||
boost::apply_visitor(aesv, ae);
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const storage_entry& se, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
storage_entry_store_to_json_visitor<t_stream> sv(strm, indent, eol);
|
||||
boost::apply_visitor(sv, se);
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const std::string& v, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
strm << "\"" << misc_utils::parse::transform_to_json_escape_sequence(v) << "\"";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const int8_t& v, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
strm << static_cast<int32_t>(v);
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const uint8_t& v, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
strm << static_cast<int32_t>(v);
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const bool& v, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
if(v)
|
||||
strm << "true";
|
||||
else
|
||||
strm << "false";
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const double& v, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
boost::io::ios_flags_saver ifs(strm);
|
||||
strm.precision(8);
|
||||
strm << std::fixed << v;
|
||||
}
|
||||
|
||||
template<class t_stream, class t_type>
|
||||
void dump_as_json(t_stream& strm, const t_type& v, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
strm << v;
|
||||
}
|
||||
|
||||
template<class t_stream>
|
||||
void dump_as_json(t_stream& strm, const section& sec, size_t indent, end_of_line_t eol)
|
||||
{
|
||||
auto put_eol = [&]() {
|
||||
switch (eol)
|
||||
{
|
||||
case eol_lf: strm << "\n"; break;
|
||||
case eol_cr: strm << "\r"; break;
|
||||
case eol_space: strm << " "; break;
|
||||
default: strm << "\r\n"; break;
|
||||
}
|
||||
};
|
||||
|
||||
size_t local_indent = indent + 1;
|
||||
strm << "{";
|
||||
put_eol();
|
||||
std::string indent_str = make_indent(local_indent);
|
||||
if(sec.m_entries.size())
|
||||
{
|
||||
auto it_last = --sec.m_entries.end();
|
||||
for(auto it = sec.m_entries.begin(); it!= sec.m_entries.end();it++)
|
||||
{
|
||||
strm << indent_str << "\"" << misc_utils::parse::transform_to_json_escape_sequence(it->first) << "\"" << ": ";
|
||||
dump_as_json(strm, it->second, local_indent, eol);
|
||||
if(it_last != it)
|
||||
strm << ",";
|
||||
put_eol();
|
||||
}
|
||||
}
|
||||
strm << make_indent(indent) << "}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,13 +22,12 @@
|
|||
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
//
|
||||
#ifndef _STRING_TOOLS_H_
|
||||
#define _STRING_TOOLS_H_
|
||||
|
||||
#include <locale>
|
||||
#include <cstdlib>
|
||||
#include <iomanip>
|
||||
#include <map>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
|
|
@ -445,7 +444,7 @@ POP_GCC_WARNINGS
|
|||
inline bool string_to_num_fast(const std::string& buff, int& val)
|
||||
{
|
||||
val = atoi(buff.c_str());
|
||||
if (val == 0 && buff.find_first_not_of('0') != std::string::npos)
|
||||
if(buff != "0" && val == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ namespace epee
|
|||
|
||||
#define POTENTIAL_HANG_PREVENT_LIMIT 1000
|
||||
|
||||
#define DEADLOCK_GUARD_JOURNAL_LIMIT 1000
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
|
|
@ -290,11 +290,11 @@ namespace epee
|
|||
struct thread_info
|
||||
{
|
||||
std::map<lock_reference_type, size_t> m_owned_objects;
|
||||
bool is_blocked = false;
|
||||
lock_reference_type blocker_lock = nullptr;
|
||||
const char* block_location = "unknown";
|
||||
const char* func_name = "unknown";
|
||||
const char* lock_name = "unknown";
|
||||
bool is_blocked;
|
||||
lock_reference_type blocker_lock;
|
||||
const char* block_location;
|
||||
const char* func_name;
|
||||
const char* lock_name;
|
||||
std::string thread_name;
|
||||
};
|
||||
|
||||
|
|
@ -307,18 +307,6 @@ namespace epee
|
|||
std::map<lock_reference_type, thread_id_to_info_map::iterator> m_owned_locks_to_thread;
|
||||
// deadlock journal
|
||||
std::list<std::string> m_deadlock_journal;
|
||||
//lock/unlock journal
|
||||
struct journal_entry
|
||||
{
|
||||
std::thread::id tid;
|
||||
lock_reference_type lock = nullptr;
|
||||
bool is_lock_event = false;
|
||||
const char* func_name = "unkonwn";
|
||||
const char* lock_name = "unkonwn";
|
||||
std::string thread_name;
|
||||
};
|
||||
|
||||
std::list<journal_entry> m_journal;
|
||||
|
||||
public:
|
||||
void on_before_lock(lock_reference_type lock, const char* func_name, const char* loction, const char* lock_name, const std::string& thread_name)
|
||||
|
|
@ -375,10 +363,6 @@ namespace epee
|
|||
}
|
||||
else
|
||||
{
|
||||
m_journal.push_front(journal_entry{ this_id, lock, false, "", "", ""});
|
||||
if (m_journal.size() > DEADLOCK_GUARD_JOURNAL_LIMIT)
|
||||
m_journal.pop_back();
|
||||
|
||||
m_owned_locks_to_thread.erase(lock_to_thread_it);
|
||||
}
|
||||
it->second.m_owned_objects.erase(ownership_it);
|
||||
|
|
@ -416,15 +400,6 @@ namespace epee
|
|||
ss << "-----------------------------------------------------------------------" << std::endl << err << std::endl;
|
||||
}
|
||||
|
||||
ss << "Ownership history history:" << std::endl;
|
||||
size_t count = 0;
|
||||
for (auto entry : m_journal)
|
||||
{
|
||||
ss << "tid(" << entry.thread_name << "): " << entry.tid << ", lock_addr: " << entry.lock << (entry.is_lock_event ? "-->":"<--") << ", func: " << (entry.func_name ? entry.func_name:"") << ", lock_name: " << (entry.lock_name ? entry.lock_name : "") << std::endl;
|
||||
if (++count > 100)
|
||||
break;
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
|
@ -454,10 +429,6 @@ namespace epee
|
|||
//need to add lock-to-thread reccord
|
||||
m_owned_locks_to_thread[lock] = it;
|
||||
DO_DEBUG_COUT("[" << std::this_thread::get_id() << "][ADDED_OWNERSHIP]: " << lock << std::endl);
|
||||
m_journal.push_front(journal_entry{ this_id, lock, true, it->second.func_name, it->second.lock_name, it->second.thread_name });
|
||||
if (m_journal.size() > DEADLOCK_GUARD_JOURNAL_LIMIT)
|
||||
m_journal.pop_back();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue