-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
105 lines (70 loc) · 2.15 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.12)
# cmake
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
# project
project(roq-cpp-algo-template)
# language
enable_language(CXX)
# conda
if(DEFINED ENV{CONDA_PREFIX} AND NOT DEFINED ENV{CONDA_BUILD})
set(CMAKE_INSTALL_PREFIX $ENV{CONDA_PREFIX})
set(CMAKE_FIND_ROOT_PATH $ENV{CONDA_PREFIX})
endif()
# rpath
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# c++
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 23)
endif()
# filesystem
include(GNUInstallDirs)
# dependencies
find_package(absl REQUIRED)
find_package(fmt REQUIRED)
find_package(magic_enum REQUIRED)
find_package(pybind11 CONFIG REQUIRED)
find_package(
Python
COMPONENTS Interpreter Development
REQUIRED)
find_package(roq-algo REQUIRED)
find_package(roq-api REQUIRED)
find_package(roq-cache REQUIRED)
find_package(roq-client REQUIRED)
find_package(roq-codec REQUIRED)
find_package(roq-fix REQUIRED)
find_package(roq-flags REQUIRED)
find_package(roq-io REQUIRED)
find_package(roq-logging REQUIRED)
find_package(roq-market REQUIRED)
find_package(roq-python-core REQUIRED)
find_package(roq-utils REQUIRED)
find_package(tomlplusplus REQUIRED)
find_package(unordered_dense REQUIRED)
# find python's site-packages https://stackoverflow.com/a/40006251
message(PYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}")
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils import sysconfig as sc; print(sc.get_python_lib(prefix='', plat_specific=True))"
OUTPUT_VARIABLE PYTHON_SITE
OUTPUT_STRIP_TRAILING_WHITESPACE)
# autogen
find_program(ROQ_AUTOGEN roq-autogen REQUIRED)
set(TEMPLATE_DIR ${CMAKE_SOURCE_DIR}/scripts/templates)
# clang-format
find_program(CLANG_FORMAT clang-format REQUIRED)
# include
include_directories(
${CMAKE_SOURCE_DIR}/src
# >>> autogen >>>
${CMAKE_BINARY_DIR}/src)
# sub-projects
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/roq/samples/algo)
# test
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
endif()
find_package(Catch2 REQUIRED)
add_subdirectory(${CMAKE_SOURCE_DIR}/test)
# benchmark
find_package(benchmark REQUIRED)
add_subdirectory(${CMAKE_SOURCE_DIR}/benchmark)