-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
112 lines (93 loc) · 2.52 KB
/
Copy pathCMakeLists.txt
File metadata and controls
112 lines (93 loc) · 2.52 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.14)
set(WARNING_FLAGS
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Werror -Wundef>
$<$<CXX_COMPILER_ID:GNU>:-Wuseless-cast -Wmaybe-uninitialized>
$<$<CXX_COMPILER_ID:MSVC>:/W4 /permissive->
)
set(PROJECT_NAME
order_book_v1
)
project(${PROJECT_NAME} LANGUAGES C CXX)
add_executable(clob_cli
src/main.cc
)
add_library(orderbook
SHARED
src/orderbook.cc
src/event_log.cc
src/types.cc
)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 52eb8108c5bdec04579160ae17225d66034bd723
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(
googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG 192ef10025eb2c4cdd392bc502f0c852196baa48
)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googlebenchmark)
enable_testing()
add_executable(orderbook_test
tests/orderbook_test.cc
tests/orderbook_cancel_test.cc
tests/orderbook_layout_test.cc
tests/orderbook_match_test.cc
tests/orderbook_reject_test.cc
tests/orderbook_hash_test.cc
tests/event_log_test.cc
tests/event_log_output_test.cc
tests/hash_test.cc
)
target_link_libraries(orderbook_test
PRIVATE
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(orderbook_test)
add_executable(orderbook_benchmark
benchmark/limit_market_cancel.cc
)
target_link_libraries(orderbook_benchmark
PRIVATE
benchmark::benchmark
benchmark::benchmark_main
)
set(SAN_FLAGS
-fsanitize=address,undefined
-fno-omit-frame-pointer
-g
)
add_library(project_defaults INTERFACE)
add_library(tl_expected INTERFACE)
target_include_directories(tl_expected
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/third_party
)
target_include_directories(orderbook
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_compile_features(project_defaults
INTERFACE
cxx_std_20
)
target_compile_options(project_defaults
INTERFACE
${WARNING_FLAGS}
$<$<CONFIG:Debug>:${SAN_FLAGS}>
)
target_link_options(project_defaults
INTERFACE
$<$<CONFIG:Debug>:${SAN_FLAGS}>
)
target_link_libraries(clob_cli PRIVATE project_defaults tl_expected orderbook)
target_link_libraries(orderbook PRIVATE project_defaults tl_expected)
target_link_libraries(orderbook_test PRIVATE project_defaults tl_expected orderbook)
target_link_libraries(orderbook_benchmark PRIVATE project_defaults tl_expected orderbook)