Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Vendored from https://github.com/KDAB/KDSingleApplication — keep upstream formatting.
src/kdsingleapplication/*
147 changes: 147 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Generated from CLion Inspection settings
---
Checks: '-*,
bugprone-argument-comment,
bugprone-assert-side-effect,
bugprone-bad-signal-to-kill-thread,
bugprone-branch-clone,
bugprone-copy-constructor-init,
bugprone-dangling-handle,
bugprone-dynamic-static-initializers,
bugprone-fold-init-type,
bugprone-forward-declaration-namespace,
bugprone-forwarding-reference-overload,
bugprone-inaccurate-erase,
bugprone-incorrect-roundings,
bugprone-integer-division,
bugprone-lambda-function-name,
bugprone-macro-parentheses,
bugprone-macro-repeated-side-effects,
bugprone-misplaced-operator-in-strlen-in-alloc,
bugprone-misplaced-pointer-arithmetic-in-alloc,
bugprone-misplaced-widening-cast,
bugprone-move-forwarding-reference,
bugprone-multiple-statement-macro,
bugprone-no-escape,
bugprone-parent-virtual-call,
bugprone-posix-return,
bugprone-reserved-identifier,
bugprone-sizeof-container,
bugprone-sizeof-expression,
bugprone-spuriously-wake-up-functions,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-string-literal-with-embedded-nul,
bugprone-suspicious-enum-usage,
bugprone-suspicious-include,
bugprone-suspicious-memset-usage,
bugprone-suspicious-missing-comma,
bugprone-suspicious-semicolon,
bugprone-suspicious-string-compare,
bugprone-suspicious-memory-comparison,
bugprone-suspicious-realloc-usage,
bugprone-swapped-arguments,
bugprone-terminating-continue,
bugprone-throw-keyword-missing,
bugprone-too-small-loop-variable,
bugprone-undefined-memory-manipulation,
bugprone-undelegated-constructor,
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-unused-return-value,
bugprone-use-after-move,
bugprone-virtual-near-miss,
cert-dcl21-cpp,
cert-dcl58-cpp,
cert-err34-c,
cert-err52-cpp,
cert-err60-cpp,
cert-flp30-c,
cert-msc50-cpp,
cert-msc51-cpp,
cert-str34-c,
cppcoreguidelines-interfaces-global-init,
cppcoreguidelines-narrowing-conversions,
cppcoreguidelines-pro-type-member-init,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-default-arguments,
google-explicit-constructor,
google-runtime-operator,
hicpp-exception-baseclass,
hicpp-multiway-paths-covered,
misc-misplaced-const,
misc-new-delete-overloads,
misc-no-recursion,
misc-non-copyable-objects,
misc-throw-by-value-catch-by-reference,
misc-unconventional-assign-operator,
misc-uniqueptr-reset-release,
modernize-avoid-bind,
modernize-concat-nested-namespaces,
modernize-deprecated-headers,
modernize-deprecated-ios-base-aliases,
modernize-loop-convert,
modernize-make-shared,
modernize-make-unique,
modernize-pass-by-value,
modernize-raw-string-literal,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-return-braced-init-list,
modernize-shrink-to-fit,
modernize-unary-static-assert,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-nodiscard,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-transparent-functors,
modernize-use-uncaught-exceptions,
mpi-buffer-deref,
mpi-type-mismatch,
openmp-use-default-none,
performance-faster-string-find,
performance-for-range-copy,
performance-implicit-conversion-in-loop,
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
performance-move-const-arg,
performance-move-constructor-init,
performance-no-automatic-move,
performance-noexcept-move-constructor,
performance-trivially-destructible,
performance-type-promotion-in-math-fn,
performance-unnecessary-copy-initialization,
performance-unnecessary-value-param,
portability-simd-intrinsics,
readability-avoid-const-params-in-decls,
readability-const-return-type,
readability-container-size-empty,
readability-convert-member-functions-to-static,
readability-delete-null-pointer,
readability-deleted-default,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misleading-indentation,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-redundant-control-flow,
readability-redundant-declaration,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-redundant-string-init,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
readability-use-anyofallof'
169 changes: 95 additions & 74 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,109 +7,130 @@ on:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
format:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install clang-format
run: python -m pip install --upgrade "clang-format==22.1.8"

- name: Check formatting
run: git ls-files '*.cpp' '*.h' | xargs clang-format --dry-run --Werror

build:
env:
CONAN_HOME: "${{ github.workspace }}/.conan2"

runs-on: ${{ matrix.os }}
# Generous because conanfile.py selects non-default Qt options, so ConanCenter has
# no prebuilt binary and a cold cache means building Qt from source. Warm runs are
# minutes; only the first run after a conan.lock change pays this.
timeout-minutes: 300

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

matrix:
os: [ubuntu-latest, windows-latest]
compiler: [gcc, msvc]
build_type: [Release]
exclude:
- os: windows-latest
compiler: gcc
- os: ubuntu-latest
compiler: msvc
include:
- compiler: gcc
generator: "Unix Makefiles"
- os: ubuntu-latest
build_type: Release
cppstd: gnu20
libcxx: libstdc++
compiler_version: 11
- compiler: msvc
generator: "Visual Studio 17 2022"
generator_conf: -c tools.cmake.cmaketoolchain:generator=Ninja
configure_preset: conan-release
build_preset: conan-release
build_dir: build/Release
- os: windows-latest
build_type: Release
cppstd: 20
compiler_runtime: dynamic
compiler_version: 194
generator_conf: ''
configure_preset: conan-default
build_preset: conan-release
build_dir: build

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update; sudo apt-get install ninja-build

- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
- name: Install Ninja
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ninja-build

- name: Conan version
run: echo "${{ steps.conan.outputs.version }}"
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Cache Conan Dependencies
- name: Install Conan
run: python -m pip install --upgrade "conan>=2,<3"

# Keyed on conan.lock, not conanfile.py: the recipe pins version ranges, so its
# hash says nothing about which dependencies actually get resolved. The lockfile
# pins exact versions and recipe revisions, which makes the key truthful — a hit
# really does mean the cache holds the right packages.
# Refresh it after changing dependencies (run both, second builds on the first):
# conan lock create . -s compiler.cppstd=gnu20 --lockfile-out=conan.lock
# conan lock create . -s os=Windows -s compiler=msvc -s compiler.version=195 \
# -s compiler.runtime=dynamic -s compiler.cppstd=20 -s arch=x86_64 \
# --lockfile=conan.lock --lockfile-out=conan.lock
- name: Restore Conan cache
id: cache-conan
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
path: ${{ env.CONAN_HOME }}
key: conan-cache-${{ runner.os }}-${{ hashFiles('conanfile.py') }}
restore-keys: conan-cache-${{ runner.os }}-
key: conan-${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.cppstd }}-${{ hashFiles('conan.lock') }}
restore-keys: |
conan-${{ runner.os }}-${{ matrix.build_type }}-${{ matrix.cppstd }}-

- uses: DamianReeves/write-file-action@master
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
path: ${{ env.CONAN_HOME }}/profiles/default
contents: |
[settings]
arch=x86_64
build_type=${{ matrix.build_type }}
compiler=${{ matrix.compiler }}
compiler.cppstd=${{ matrix.cppstd }}
compiler.version=${{ matrix.compiler_version }}
os=${{ runner.os }}
compiler.libcxx=${{ matrix.libcxx }}

[conf]
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
write-mode: append

- uses: DamianReeves/write-file-action@master
if: ${{ matrix.os == 'windows-latest' }}
with:
path: ${{ env.CONAN_HOME }}/profiles/default
contents: |
[settings]
arch=x86_64
build_type=${{ matrix.build_type }}
compiler=${{ matrix.compiler }}
compiler.cppstd=${{ matrix.cppstd }}
compiler.version=${{ matrix.compiler_version }}
os=${{ runner.os }}
compiler.runtime=${{ matrix.compiler_runtime }}
write-mode: append


- name: PrintProfile
run: cat ${{ env.CONAN_HOME }}/profiles/default

- name: list packages
if: ${{ matrix.os == 'ubuntu-latest' }}
run: dpkg --list
- name: Detect Conan profile
run: conan profile detect --force

- name: Install Dependencies
run: conan install . --build=missing --output-folder=build
run: >
conan install .
--build=missing
--lockfile=conan.lock
-s build_type=${{ matrix.build_type }}
-s compiler.cppstd=${{ matrix.cppstd }}
${{ matrix.generator_conf }}
-c tools.system.package_manager:mode=install
-c tools.system.package_manager:sudo=True

- name: Configure
run: cmake --preset ${{ matrix.configure_preset }} -DBUILD_TESTING=ON

- name: Build
run: |
cmake -G "${{ matrix.generator }}" -S . -B build -DCMAKE_TOOLCHAIN_FILE="build/build/generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
cmake --build build --config ${{ matrix.build_type }} --parallel
run: cmake --build --preset ${{ matrix.build_preset }} --parallel

- name: Test
run: ctest --build-config ${{ matrix.build_type }} --test-dir build
run: ctest --test-dir ${{ matrix.build_dir }} --build-config ${{ matrix.build_type }} --output-on-failure

# Drop sources, build trees and temporaries so only the package binaries are cached.
- name: Clean Conan cache
if: always()
run: conan cache clean "*" --source --build --temp

# Only on a miss: an exact key hit means the cache already holds these packages.
- name: Save Conan cache
if: always() && steps.cache-conan.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.CONAN_HOME }}
key: ${{ steps.cache-conan.outputs.cache-primary-key }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__/*
.idea/*
build/
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "googletest"]
path = googletest
url = git@github.com:google/googletest.git
url = https://github.com/google/googletest.git
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ cmake_minimum_required(VERSION 3.18)

project(tire)

find_package(Qt6 6.4 REQUIRED Core Widgets Network)
find_package(nlohmann_json REQUIRED)
find_package(Qt6 6.4 REQUIRED Core Widgets Network Sql)
find_package(spdlog REQUIRED)
find_package(fmt REQUIRED)

Expand All @@ -12,10 +11,11 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

include(CTest)

add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(googletest)
add_subdirectory(benchmarks)
include(CTest)
add_subdirectory(test/unit)
endif ()
Loading
Loading