- CMake 3.30 or higher (required for C++26 support)
- C++26 compatible compiler:
- GCC 14+ (recommended) or Clang 19+
- MSVC 19.40+ (Windows)
- Git (for submodules)
# Clone with submodules
git clone --recursive <repository-url>
cd exchange-cpp
# If you already cloned without submodules (e.g. CMake fails on third_party/spdlog):
git submodule update --init --recursive
# Build
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j$(nproc)# Run tests (requires Google Test)
cmake .. -DBUILD_TESTING=ON
cmake --build . -j$(nproc)
ctest --output-on-failure
# Build benchmarks (requires Google Benchmark)
cmake .. -DBUILD_BENCHMARKS=ON
cmake --build . -j$(nproc)sudo apt install gcc-15 g++-15 gdb-15
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 100
sudo update-alternatives --install /usr/bin/gdb gdb /usr/bin/gdb-15 100sudo apt install build-essential libmpfr-dev libgmp3-dev libmpc-dev -y
wget http://ftp.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.gz
tar -xf gcc-15.2.0.tar.gz
cd gcc-15.2.0
./configure -v --build=$(uname -m)-linux-gnu --host=$(uname -m)-linux-gnu \
--target=$(uname -m)-linux-gnu --prefix=/usr/local/gcc-15.2.0 \
--enable-checking=release --enable-languages=c,c++ \
--disable-multilib --program-suffix=-15.2.0
make -j$(nproc)
sudo make install
# Set as default (WSL/Linux: CMake uses `c++`, so set it too)
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-15.2.0/bin/gcc-15.2.0 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-15.2.0/bin/g++-15.2.0 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/local/gcc-15.2.0/bin/g++-15.2.0 100
sudo update-alternatives --set gcc /usr/local/gcc-15.2.0/bin/gcc-15.2.0
sudo update-alternatives --set g++ /usr/local/gcc-15.2.0/bin/g++-15.2.0
sudo update-alternatives --set c++ /usr/local/gcc-15.2.0/bin/g++-15.2.0
# Add to library path
echo 'export LD_LIBRARY_PATH=/usr/local/gcc-15.2.0/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
# Verify
gcc --versionThe project uses the following submodules:
| Submodule | Description |
|---|---|
reference/exchange-core |
Original Java implementation for reference |
third_party/disruptor-cpp |
High-performance inter-thread communication library |
Initialize submodules if not cloned with --recursive:
git submodule update --init --recursiveFor optimal performance, configure CPU isolation to reduce kernel scheduler overhead.
sudo nano /etc/default/grub
# Add to GRUB_CMDLINE_LINUX: isolcpus=8-15 nohz_full=8-15 rcu_nocbs=8-15
sudo update-grub
sudo rebootVerify: cat /sys/devices/system/cpu/isolated should show 8-15
Note: Reserve some CPUs (e.g., 0-7) for system use. Never isolate all CPUs.
cd build
ctest --output-on-failure # Run all tests
./tests/perf/PerfLatency # Run latency benchmarks
./benchmarks/perf_long_adaptive_radix_tree_map # ART benchmarksSee PERFORMANCE_BENCHMARK_COMPARISON.md for detailed benchmark results.