-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
38 lines (29 loc) · 1.59 KB
/
Copy pathCMakeLists.txt
File metadata and controls
38 lines (29 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 3.10)
# Project Name and Language
project(UltraLowLatencyLOB VERSION 1.0 LANGUAGES CXX)
# Require C++17 Standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# ------------------------------------------------------------------------------
# HFT Compiler Flags
# -O3: Maximum optimization (inlining, loop unrolling, vectorization)
# -march=native: Optimizes the binary specifically for the CPU compiling it
# -DNDEBUG: Disables all assert() macros to remove branching in the critical path
# -pthread: Required for our CPU core pinning
# ------------------------------------------------------------------------------
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -march=native -DNDEBUG -pthread -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -pthread -Wall -Wextra")
# Include directories so our cpp files can find the headers
include_directories(${CMAKE_SOURCE_DIR}/include)
# 1. Build the core Limit Order Book library
# This compiles the source file into a static library we can link against
add_library(lob_core src/OrderBook.cpp)
# 2. Build the Ring Buffer Benchmark executable
add_executable(benchmark_ringbuffer benchmarks/benchmark_ringbuffer.cpp)
target_link_libraries(benchmark_ringbuffer PRIVATE lob_core pthread)
# 3. Build the Order Book Latency Benchmark executable (Next Step)
add_executable(benchmark_lob benchmarks/benchmark_lob.cpp)
target_link_libraries(benchmark_lob PRIVATE lob_core pthread)
# 4. Build the Main HFT Engine Executable
add_executable(hft_engine src/main.cpp)
target_link_libraries(hft_engine PRIVATE lob_core pthread)