-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
623 lines (577 loc) · 23.6 KB
/
Copy pathCMakeLists.txt
File metadata and controls
623 lines (577 loc) · 23.6 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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# Copyright 2017 Carlos O'Ryan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
cmake_minimum_required(VERSION 3.5)
set(PACKAGE_NAME "JayBeams")
set(PACKAGE_VERSION "0.1")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/coryan/jaybeams/issues")
project(JayBeams CXX C)
# Require C++14 for this project ...
set(CMAKE_CXX_STANDARD 14)
set(CXX_STANDARD_REQUIRED ON)
option(JB_DISABLE_TESTS "Disable unit and integration tests. Can be useful to avoid installing gmock+gtest." OFF)
# ... the author is paranoid. Turn on all available warnings
# and turn warnings into errors to stop the build if any warning is
# emitted ...
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Werror COMPILER_SUPPORTS_WERROR)
if (COMPILER_SUPPORTS_WERROR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif ()
CHECK_CXX_COMPILER_FLAG(-Wall COMPILER_SUPPORTS_WALL)
if (COMPILER_SUPPORTS_WALL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif ()
CHECK_CXX_COMPILER_FLAG(/WX COMPILER_SUPPORTS_WX)
if (COMPILER_SUPPORTS_WX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
endif ()
CHECK_CXX_COMPILER_FLAG(/W4 COMPILER_SUPPORTS_SWALL)
if (COMPILER_SUPPORTS_SWALL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Wall")
endif ()
# ... if set, enable code coverage builds for g++, and create a "test_coverage" target to collect the coverage using
# lcov. My attempts at using the gcovr cobertura output failed miserably, so I am sticking to what I know ...
option(COVERAGE "Enable code coverage builds." OFF)
if (${COVERAGE})
include(cmake/CodeCoverage.cmake)
append_coverage_compiler_flags()
endif (${COVERAGE})
include(cmake/FindSanitizers.cmake)
# ... include the functions to compile proto files ...
include(FindProtobuf)
# ... find the protobuf, grpc, and grpc++ libraries using pkg-config ...
include(FindPkgConfig)
pkg_check_modules(PROTOBUF REQUIRED protobuf>=3.0)
pkg_check_modules(GRPCPP REQUIRED grpc++>=1.0)
pkg_check_modules(GRPC REQUIRED grpc>=4.0)
link_directories(${GRPCPP_LIBRARY_DIRS} ${GRPC_LIBRARY_DIRS} ${PROTOBUF_LIBRARY_DIRS})
include_directories(${GRPCPP_INCLUDE_DIRS} ${GRPC_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS})
# ... we need Boost >= 1.58 because Beast and Boost.Endian require them ...
include(FindBoost)
find_package(Boost 1.58 QUIET REQUIRED
COMPONENTS log log_setup filesystem date_time thread iostreams program_options unit_test_framework)
include_directories(${Boost_INCLUDE_DIRS})
# ... YAML-CPP is a library to parse YAML files, JayBeams uses such files for all runtime configuration ...
find_package(yaml-cpp QUIET)
if (yaml-cpp_FOUND)
message(STATUS "Found yaml-cpp ${yaml-cpp_VERSION} using find_package()")
set(YAMLCPP_LIBRARIES yaml-cpp)
else ()
pkg_check_modules(YAMLCPP REQUIRED yaml-cpp>=0.5)
message(STATUS "Found yaml-cpp using pkg_check_modules()")
endif ()
# ... Beast (https://github.com/boostorg/beast) is a library for writing HTTP clients and servers ...
include_directories(${PROJECT_SOURCE_DIR}/ext/Beast/include)
# ... Gee-H (https://github.com/coryan/gee-h) is a client library for etcd ...
option(GEE_H_DISABLE_TESTS "Disable Gee-H unit tests in JayBeams" ON)
add_subdirectory(ext/gee-h)
# ... we need the -I flags so we can find header files using the installed path for JayBeams headers ...
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
# Compile things into shared libraries, apparently it is easy to instruct cmake(1) to generate a static library even
# if we only describe how to create a shared lib.
add_library(jb SHARED
jb/as_hhmmss.cpp
jb/as_hhmmss.hpp
jb/assert_throw.cpp
jb/assert_throw.hpp
jb/book_depth_statistics.cpp
jb/book_depth_statistics.hpp
jb/complex_traits.hpp
jb/config_attribute.hpp
jb/config_files_location.cpp
jb/config_files_location.hpp
jb/config_object.cpp
jb/config_object.hpp
jb/config_recurse.hpp
jb/convert_cpu_set.hpp
jb/convert_severity_level.hpp
jb/cpu_set.cpp
jb/cpu_set.hpp
jb/detail/array_traits.hpp
jb/detail/os_error.cpp
jb/detail/os_error.hpp
jb/detail/reconfigure_thread.cpp
jb/detail/reconfigure_thread.hpp
jb/detail/thread_setup_wrapper.hpp
jb/event_rate_estimator.hpp
jb/event_rate_histogram.hpp
jb/explicit_cuts_binning.hpp
jb/feed_error.hpp
jb/fileio.cpp
jb/fileio.hpp
jb/filetype.cpp
jb/filetype.hpp
jb/fixed_string.hpp
jb/histogram.hpp
jb/histogram_summary.cpp
jb/histogram_summary.hpp
jb/integer_range_binning.hpp
jb/launch_thread.hpp
jb/log.cpp
jb/log.hpp
jb/merge_yaml.cpp
jb/merge_yaml.hpp
jb/offline_feed_statistics.cpp
jb/offline_feed_statistics.hpp
jb/p2ceil.hpp
jb/severity_level.cpp
jb/severity_level.hpp
jb/strtonum.hpp
jb/thread_config.cpp
jb/thread_config.hpp
jb/usage.hpp
)
target_compile_definitions(jb PUBLIC -DBOOST_LOG_DYN_LINK)
target_link_libraries(jb Boost::log Boost::program_options Boost::iostreams ${YAMLCPP_LIBRARIES})
# ... the jb library unit tests, we setup the targets and dependencies further down using a loop ...
set(jb_unit_tests
jb/ut_as_hhmmss
jb/ut_assert_throw
jb/ut_book_depth_statistics
jb/ut_config_files_location
jb/ut_config_object
jb/ut_config_object_vector
jb/ut_cpu_set
jb/ut_event_rate_estimator
jb/ut_event_rate_histogram
jb/ut_explicit_cuts_binning
jb/ut_fileio
jb/ut_filetype
jb/ut_fixed_string
jb/ut_histogram
jb/ut_histogram_summary
jb/ut_integer_range_binning
jb/ut_launch_thread
jb/ut_logging
jb/ut_merge_yaml
jb/ut_offline_feed_statistics
jb/ut_p2ceil
jb/ut_severity_level
jb/ut_strtonum
jb/ut_thread_config
)
add_executable(examples_configuration examples/configuration.cpp)
target_link_libraries(examples_configuration jb)
##
## Capture configuration information in a series of variables, useful in benchmarks and tests
##
if (WIN32)
set(UNAME_LOG "TODO(coryan) - capture windows config")
else ()
execute_process(COMMAND uname -a OUTPUT_VARIABLE UNAME_LOG ERROR_VARIABLE UNAME_LOG)
endif (WIN32)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CXX_VERSION "TODO(coryan) - capture compiler version for MSVC")
else ()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version
OUTPUT_VARIABLE CXX_VERSION_LOG ERROR_VARIABLE CXX_VERSION_LOG)
endif ()
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CXXLD_VERSION "TODO(coryan) - capture linker version for MSVC")
else ()
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -Wl,--version
OUTPUT_VARIABLE CXXLD_VERSION_LOG ERROR_VARIABLE CXXLD_VERSION_LOG)
endif ()
if (IS_DIRECTORY ${PROJECT_SOURCE_DIR}/.git)
execute_process(COMMAND git rev-parse HEAD
OUTPUT_VARIABLE GIT_HEAD_LOG ERROR_VARIABLE GIT_HEAD_LOG)
else ()
set(GIT_HEAD_LOG "not .git directory")
endif ()
configure_file(jb/testing/compile_info.cpp.in jb/testing/compile_info.cpp)
add_library(jb_testing SHARED
jb/testing/check_close_enough.hpp
${PROJECT_BINARY_DIR}/jb/testing/compile_info.cpp
jb/testing/compile_info.hpp
jb/testing/create_square_timeseries.hpp
jb/testing/create_triangle_timeseries.hpp
jb/testing/delay_timeseries.hpp
jb/testing/future_status.hpp
jb/testing/initialize_mersenne_twister.hpp
jb/testing/microbenchmark.hpp
jb/testing/microbenchmark_base.cpp
jb/testing/microbenchmark_base.hpp
jb/testing/microbenchmark_config.cpp
jb/testing/microbenchmark_config.hpp
jb/testing/microbenchmark_group_main.cpp
jb/testing/microbenchmark_group_main.hpp
jb/testing/sum_square.hpp
)
target_link_libraries(jb_testing jb Boost::log Boost::program_options Boost::iostreams yaml-cpp)
set(jb_testing_unit_tests
jb/testing/future_status_ut
jb/testing/ut_check_close_enough
jb/testing/ut_create_square_timeseries
jb/testing/ut_create_triangle_timeseries
jb/testing/ut_delay_timeseries
jb/testing/ut_microbenchmark_config
)
add_executable(jb_testing_check_mt19937_initializer jb/testing/check_mt19937_initializer.cpp)
target_link_libraries(jb_testing_check_mt19937_initializer jb_testing jb)
add_executable(jb_testing_check_random_device jb/testing/check_random_device.cpp)
target_link_libraries(jb_testing_check_random_device jb_testing jb)
add_executable(jb_bm_clocks jb/bm_clocks.cpp)
target_link_libraries(jb_bm_clocks jb_testing jb)
add_executable(jb_testing_show_compile_info jb/testing/show_compile_info.cpp)
target_link_libraries(jb_testing_show_compile_info jb_testing jb)
# ... jb_gmock needs the googletest libraries ...
add_subdirectory(ext/googletest/googlemock)
add_library(jb_gmock SHARED
jb/gmock/init.hpp
)
target_link_libraries(jb_gmock gmock gtest)
add_library(jb_ehs SHARED
jb/ehs/acceptor.cpp
jb/ehs/acceptor.hpp
jb/ehs/base_types.hpp
jb/ehs/connection.cpp
jb/ehs/connection.hpp
jb/ehs/request_dispatcher.cpp
jb/ehs/request_dispatcher.hpp
)
target_link_libraries(jb_ehs jb Boost::log Boost::program_options Boost::iostreams yaml-cpp)
set(jb_ehs_unit_tests
jb/ehs/ut_acceptor
jb/ehs/ut_request_dispatcher)
add_library(jb_pitch2 SHARED
jb/pitch2/add_order_message.cpp
jb/pitch2/add_order_message.hpp
jb/pitch2/auction_update_message.cpp
jb/pitch2/auction_update_message.hpp
jb/pitch2/base_add_order_message.hpp
jb/pitch2/base_add_order_message_streaming.hpp
jb/pitch2/delete_order_message.cpp
jb/pitch2/delete_order_message.hpp
jb/pitch2/expanded_add_order_message.cpp
jb/pitch2/expanded_add_order_message.hpp
jb/pitch2/modify_message.cpp
jb/pitch2/modify_message.hpp
jb/pitch2/order_executed_message.cpp
jb/pitch2/order_executed_message.hpp
jb/pitch2/order_executed_price_message.cpp
jb/pitch2/order_executed_price_message.hpp
jb/pitch2/reduce_size_message.cpp
jb/pitch2/reduce_size_message.hpp
jb/pitch2/short_add_order_message.cpp
jb/pitch2/short_add_order_message.hpp
jb/pitch2/time_message.cpp
jb/pitch2/time_message.hpp
jb/pitch2/unit_clear_message.cpp
jb/pitch2/unit_clear_message.hpp
)
set(jb_pitch2_unit_tests
jb/pitch2/ut_add_order_message
jb/pitch2/ut_auction_update_message
jb/pitch2/ut_delete_order_message
jb/pitch2/ut_expanded_add_order_message
jb/pitch2/ut_modify_message
jb/pitch2/ut_order_executed_message
jb/pitch2/ut_order_executed_price_message
jb/pitch2/ut_reduce_size_message
jb/pitch2/ut_short_add_order_message
jb/pitch2/ut_time_message
jb/pitch2/ut_unit_clear_message
)
target_link_libraries(jb_pitch2 jb Boost::log Boost::program_options Boost::iostreams yaml-cpp)
add_library(jb_itch5 SHARED
jb/itch5/add_order_message.cpp
jb/itch5/add_order_message.hpp
jb/itch5/add_order_mpid_message.cpp
jb/itch5/add_order_mpid_message.hpp
jb/itch5/array_based_order_book.cpp
jb/itch5/array_based_order_book.hpp
jb/itch5/base_decoders.cpp
jb/itch5/base_decoders.hpp
jb/itch5/base_encoders.hpp
jb/itch5/broken_trade_message.cpp
jb/itch5/broken_trade_message.hpp
jb/itch5/char_list_field.hpp
jb/itch5/char_list_validator.cpp
jb/itch5/char_list_validator.hpp
jb/itch5/check_offset.cpp
jb/itch5/check_offset.hpp
jb/itch5/compute_book.hpp
jb/itch5/cross_trade_message.cpp
jb/itch5/cross_trade_message.hpp
jb/itch5/cross_type.hpp
jb/itch5/decoder.hpp
jb/itch5/generate_inside.hpp
jb/itch5/ipo_quoting_period_update_message.cpp
jb/itch5/ipo_quoting_period_update_message.hpp
jb/itch5/make_socket_udp_common.hpp
jb/itch5/make_socket_udp_recv.hpp
jb/itch5/make_socket_udp_send.hpp
jb/itch5/map_based_order_book.hpp
jb/itch5/market_participant_position_message.cpp
jb/itch5/market_participant_position_message.hpp
jb/itch5/message_header.cpp
jb/itch5/message_header.hpp
jb/itch5/mold_udp_channel.cpp
jb/itch5/mold_udp_channel.hpp
jb/itch5/mold_udp_pacer.hpp
jb/itch5/mold_udp_pacer_config.cpp
jb/itch5/mold_udp_pacer_config.hpp
jb/itch5/mold_udp_protocol_constants.hpp
jb/itch5/mpid_field.hpp
jb/itch5/mwcb_breach_message.cpp
jb/itch5/mwcb_breach_message.hpp
jb/itch5/mwcb_decline_level_message.cpp
jb/itch5/mwcb_decline_level_message.hpp
jb/itch5/net_order_imbalance_indicator_message.cpp
jb/itch5/net_order_imbalance_indicator_message.hpp
jb/itch5/order_book.hpp
jb/itch5/order_cancel_message.cpp
jb/itch5/order_cancel_message.hpp
jb/itch5/order_delete_message.cpp
jb/itch5/order_delete_message.hpp
jb/itch5/order_executed_message.cpp
jb/itch5/order_executed_message.hpp
jb/itch5/order_executed_price_message.cpp
jb/itch5/order_executed_price_message.hpp
jb/itch5/order_replace_message.cpp
jb/itch5/order_replace_message.hpp
jb/itch5/price_field.hpp
jb/itch5/price_levels.hpp
jb/itch5/process_buffer_mlist.hpp
jb/itch5/process_iostream.hpp
jb/itch5/process_iostream_mlist.hpp
jb/itch5/protocol_constants.hpp
jb/itch5/quote_defaults.hpp
jb/itch5/reg_sho_restriction_message.cpp
jb/itch5/reg_sho_restriction_message.hpp
jb/itch5/seconds_field.cpp
jb/itch5/seconds_field.hpp
jb/itch5/short_string_field.hpp
jb/itch5/static_digits.hpp
jb/itch5/stock_directory_message.cpp
jb/itch5/stock_directory_message.hpp
jb/itch5/stock_field.hpp
jb/itch5/stock_trading_action_message.cpp
jb/itch5/stock_trading_action_message.hpp
jb/itch5/system_event_message.cpp
jb/itch5/system_event_message.hpp
jb/itch5/timestamp.cpp
jb/itch5/timestamp.hpp
jb/itch5/trade_message.cpp
jb/itch5/trade_message.hpp
jb/itch5/udp_config_common.cpp
jb/itch5/udp_config_common.hpp
jb/itch5/udp_receiver_config.cpp
jb/itch5/udp_receiver_config.hpp
jb/itch5/udp_sender_config.cpp
jb/itch5/udp_sender_config.hpp
jb/itch5/unknown_message.hpp
)
target_link_libraries(jb_itch5 jb Boost::log Boost::program_options Boost::iostreams yaml-cpp)
add_library(jb_itch5_testing SHARED
jb/itch5/testing/data.cpp
jb/itch5/testing/data.hpp
jb/itch5/testing/messages.cpp
jb/itch5/testing/messages.hpp
)
target_link_libraries(jb_itch5_testing jb_itch5 jb Boost::log Boost::program_options Boost::iostreams yaml-cpp)
set(jb_itch5_unit_tests
jb/itch5/ut_add_order_message
jb/itch5/ut_add_order_mpid_message
jb/itch5/ut_array_based_order_book
jb/itch5/ut_base_decoders
jb/itch5/ut_base_encoders
jb/itch5/ut_broken_trade_message
jb/itch5/ut_char_list_field
jb/itch5/ut_char_list_validator
jb/itch5/ut_check_offset
jb/itch5/ut_compute_book
jb/itch5/ut_cross_trade_message
jb/itch5/ut_cross_type
jb/itch5/ut_generate_inside
jb/itch5/ut_ipo_quoting_period_update_message
jb/itch5/ut_make_socket_udp_common
jb/itch5/ut_make_socket_udp_recv
jb/itch5/ut_make_socket_udp_send
jb/itch5/ut_map_based_order_book
jb/itch5/ut_market_participant_position_message
jb/itch5/ut_message_header
jb/itch5/ut_mold_udp_pacer
jb/itch5/ut_mold_udp_pacer_config
jb/itch5/ut_mold_udp_channel
jb/itch5/ut_mwcb_breach_message
jb/itch5/ut_mwcb_decline_level_message
jb/itch5/ut_net_order_imbalance_indicator_message
jb/itch5/ut_order_book
jb/itch5/ut_order_cancel_message
jb/itch5/ut_order_delete_message
jb/itch5/ut_order_executed_message
jb/itch5/ut_order_executed_price_message
jb/itch5/ut_order_replace_message
jb/itch5/ut_price_field
jb/itch5/ut_price_levels
jb/itch5/ut_process_buffer_mlist
jb/itch5/ut_process_iostream_mlist
jb/itch5/ut_reg_sho_restriction_message
jb/itch5/ut_seconds_field
jb/itch5/ut_short_string_field
jb/itch5/ut_static_digits
jb/itch5/ut_stock_directory_message
jb/itch5/ut_stock_trading_action_message
jb/itch5/ut_system_event_message
jb/itch5/ut_timestamp
jb/itch5/ut_trade_message
jb/itch5/ut_udp_receiver_config
)
add_executable(jb_itch5_mold2inside jb/itch5/mold2inside.cpp)
target_link_libraries(jb_itch5_mold2inside jb_itch5 jb)
add_executable(jb_itch5_moldfeedhandler jb/itch5/moldfeedhandler.cpp)
target_link_libraries(jb_itch5_moldfeedhandler jb_itch5 jb_ehs jb)
add_executable(jb_itch5_moldreplay jb/itch5/moldreplay.cpp)
target_link_libraries(jb_itch5_moldreplay jb_itch5 jb_ehs jb)
add_executable(tools_itch5bookdepth tools/itch5bookdepth.cpp)
target_link_libraries(tools_itch5bookdepth jb_itch5 jb)
add_executable(tools_itch5eventdepth tools/itch5eventdepth.cpp)
target_link_libraries(tools_itch5eventdepth jb_itch5 jb)
add_executable(tools_itch5inside tools/itch5inside.cpp)
target_link_libraries(tools_itch5inside jb_itch5 jb)
add_executable(tools_itch5moldreplay tools/itch5moldreplay.cpp)
target_link_libraries(tools_itch5moldreplay jb_itch5 jb)
add_executable(tools_itch5stats tools/itch5stats.cpp)
target_link_libraries(tools_itch5stats jb_itch5 jb)
add_executable(tools_itch5trades tools/itch5trades.cpp)
target_link_libraries(tools_itch5trades jb_itch5 jb)
add_executable(tools_moldheartbeat tools/moldheartbeat.cpp)
target_link_libraries(tools_moldheartbeat jb_itch5 jb)
# TODO(coryan) - what to do with these
set(bin_SCRIPTS tools/benchmark_common.sh)
# ... determine if libraries are installed in the lib64 directory ...
get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if ("${LIB64}" STREQUAL "TRUE")
set(LIBSUFFIX 64)
else ()
set(LIBSUFFIX "")
endif ()
set(INSTALL_LIB_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for libraries")
# ... generate a pkg-config for Jaybeams ...
set(PKG_CONFIG_REQUIRES "grpc++ grpc protobuf")
set(PKG_CONFIG_LIBDIR "\${prefix}/lib")
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include")
set(PKG_CONFIG_LIBS "-L\${libdir} -ljb")
set(PKG_CONFIG_CFLAGS "-I\${includedir}")
#CONFIGURE_FILE(
# "${CMAKE_CURRENT_SOURCE_DIR}/templates/pkg-config.pc.in"
# "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc")
# ... define the install rules ...
install(TARGETS jb jb_testing jb_ehs jb_pitch2 jb_itch5
tools_itch5bookdepth tools_itch5eventdepth
tools_itch5inside tools_itch5moldreplay tools_itch5stats tools_itch5trades tools_moldheartbeat
jb_itch5_mold2inside jb_itch5_moldfeedhandler jb_itch5_moldreplay
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${INSTALL_LIB_DIR})
install(PROGRAMS jb/itch5/bm_order_book_report.Rmd jb/itch5/bm_order_book_analyze.R jb/itch5/bm_order_book_analyze.R
tools/benchmark_common.sh tools/benchmark_teardown.sh
DESTINATION bin)
install(DIRECTORY jb/ DESTINATION include/jb FILES_MATCHING PATTERN "*.hpp")
#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" DESTINATION lib/pkgconfig)
include(GNUInstallDirs)
add_definitions(-DJB_SYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}" -DJB_BINDIR="${CMAKE_INSTALL_FULL_BINDIR}")
# A helper function to wrap the common configuration for tests ...
function(jb_create_unit_test_targets)
foreach (fname ${ARGN})
string(REPLACE "/" "_" target ${fname})
string(REGEX MATCH ".*_ut$" is_ut ${target})
if (NOT is_ut)
string(REGEX MATCH ".*_ut_.*" is_ut ${target})
endif ()
if (NOT is_ut)
string(REGEX MATCH "^ut_.*" is_ut ${target})
endif ()
if (is_ut)
add_executable(${target} ${fname}.cpp)
get_target_property(tname ${target} NAME)
target_compile_definitions(${target} PUBLIC
-DBOOST_TEST_MAIN -DBOOST_TEST_DYN_LINK -DBOOST_TEST_MODULE=${target})
target_link_libraries(${target} jb Boost::unit_test_framework)
endif ()
endforeach ()
endfunction(jb_create_unit_test_targets)
set(all_unit_tests
${jb_unit_tests} ${jb_testing_unit_tests}
${jb_pitch2_unit_tests}
${jb_ehs_unit_tests}
${jb_itch5_unit_tests}
)
jb_create_unit_test_targets(${all_unit_tests})
if (NOT JB_DISABLE_TESTS)
# ... turn on testing support in CMake ...
enable_testing()
foreach (fname ${all_unit_tests})
string(REPLACE "/" "_" target ${fname})
add_test(${target} ${target})
endforeach ()
# ... add the right libraries to all the unit tests, and also turn them into tests ...
foreach (fname ${jb_testing_unit_tests})
string(REPLACE "/" "_" target ${fname})
target_link_libraries(${target} jb_testing)
endforeach ()
foreach (fname ${jb_pitch2_unit_tests})
string(REPLACE "/" "_" target ${fname})
target_link_libraries(${target} jb_pitch2)
endforeach ()
foreach (fname ${jb_itch5_unit_tests})
string(REPLACE "/" "_" target ${fname})
target_link_libraries(${target} jb_itch5_testing jb_itch5)
endforeach ()
foreach (fname ${jb_ehs_unit_tests})
string(REPLACE "/" "_" target ${fname})
target_link_libraries(${target} jb_ehs)
endforeach ()
foreach (target
jb_itch5_ut_compute_book
jb_itch5_ut_make_socket_udp_common
jb_itch5_ut_make_socket_udp_recv
jb_itch5_ut_make_socket_udp_send
jb_itch5_ut_mold_udp_channel
jb_itch5_ut_mold_udp_pacer
jb_itch5_ut_process_buffer_mlist
jb_itch5_ut_process_iostream_mlist
jb_ut_config_files_location
)
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/ext/googletest/googlemock)
target_link_libraries(${target} jb_gmock)
endforeach ()
endif (NOT JB_DISABLE_TESTS)
include(cmake/FindFFTW.cmake)
if (FFTW3_FOUND)
add_subdirectory(jb/fftw)
endif (FFTW3_FOUND)
include(FindOpenCL)
if (OpenCL_FOUND)
add_subdirectory(jb/opencl)
endif (OpenCL_FOUND)
include(cmake/FindCLFFT.cmake)
if (CLFFT_FOUND)
add_subdirectory(jb/clfft)
add_subdirectory(jb/tde)
endif (CLFFT_FOUND)
file(GLOB_RECURSE ALL_CXX_SOURCE_FILES jb/*.[hc]pp examples/*.[hc]pp tools/*.[hc]pp)
find_program(CLANG_FORMAT clang-format)
if (CLANG_FORMAT)
add_custom_target(clang-format
COMMAND ${CLANG_FORMAT} -i ${ALL_CXX_SOURCE_FILES})
add_custom_target(check-style
COMMAND git diff --exit-code
DEPENDS clang-format)
else()
add_custom_target(check-style)
endif (CLANG_FORMAT)