Getting Started¶
This guide will help you build, test, and install FLOX on your machine.
Prerequisites¶
- C++20 or later (e.g. GCC 13 or Clang 16+)
- CMake 3.22+
- Git
- Linux (recommended), Windows and macOS supported
- GoogleTest and Google Benchmark
- LZ4 (optional, for compression)
clang-format18.1.8 (for development)
Clone and Build¶
git clone https://github.com/eeiaao/flox.git
cd flox
mkdir build && cd build
cmake ..
make -j$(nproc)
Install Dependencies¶
If GoogleTest and Google Benchmark are not installed system-wide:
# GoogleTest
git clone --depth=1 https://github.com/google/googletest.git
cmake -B gtest-build -S googletest
cmake --build gtest-build --target gtest gtest_main gmock gmock_main
sudo cmake --install gtest-build
# Google Benchmark
git clone --depth=1 https://github.com/google/benchmark.git
cmake -B benchmark-build -S benchmark -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
cmake --build benchmark-build -j$(nproc)
sudo cmake --install benchmark-build
# LZ4 (for compression support)
sudo apt install -y liblz4-dev
clang-format Setup¶
We use clang-format 18.x to enforce consistent style. Install it with:
sudo apt install -y wget gnupg lsb-release software-properties-common
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt install -y clang-format-18
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-18 100
Build Options¶
FLOX supports optional components controlled via CMake flags:
| Option | Default | Description |
|---|---|---|
FLOX_ENABLE_TESTS |
OFF |
Build unit tests |
FLOX_ENABLE_BENCHMARKS |
OFF |
Build benchmark binaries |
FLOX_ENABLE_DEMO |
OFF |
Build the demo application |
FLOX_ENABLE_BACKTEST |
OFF |
Build backtest module (simulated execution) |
FLOX_ENABLE_LZ4 |
OFF |
Enable LZ4 compression for replay |
FLOX_ENABLE_CPU_AFFINITY |
OFF |
Enable CPU affinity (isolated systems only) |
To enable them:
cmake .. -DFLOX_ENABLE_TESTS=ON -DFLOX_ENABLE_BENCHMARKS=ON -DFLOX_ENABLE_DEMO=ON -DFLOX_ENABLE_LZ4=ON
Run Tests¶
From the build directory:
Run Benchmarks¶
Or any other binary in benchmarks/.
Install System-Wide¶
Code Style and Contribution¶
- All contributions go through pull requests
- Use existing naming and directory conventions
- Add tests, benchmarks, and documentation where appropriate
A .clang-format file is provided. A pre-commit hook is installed automatically during CMake configuration. It formats all changed .cpp and .h files.
To install it manually:
Using FLOX in Your Project¶
FLOX is a low-latency infrastructure library. It is suitable for building:
- HFT engines
- Backtesters and simulators
- Custom execution pipelines
- Signal routers and adapters
All components are modular, testable, and can be used independently.