Installation¶
AlgebraicHashing is a header-only C++20 library with multiple installation options.
Requirements¶
- C++20 compiler:
- GCC 10+ (recommended: GCC 13)
- Clang 12+ (recommended: Clang 15)
- MSVC 2019+ (Visual Studio 16.0+)
- CMake 3.20+ (for building tests/examples)
Quick Install Options¶
The easiest way to integrate into your CMake project:
For Conan package management:
Then in CMakeLists.txt:
Using vcpkg package manager:
Then in CMakeLists.txt:
Verify Installation¶
Create a test file test_install.cpp:
#include <algebraic_hashing/functions/fnv_hash_modern.hpp>
#include <algebraic_hashing/dsl/algebraic_operations.hpp>
#include <iostream>
int main() {
using namespace algebraic_hashing;
auto hash = fnv64{};
auto result = hash("AlgebraicHashing");
std::cout << "Hash result: " << result << "\n";
std::cout << "Installation successful!\n";
return 0;
}
Compile and run:
# With CMake
cmake -B build
cmake --build build
./build/test_install
# Or directly with g++
g++ -std=c++20 -I/path/to/algebraic_hashing/include test_install.cpp -o test_install
./test_install
Expected output:
Building from Source¶
Clone the Repository¶
Build Options¶
# Release build (optimized)
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
# Debug build (with sanitizers)
cmake -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build
# With tests enabled
cmake -B build -DBUILD_TESTING=ON
cmake --build build
ctest --test-dir build --output-on-failure
# With examples
cmake -B build -DBUILD_EXAMPLES=ON
cmake --build build
./build/algebraic_hashing_tutorial
# With coverage reporting
cmake -B build -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build --target coverage
# Open build/coverage_html/index.html
CMake Options¶
| Option | Default | Description |
|---|---|---|
BUILD_TESTING |
ON | Build test suite |
BUILD_EXAMPLES |
ON | Build tutorial examples |
BUILD_BENCHMARKS |
OFF | Build performance benchmarks |
ENABLE_COVERAGE |
OFF | Enable code coverage reporting |
ENABLE_CONCEPTS_CHECKING |
ON | Enable extensive concepts validation |
ENABLE_STATISTICS |
ON | Enable performance statistics collection |
Using in Your Project¶
With CMake¶
cmake_minimum_required(VERSION 3.20)
project(MyProject LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Option 1: Find installed package
find_package(algebraic_hashing REQUIRED)
# Option 2: Use FetchContent (see above)
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE AlgebraicHashing::algebraic_hashing)
Header-Only (Manual)¶
If you prefer not to use a build system:
// Simply include the headers you need
#include <algebraic_hashing/functions/fnv_hash_modern.hpp>
#include <algebraic_hashing/dsl/algebraic_operations.hpp>
// Compile with C++20
// g++ -std=c++20 -I/path/to/include main.cpp
Troubleshooting¶
Compiler Not Found¶
C++20 Not Supported¶
If your compiler is too old, install a newer version:
# Ubuntu/Debian
sudo apt install g++-13
# macOS with Homebrew
brew install gcc@13
# Windows
# Download from https://winlibs.com/
Concepts Not Working¶
Make sure you're actually using C++20:
Tests Failing¶
This usually means a compiler or standard library issue:
# Run tests with verbose output
cd build
ctest -V
# Run specific test
./test_modern_architecture --gtest_filter=YourTestName
Next Steps¶
- Quick Start Guide - Your first hash composition
- Core Concepts - Understand the foundations
- Examples - See practical applications
Platform-Specific Notes¶
Linux¶
AlgebraicHashing works out-of-the-box on all modern Linux distributions. Use your package manager's GCC or Clang.
macOS¶
Xcode's default compiler should work, but for best results use Homebrew's GCC or Clang:
Windows¶
Recommended setup:
- Install Visual Studio 2022 (includes MSVC with C++20 support)
- Or use MSYS2/MinGW-w64 with GCC 13+
Need help? Open an issue on GitHub.