-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
252 lines (227 loc) · 7.54 KB
/
Copy pathCMakeLists.txt
File metadata and controls
252 lines (227 loc) · 7.54 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/../cmake/Modules/")
# First try to find the config version. Newer, used by vcpkg etc
find_package(Flatbuffers CONFIG)
if(TARGET flatbuffers::flatbuffers AND TARGET flatbuffers::flatc)
get_property(flatc_location TARGET flatbuffers::flatc PROPERTY LOCATION)
message(STATUS "Found Flatbuffers with CONFIG, flatc located at: ${flatc_location}")
else()
# Fallback to the old version
find_package(Flatbuffers MODULE REQUIRED)
set(flatc_location ${FLATBUFFERS_FLATC_EXECUTABLE})
message(STATUS "Found Flatbuffers with MODULE, flatc located at: ${flatc_location}")
endif()
include(FlatbufferUtils)
set(RL_FLAT_BUFFER_FILES_V1
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v1/DecisionRankingEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v1/Metadata.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v1/OutcomeEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v1/RankingEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v1/SlatesEvent.fbs" )
set(RL_FLAT_BUFFER_FILES_V2
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/CaEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/CbEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/DedupInfo.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/Event.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/FileFormat.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/LearningModeType.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/Metadata.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/MultiSlotEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/MultiStepEvent.fbs"
"${CMAKE_CURRENT_SOURCE_DIR}/schema/v2/OutcomeEvent.fbs")
add_flatbuffer_schema(
TARGET fbgenerator_v1
SCHEMAS ${RL_FLAT_BUFFER_FILES_V1}
OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/generated/v1/
FLATC_EXE ${flatc_location}
)
add_flatbuffer_schema(
TARGET fbgenerator_v2
SCHEMAS ${RL_FLAT_BUFFER_FILES_V2}
OUTPUT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/generated/v2/
FLATC_EXE ${flatc_location}
)
set(PROJECT_SOURCES
api_status.cc
console_tracer.cc
constants.cc
continuous_action_response.cc
decision_response.cc
dedup.cc
error_callback_fn.cc
factory_resolver.cc
generic_event.cc
learning_mode.cc
live_model.cc
live_model_impl.cc
logger/endian.cc
logger/event_logger.cc
logger/file/file_logger.cc
logger/flatbuffer_allocator.cc
logger/logger_extensions.cc
logger/logger_facade.cc
logger/preamble.cc
logger/preamble_sender.cc
lru_dedup_cache.cc
model_mgmt/data_callback_fn.cc
model_mgmt/empty_data_transport.cc
model_mgmt/file_model_loader.cc
model_mgmt/model_downloader.cc
model_mgmt/model_mgmt.cc
multistep.cc
multi_slot_response.cc
multi_slot_response_detailed.cc
ranking_event.cc
ranking_response.cc
sampling.cc
serialization/payload_serializer.cc
slot_ranking.cc
time_helper.cc
trace_logger.cc
utility/config_helper.cc
utility/config_utility.cc
utility/configuration.cc
utility/context_helper.cc
utility/data_buffer.cc
utility/data_buffer_streambuf.cc
vw_model/pdf_model.cc
vw_model/safe_vw.cc
utility/stl_container_adapter.cc
utility/str_util.cc
utility/watchdog.cc
vw_model/vw_model.cc
)
if(vw_USE_AZURE_FACTORIES)
list(APPEND PROJECT_SOURCES
azure_factories.cc
model_mgmt/restapi_data_transport.cc
utility/eventhub_http_authorization.cc
utility/header_authorization.cc
utility/http_client.cc
utility/http_helper.cc
)
endif()
set(PROJECT_PUBLIC_HEADERS
../include/action_flags.h
../include/api_status.h
../include/config_utility.h
../include/configuration.h
../include/constants.h
../include/container_iterator.h
../include/continuous_action_response.h
../include/data_buffer.h
../include/decision_response.h
../include/err_constants.h
../include/error_callback_fn.h
../include/errors_data.h
../include/factory_resolver.h
../include/future_compat.h
../include/internal_constants.h
../include/live_model.h
../include/model_mgmt.h
../include/multi_slot_response.h
../include/multi_slot_response_detailed.h
../include/multistep.h
../include/object_factory.h
../include/personalization.h
../include/ranking_response.h
../include/rl_string_view.h
../include/sender.h
../include/slot_ranking.h
../include/str_util.h
../include/trace_logger.h
)
set(PROJECT_PRIVATE_HEADERS
console_tracer.h
dedup.h
federation/federated_client.h
federation/joined_log_provider.h
generic_event.h
live_model_impl.h
logger/async_batcher.h
logger/event_logger.h
logger/logger_facade.h
lru_dedup_cache.h
model_mgmt/data_callback_fn.h
model_mgmt/empty_data_transport.h
model_mgmt/file_model_loader.h
model_mgmt/model_downloader.h
moving_queue.h
ranking_event.h
sampling.h
serialization/fb_serializer.h
serialization/json_serializer.h
utility/config_helper.h
utility/context_helper.h
utility/interruptable_sleeper.h
utility/object_pool.h
utility/periodic_background_proc.h
utility/watchdog.h
vw_model/pdf_model.h
vw_model/safe_vw.h
vw_model/vw_model.h
)
if(vw_USE_AZURE_FACTORIES)
list(APPEND PROJECT_PRIVATE_HEADERS
azure_factories.h
logger/http_transport_client.h
model_mgmt/restapi_data_transport.h
utility/eventhub_http_authorization.h
utility/header_authorization.h
utility/http_client.h
utility/http_helper.h
)
endif()
source_group("Sources" FILES ${PROJECT_SOURCES})
source_group("Public headers" FILES ${PROJECT_PUBLIC_HEADERS})
source_group("Private headers" FILES ${PROJECT_PRIVATE_HEADERS})
add_library(rlclientlib ${PROJECT_SOURCES} ${PROJECT_PUBLIC_HEADERS} ${PROJECT_PRIVATE_HEADERS})
add_dependencies(rlclientlib fbgenerator_v1 fbgenerator_v2)
set_target_properties(rlclientlib PROPERTIES POSITION_INDEPENDENT_CODE ON)
if(WIN32)
set_target_properties(rlclientlib PROPERTIES DEBUG_POSTFIX d)
endif()
if(vw_USE_AZURE_FACTORIES)
target_compile_definitions(rlclientlib PRIVATE USE_AZURE_FACTORIES)
endif()
if(RL_USE_ZSTD)
target_compile_definitions(rlclientlib PRIVATE USE_ZSTD)
target_link_libraries(rlclientlib PRIVATE libzstd_static)
target_include_directories(rlclientlib PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../ext_libs/zstd/lib/)
endif()
target_compile_definitions(rlclientlib PRIVATE FLATBUFFERS_SPAN_MINIMAL)
target_include_directories(rlclientlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../include
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../ext_libs/date
)
target_link_libraries(rlclientlib PUBLIC Boost::system vw_common vw_core PRIVATE RapidJSON)
# If flatbuffers found via CONFIG, add its target as a library dependency
# Otherwise, the flatbuffers MODULE defines FLATBUFFERS_INCLUDE_DIR to add to the include path
if(TARGET flatbuffers::flatbuffers)
target_link_libraries(rlclientlib PRIVATE flatbuffers::flatbuffers)
else()
target_include_directories(rlclientlib PRIVATE ${FLATBUFFERS_INCLUDE_DIR})
endif()
if (vw_USE_AZURE_FACTORIES)
target_link_libraries(rlclientlib PUBLIC cpprestsdk::cpprest OpenSSL::SSL OpenSSL::Crypto)
endif()
# Consuming Boost uuid requires BCrypt, normally this is automatically linked but vcpkg turns this feature off.
if(WIN32)
target_link_libraries(rlclientlib PUBLIC bcrypt)
endif()
# On MacOS linking fails unless we explicitly add Boost::thread. It seems like CppRestSDK isn't exporting dependencies properly.
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(rlclientlib PUBLIC Boost::thread)
endif()
# Set paths for installing library and header files
install(
TARGETS rlclientlib
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
FILES ${PROJECT_PUBLIC_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/rlclientlib
)