forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 21
/
CMakeLists.txt
1446 lines (1247 loc) · 41.1 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
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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# This file is open source software, licensed to you under the terms
# of the Apache License, Version 2.0 (the "License"). See the NOTICE file
# distributed with this work for additional information regarding copyright
# ownership. 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.
#
#
# Copyright (C) 2018 Scylladb, Ltd.
#
cmake_minimum_required (VERSION 3.13)
list (APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_CURRENT_BINARY_DIR})
cmake_policy (SET CMP0090 NEW)
foreach (policy CMP0127 CMP0135)
if (POLICY ${policy})
cmake_policy (SET ${policy} NEW)
endif ()
endforeach ()
include (Cooking OPTIONAL)
# This variable impacts the way DPDK is configured by cmake-cooking (if DPDK is enabled), so its definition needs to
# come before PROJECT.
set (Seastar_DPDK_MACHINE
"native"
CACHE
STRING
"Configure DPDK for this processor architecture (if `Seastar_DPDK` is enabled). It configures -march or -mcpu")
project (Seastar
VERSION 1.0
LANGUAGES CXX)
set (Seastar_ALLOC_FAILURE_INJECTION
"DEFAULT"
CACHE
STRING
"Enable failure injection into the Seastar allocator. Can be ON, OFF or DEFAULT (which enables it for Dev mode)")
option (Seastar_TASK_BACKTRACE
"Collect backtrace at deferring points."
OFF)
option (Seastar_DEBUG_ALLOCATIONS
"For now just writes 0xab to newly allocated memory"
OFF)
option (Seastar_SSTRING
"Use seastar's own string implementation"
ON)
set (Seastar_API_LEVEL
"7"
CACHE
STRING
"Seastar compatibility API level (5=future<T>::get() returns T&&, 6=future is not variadic, 7=unified CPU/IO scheduling groups")
set_property (CACHE Seastar_API_LEVEL
PROPERTY
STRINGS 6)
set (Seastar_SCHEDULING_GROUPS_COUNT
"16"
CACHE
STRING
"A positive number to set Seastar's reactor number of allowed different scheduling groups.")
if (NOT Seastar_SCHEDULING_GROUPS_COUNT MATCHES "^[1-9][0-9]*")
message(FATAL_ERROR "Seastar_SCHEDULING_GROUPS_COUNT must be a positive number (${Seastar_SCHEDULING_GROUPS_COUNT})")
endif ()
option (Seastar_WITH_OSSL
"Use OpenSSL for underlying TLS mechanism"
OFF)
if (Seastar_WITH_OSSL)
set(Seastar_WITH_GNUTLS OFF)
else ()
set(Seastar_WITH_GNUTLS ON)
endif ()
# Add a dev build type.
#
# All pre-defined build modes include optimizations or debug info,
# which make them slow to build. The dev build mode is intended for
# fast build/test iteration.
#
if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set (CMAKE_CXX_FLAGS_DEV_OPT_LEVEL "-O2")
else ()
set (CMAKE_CXX_FLAGS_DEV_OPT_LEVEL "-O1")
endif ()
set (CMAKE_CXX_FLAGS_DEV
"${CMAKE_CXX_FLAGS_DEV_OPT_LEVEL}"
CACHE
STRING
"Flags used by the C++ compiler during dev builds."
FORCE)
set (CMAKE_C_FLAGS_DEV
"-O1"
CACHE
STRING
"Flags used by the C compiler during dev builds."
FORCE)
set (CMAKE_EXE_LINKER_FLAGS_DEV
""
CACHE
STRING
"Flags used for linking binaries during dev builds."
FORCE)
set (CMAKE_SHARED_LINKER_FLAGS_DEV
""
CACHE
STRING
"Flags used by the shared libraries linker during builds."
FORCE)
mark_as_advanced (
CMAKE_CXX_FLAGS_DEV
CMAKE_C_FLAGS_DEV
CMAKE_EXE_LINKER_FLAGS_DEV
CMAKE_SHARED_LINKER_FLAGS_DEV)
set (CMAKE_CXX_FLAGS_SANITIZE
"-Os -g"
CACHE
STRING
"Flags used by the C++ compiler during sanitize builds."
FORCE)
set (CMAKE_CXX_STANDARD
"23"
CACHE
STRING
"C++ standard to build with.")
include (CMakeDependentOption)
cmake_dependent_option (Seastar_MODULE
"Build a C++20 module instead of a traditional library" OFF
"CMAKE_VERSION VERSION_GREATER_EQUAL 3.26;CMAKE_CXX_STANDARD GREATER_EQUAL 20" OFF)
set (CMAKE_C_FLAGS_SANITIZE
"-Os -g"
CACHE
STRING
"Flags used by the C compiler during sanitize builds."
FORCE)
set (CMAKE_EXE_LINKER_FLAGS_SANITIZE
""
CACHE
STRING
"Flags used for linking binaries during sanitize builds."
FORCE)
set (CMAKE_SHARED_LINKER_FLAGS_SANITIZE
""
CACHE
STRING
"Flags used by the shared libraries linker during sanitize builds."
FORCE)
mark_as_advanced (
CMAKE_CXX_FLAGS_SANITIZE
CMAKE_C_FLAGS_SANITIZE
CMAKE_EXE_LINKER_FLAGS_SANITIZE
CMAKE_SHARED_LINKER_FLAGS_SANITIZE)
set (CMAKE_BUILD_TYPE
"${CMAKE_BUILD_TYPE}"
CACHE
STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Dev Sanitize."
FORCE)
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "Release")
endif ()
set (Seastar_ALLOC_PAGE_SIZE
""
CACHE
STRING
"Override the Seastar allocator page size, in bytes.")
function (set_option_if_package_is_found option_name package_name)
# if the package is found, set the option on behalf of user unless it is
# explicitly specified,
if (DEFINED ${option_name})
return ()
endif ()
if (${package_name}_FOUND)
set (${option_name} ON CACHE BOOL "")
endif ()
endfunction ()
# When Seastar is a top-level project, enable the non-library targets by default.
# If it is embedded with `add_subdirectory`, disable them.
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set (Seastar_MASTER_PROJECT ON)
else ()
set (Seastar_MASTER_PROJECT OFF)
endif ()
option (Seastar_APPS
"Enable application targets."
${Seastar_MASTER_PROJECT})
set (Seastar_CXX_FLAGS
""
CACHE
STRING
"Semicolon-separated list of extra compilation flags for Seastar itself.")
option (Seastar_DEMOS
"Enable demonstration targets."
${Seastar_MASTER_PROJECT})
option (Seastar_DOCS
"Enable documentation targets."
${Seastar_MASTER_PROJECT})
option (Seastar_DPDK
"Enable DPDK support."
OFF)
option (Seastar_EXCLUDE_APPS_FROM_ALL
"When enabled alongside Seastar_APPS, do not build applications by default."
OFF)
option (Seastar_EXCLUDE_DEMOS_FROM_ALL
"When enabled alongside Seastar_DEMOS, do not build demonstrations by default."
OFF)
option (Seastar_EXCLUDE_TESTS_FROM_ALL
"When enabled alongside Seastar_TESTING, do not build tests by default."
OFF)
option (Seastar_EXECUTE_ONLY_FAST_TESTS
"Only execute tests which run quickly."
OFF)
option (Seastar_HWLOC
"Enable hwloc support."
ON)
if (DEFINED Seastar_IO_URING)
option (Seastar_IO_URING
"Enable io_uring support."
ON)
endif ()
set (Seastar_JENKINS
""
CACHE
STRING
"If non-empty, the prefix for XML files containing the results of running tests (for Jenkins).")
set (Seastar_LD_FLAGS
""
CACHE
STRING
"Semicolon-separated list of extra linking flags for Seastar itself.")
option (Seastar_INSTALL
"Install targets."
${Seastar_MASTER_PROJECT})
option (Seastar_NUMA
"Enable NUMA support."
ON)
option (Seastar_TESTING
"Enable testing targets."
${Seastar_MASTER_PROJECT})
include (CMakeDependentOption)
cmake_dependent_option (Seastar_ENABLE_TESTS_ACCESSING_INTERNET
"Enable tests accessing internet." ON
"Seastar_TESTING" OFF)
option (Seastar_COMPRESS_DEBUG
"Compress debug info."
ON)
option (Seastar_SPLIT_DWARF
"Use split dwarf."
OFF)
option (Seastar_HEAP_PROFILING
"Enable heap profiling. No effect when Seastar is compiled with the default allocator."
OFF)
option (Seastar_DEFERRED_ACTION_REQUIRE_NOEXCEPT
"Enable noexcept requirement for deferred actions."
ON)
set (Seastar_TEST_TIMEOUT
"300"
CACHE
STRING
"Maximum allowed time for a test to run, in seconds.")
option (BUILD_SHARED_LIBS
"Build seastar library as shared libraries instead of static"
OFF)
# We set the following environment variables
# * ASAN_OPTIONS=disable_coredump=0:abort_on_error=1:detect_stack_use_after_return=1:verify_asan_link_order=0
# By default ASan disables core dumps because they used to be
# huge. This is no longer the case since the shadow memory is
# excluded, so it is safe to enable them.
# Also, by default, to make sure it works as expected, ASan
# verifies if the ASan dynamic runtime is the first DSO in the
# initial library list by calling dl_iterate_phdr(3). But
# Seastar provides this symbol, and its implementation references
# some static variables. So if Seastar is built as a shared
# library, this causes a chicken and egg problem. In other words,
# ASan is loaded first, and it tries to reference a symbol which
# is in turn provided by another shared library which does not
# necessarily ready its static variables yet. And this leads
# to a segfault. So, we have to disable this check when
# "BUILD_SHARED_LIBS" is enabled.
# * UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1
# Fail the test if any undefined behavior is found and use abort
# instead of exit. Using abort is what causes core dumps to be
# produced.
# * BOOST_TEST_CATCH_SYSTEM_ERRORS=no
# Normally the boost test library handles SIGABRT and prevents core
# dumps from being produced.
# This works great with clang and gcc 10.2, but unfortunately not any
# previous gcc.
set (Seastar_ASAN_OPTIONS "disable_coredump=0:abort_on_error=1")
if ((NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) OR
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2))
string (APPEND Seastar_ASAN_OPTIONS ":detect_stack_use_after_return=1")
endif ()
if (BUILD_SHARED_LIBS)
string (APPEND Seastar_ASAN_OPTIONS ":verify_asan_link_order=0")
endif ()
set (Seastar_TEST_ENVIRONMENT
"ASAN_OPTIONS=${Seastar_ASAN_OPTIONS};UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1;BOOST_TEST_CATCH_SYSTEM_ERRORS=no"
CACHE
STRING
"Environment variables for running tests")
option (Seastar_UNUSED_RESULT_ERROR
"Make [[nodiscard]] violations an error (instead of a warning)."
OFF)
set (Seastar_STACK_GUARDS
"DEFAULT"
CACHE
STRING
"Enable stack guards. Can be ON, OFF or DEFAULT (which enables it for non release builds)")
set (Seastar_SANITIZE
"DEFAULT"
CACHE
STRING
"Enable ASAN and UBSAN. Can be ON, OFF or DEFAULT (which enables it for Debug and Sanitize)")
set (Seastar_DEBUG_SHARED_PTR
"DEFAULT"
CACHE
STRING
"Enable shared_ptr debugging. Can be ON, OFF or DEFAULT (which enables it for Debug and Sanitize)")
#
# Useful (non-cache) variables.
#
set (Seastar_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set (Seastar_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set (Seastar_GEN_BINARY_DIR ${Seastar_BINARY_DIR}/gen)
#
# Dependencies.
#
include (SeastarDependencies)
seastar_find_dependencies ()
# Private build dependencies not visible to consumers
find_package (ragel 6.10 REQUIRED)
find_package (Threads REQUIRED)
find_package (PthreadSetName REQUIRED)
find_package (Valgrind REQUIRED)
# TODO(rob) - Add as cooking_ingredient instead
if (Seastar_WITH_OSSL)
find_package (OpenSSL 3.0.0 REQUIRED)
endif()
cmake_dependent_option (Seastar_LOGGER_COMPILE_TIME_FMT
"Enable the compile-time {fmt} check when formatting logging messages" ON
"fmt_VERSION VERSION_GREATER_EQUAL 8.0.0" OFF)
#
# Code generation helpers.
#
function (seastar_generate_protobuf)
set (one_value_args TARGET VAR IN_FILE OUT_DIR)
cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
get_filename_component (in_file_name ${args_IN_FILE} NAME_WE)
get_filename_component (in_file_dir ${args_IN_FILE} DIRECTORY)
set (header_out ${args_OUT_DIR}/${in_file_name}.pb.h)
set (source_out ${args_OUT_DIR}/${in_file_name}.pb.cc)
add_custom_command (
DEPENDS ${args_IN_FILE} protobuf::protoc
OUTPUT ${header_out} ${source_out}
COMMAND ${CMAKE_COMMAND} -E make_directory ${args_OUT_DIR}
COMMAND protobuf::protoc
ARGS --cpp_out=${args_OUT_DIR} -I${in_file_dir} ${args_IN_FILE})
add_custom_target (${args_TARGET}
DEPENDS
${header_out}
${source_out})
set (${args_VAR} ${header_out} ${source_out} PARENT_SCOPE)
endfunction ()
function (seastar_generate_ragel)
set (one_value_args TARGET VAR IN_FILE OUT_FILE)
cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
get_filename_component (out_dir ${args_OUT_FILE} DIRECTORY)
add_custom_command (
DEPENDS ${args_IN_FILE}
OUTPUT ${args_OUT_FILE}
COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
COMMAND ${ragel_RAGEL_EXECUTABLE} -G2 -o ${args_OUT_FILE} ${args_IN_FILE}
COMMAND sed -i -e "'1h;2,$$H;$$!d;g'" -re "'s/static const char _nfa[^;]*;//g'" ${args_OUT_FILE})
add_custom_target (${args_TARGET}
DEPENDS ${args_OUT_FILE})
set (${args_VAR} ${args_OUT_FILE} PARENT_SCOPE)
endfunction ()
function (seastar_generate_swagger)
set (one_value_args TARGET VAR IN_FILE OUT_DIR)
cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
get_filename_component (in_file_name ${args_IN_FILE} NAME)
set (generator ${Seastar_SOURCE_DIR}/scripts/seastar-json2code.py)
set (header_out ${args_OUT_DIR}/${in_file_name}.hh)
set (source_out ${args_OUT_DIR}/${in_file_name}.cc)
add_custom_command (
DEPENDS
${args_IN_FILE}
${generator}
OUTPUT ${header_out} ${source_out}
COMMAND ${CMAKE_COMMAND} -E make_directory ${args_OUT_DIR}
COMMAND ${generator} --create-cc -f ${args_IN_FILE} -o ${header_out})
add_custom_target (${args_TARGET}
DEPENDS
${header_out}
${source_out})
set (${args_VAR} ${header_out} ${source_out} PARENT_SCOPE)
endfunction ()
#
# The `seastar` library.
#
seastar_generate_ragel (
TARGET seastar_http_chunk_parsers
VAR http_chunk_parsers_file
IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/http/chunk_parsers.rl
OUT_FILE ${Seastar_GEN_BINARY_DIR}/include/seastar/http/chunk_parsers.hh)
seastar_generate_ragel (
TARGET seastar_http_request_parser
VAR http_request_parser_file
IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/http/request_parser.rl
OUT_FILE ${Seastar_GEN_BINARY_DIR}/include/seastar/http/request_parser.hh)
seastar_generate_ragel (
TARGET seastar_http_response_parser
VAR http_response_parser_file
IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/http/response_parser.rl
OUT_FILE ${Seastar_GEN_BINARY_DIR}/include/seastar/http/response_parser.hh)
seastar_generate_protobuf (
TARGET seastar_proto_metrics2
VAR proto_metrics2_files
IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/proto/metrics2.proto
OUT_DIR ${Seastar_GEN_BINARY_DIR}/src/proto)
add_library (seastar
${http_chunk_parsers_file}
${http_request_parser_file}
${proto_metrics2_files}
${seastar_dpdk_obj}
include/seastar/core/abort_source.hh
include/seastar/core/alien.hh
include/seastar/core/align.hh
include/seastar/core/aligned_buffer.hh
include/seastar/core/app-template.hh
include/seastar/core/array_map.hh
include/seastar/core/bitops.hh
include/seastar/core/bitset-iter.hh
include/seastar/core/byteorder.hh
include/seastar/core/cacheline.hh
include/seastar/core/checked_ptr.hh
include/seastar/core/chunked_fifo.hh
include/seastar/core/circular_buffer.hh
include/seastar/core/circular_buffer_fixed_capacity.hh
include/seastar/core/condition-variable.hh
include/seastar/core/deleter.hh
include/seastar/core/distributed.hh
include/seastar/core/do_with.hh
include/seastar/core/dpdk_rte.hh
include/seastar/core/enum.hh
include/seastar/core/exception_hacks.hh
include/seastar/core/execution_stage.hh
include/seastar/core/expiring_fifo.hh
include/seastar/core/fair_queue.hh
include/seastar/core/file.hh
include/seastar/core/file-types.hh
include/seastar/core/fsqual.hh
include/seastar/core/fstream.hh
include/seastar/core/function_traits.hh
include/seastar/core/future-util.hh
include/seastar/core/future.hh
include/seastar/core/gate.hh
include/seastar/core/iostream-impl.hh
include/seastar/core/iostream.hh
include/seastar/util/later.hh
include/seastar/core/layered_file.hh
include/seastar/core/linux-aio.hh
include/seastar/core/loop.hh
include/seastar/core/lowres_clock.hh
include/seastar/core/manual_clock.hh
include/seastar/core/map_reduce.hh
include/seastar/core/memory.hh
include/seastar/core/metrics.hh
include/seastar/core/metrics_api.hh
include/seastar/core/metrics_registration.hh
include/seastar/core/metrics_types.hh
include/seastar/core/pipe.hh
include/seastar/core/posix.hh
include/seastar/core/preempt.hh
include/seastar/core/prefetch.hh
include/seastar/core/print.hh
include/seastar/core/prometheus.hh
include/seastar/core/queue.hh
include/seastar/core/ragel.hh
include/seastar/core/reactor.hh
include/seastar/core/report_exception.hh
include/seastar/core/resource.hh
include/seastar/core/rwlock.hh
include/seastar/core/scattered_message.hh
include/seastar/core/scheduling.hh
include/seastar/core/scollectd.hh
include/seastar/core/scollectd_api.hh
include/seastar/core/seastar.hh
include/seastar/core/semaphore.hh
include/seastar/core/shard_id.hh
include/seastar/core/sharded.hh
include/seastar/core/shared_future.hh
include/seastar/core/shared_mutex.hh
include/seastar/core/shared_ptr.hh
include/seastar/core/shared_ptr_debug_helper.hh
include/seastar/core/shared_ptr_incomplete.hh
include/seastar/core/simple-stream.hh
include/seastar/core/slab.hh
include/seastar/core/sleep.hh
include/seastar/core/sstring.hh
include/seastar/core/stall_sampler.hh
include/seastar/core/stream.hh
include/seastar/core/systemwide_memory_barrier.hh
include/seastar/core/task.hh
include/seastar/core/temporary_buffer.hh
include/seastar/core/thread.hh
include/seastar/core/thread_cputime_clock.hh
include/seastar/core/thread_impl.hh
include/seastar/core/timed_out_error.hh
include/seastar/core/timer-set.hh
include/seastar/core/timer.hh
include/seastar/core/transfer.hh
include/seastar/core/unaligned.hh
include/seastar/core/units.hh
include/seastar/core/vector-data-sink.hh
include/seastar/core/weak_ptr.hh
include/seastar/core/when_all.hh
include/seastar/core/with_scheduling_group.hh
include/seastar/core/with_timeout.hh
include/seastar/http/api_docs.hh
include/seastar/http/common.hh
include/seastar/http/exception.hh
include/seastar/http/file_handler.hh
include/seastar/http/function_handlers.hh
include/seastar/http/handlers.hh
include/seastar/http/httpd.hh
include/seastar/http/json_path.hh
include/seastar/http/matcher.hh
include/seastar/http/matchrules.hh
include/seastar/http/mime_types.hh
include/seastar/http/reply.hh
include/seastar/http/request.hh
include/seastar/http/routes.hh
include/seastar/http/short_streams.hh
include/seastar/http/transformers.hh
include/seastar/http/client.hh
include/seastar/json/formatter.hh
include/seastar/json/json_elements.hh
include/seastar/net/api.hh
include/seastar/net/arp.hh
include/seastar/net/byteorder.hh
include/seastar/net/config.hh
include/seastar/net/const.hh
include/seastar/net/dhcp.hh
include/seastar/net/dns.hh
include/seastar/net/dpdk.hh
include/seastar/net/ethernet.hh
include/seastar/net/inet_address.hh
include/seastar/net/ip.hh
include/seastar/net/ip_checksum.hh
include/seastar/net/native-stack.hh
include/seastar/net/net.hh
include/seastar/net/packet-data-source.hh
include/seastar/net/packet-util.hh
include/seastar/net/packet.hh
include/seastar/net/posix-stack.hh
include/seastar/net/proxy.hh
include/seastar/net/socket_defs.hh
include/seastar/net/stack.hh
include/seastar/net/tcp-stack.hh
include/seastar/net/tcp.hh
include/seastar/net/tls.hh
include/seastar/net/toeplitz.hh
include/seastar/net/udp.hh
include/seastar/net/unix_address.hh
include/seastar/net/virtio-interface.hh
include/seastar/net/virtio.hh
include/seastar/rpc/lz4_compressor.hh
include/seastar/rpc/lz4_fragmented_compressor.hh
include/seastar/rpc/multi_algo_compressor_factory.hh
include/seastar/rpc/rpc.hh
include/seastar/rpc/rpc_impl.hh
include/seastar/rpc/rpc_types.hh
include/seastar/util/alloc_failure_injector.hh
include/seastar/util/backtrace.hh
include/seastar/util/concepts.hh
include/seastar/util/bool_class.hh
include/seastar/util/conversions.hh
include/seastar/util/defer.hh
include/seastar/util/eclipse.hh
include/seastar/util/function_input_iterator.hh
include/seastar/util/indirect.hh
include/seastar/util/is_smart_ptr.hh
include/seastar/util/lazy.hh
include/seastar/util/log-cli.hh
include/seastar/util/log-impl.hh
include/seastar/util/log.hh
include/seastar/util/noncopyable_function.hh
include/seastar/util/optimized_optional.hh
include/seastar/util/print_safe.hh
include/seastar/util/process.hh
include/seastar/util/program-options.hh
include/seastar/util/read_first_line.hh
include/seastar/util/reference_wrapper.hh
include/seastar/util/spinlock.hh
include/seastar/util/std-compat.hh
include/seastar/util/transform_iterator.hh
include/seastar/util/tuple_utils.hh
include/seastar/util/variant_utils.hh
include/seastar/util/closeable.hh
include/seastar/util/source_location-compat.hh
include/seastar/util/short_streams.hh
include/seastar/websocket/server.hh
src/core/alien.cc
src/core/file.cc
src/core/fair_queue.cc
src/core/reactor_backend.cc
src/core/thread_pool.cc
src/core/app-template.cc
src/core/cpu_profiler.cc
src/core/dpdk_rte.cc
src/core/exception_hacks.cc
src/core/execution_stage.cc
src/core/file-impl.hh
src/core/fsnotify.cc
src/core/fsqual.cc
src/core/fstream.cc
src/core/future.cc
src/core/future-util.cc
src/core/linux-aio.cc
src/core/memory.cc
src/core/metrics.cc
src/core/on_internal_error.cc
src/core/posix.cc
src/core/prometheus.cc
src/core/program_options.cc
src/core/reactor.cc
src/core/resource.cc
src/core/sharded.cc
src/core/scollectd.cc
src/core/scollectd-impl.hh
src/core/systemwide_memory_barrier.cc
src/core/smp.cc
src/core/sstring.cc
src/core/thread.cc
src/core/uname.cc
src/core/vla.hh
src/core/io_queue.cc
src/core/semaphore.cc
src/core/condition-variable.cc
src/http/api_docs.cc
src/http/common.cc
src/http/file_handler.cc
src/http/httpd.cc
src/http/json_path.cc
src/http/matcher.cc
src/http/mime_types.cc
src/http/reply.cc
src/http/routes.cc
src/http/transformers.cc
src/http/url.cc
src/http/client.cc
src/http/request.cc
src/json/formatter.cc
src/json/json_elements.cc
src/net/arp.cc
src/net/config.cc
src/net/dhcp.cc
src/net/dns.cc
src/net/dpdk.cc
src/net/ethernet.cc
src/net/inet_address.cc
src/net/ip.cc
src/net/ip_checksum.cc
src/net/native-stack-impl.hh
src/net/native-stack.cc
src/net/net.cc
src/net/packet.cc
src/net/posix-stack.cc
src/net/proxy.cc
src/net/socket_address.cc
src/net/stack.cc
src/net/tcp.cc
$<$<NOT:$<BOOL:${Seastar_WITH_OSSL}>>:src/net/tls.cc>
$<$<BOOL:${Seastar_WITH_OSSL}>:src/net/ossl.cc>
src/net/tls-impl.cc
src/net/udp.cc
src/net/unix_address.cc
src/net/virtio.cc
src/rpc/lz4_compressor.cc
src/rpc/lz4_fragmented_compressor.cc
src/rpc/rpc.cc
src/util/alloc_failure_injector.cc
src/util/backtrace.cc
src/util/conversions.cc
src/util/exceptions.cc
src/util/file.cc
src/util/log.cc
src/util/process.cc
src/util/program-options.cc
src/util/read_first_line.cc
src/util/tmp_file.cc
src/util/short_streams.cc
src/websocket/server.cc
)
add_library (Seastar::seastar ALIAS seastar)
add_dependencies (seastar
seastar_http_chunk_parsers
seastar_http_request_parser
seastar_http_response_parser
seastar_proto_metrics2)
target_include_directories (seastar
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${Seastar_GEN_BINARY_DIR}/include>
$<BUILD_INTERFACE:${Seastar_GEN_BINARY_DIR}/src>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src)
set (Seastar_PRIVATE_CXX_FLAGS
-UNDEBUG
-Wall
-Werror
-Wimplicit-fallthrough
-Wdeprecated
-Wno-error=deprecated)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
include (CheckGcc107852)
if (NOT Cxx_Compiler_BZ107852_Free)
list (APPEND Seastar_PRIVATE_CXX_FLAGS
-Wno-error=stringop-overflow
-Wno-error=array-bounds)
endif()
endif ()
if (NOT BUILD_SHARED_LIBS)
list (APPEND Seastar_PRIVATE_CXX_FLAGS -fvisibility=hidden)
endif ()
if (Seastar_COMPRESS_DEBUG)
# -gz doesn't imply -g, so it is safe to add it regardless of debug
# info being enabled.
list (APPEND Seastar_PRIVATE_CXX_FLAGS -gz)
endif ()
target_link_libraries (seastar
PUBLIC
Boost::boost
Boost::program_options
Boost::thread
c-ares::cares
fmt::fmt
lz4::lz4
SourceLocation::source_location
PRIVATE
${CMAKE_DL_LIBS}
$<$<NOT:$<BOOL:${Seastar_WITH_OSSL}>>:GnuTLS::gnutls>
$<$<BOOL:${Seastar_WITH_OSSL}>:OpenSSL::SSL>
$<$<BOOL:${Seastar_WITH_OSSL}>:OpenSSL::Crypto>
StdAtomic::atomic
lksctp-tools::lksctp-tools
protobuf::libprotobuf
rt::rt
ucontext::ucontext
yaml-cpp::yaml-cpp
Threads::Threads)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.26)
target_link_libraries (seastar
PRIVATE
"$<BUILD_LOCAL_INTERFACE:Valgrind::valgrind>")
else ()
target_link_libraries (seastar
PRIVATE
"$<BUILD_INTERFACE:Valgrind::valgrind>")
endif ()
if (Seastar_DPDK)
target_link_libraries (seastar
PRIVATE
DPDK::dpdk)
endif ()
include (TriStateOption)
tri_state_option (${Seastar_SANITIZE}
DEFAULT_BUILD_TYPES "Debug" "Sanitize"
CONDITION condition)
if (condition)
if (NOT Sanitizers_FOUND)
message (FATAL_ERROR "Sanitizers not found!")
endif ()
set (Seastar_Sanitizers_OPTIONS ${Sanitizers_COMPILER_OPTIONS})
target_link_libraries (seastar
PUBLIC
$<${condition}:Sanitizers::address>
$<${condition}:Sanitizers::undefined_behavior>)
endif ()
# We only need valgrind to find uninitialized memory uses, so disable
# the leak sanitizer.
# To test with valgrind run "ctest -T memcheck"
set( MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --leak-check=no --trace-children=yes" )
include (CTest)
if (Seastar_MODULE)
if (POLICY CMP0155)
cmake_policy (SET CMP0155 NEW)
endif ()
include (CxxModulesRules)
add_subdirectory (src)
endif ()
#
# We want asserts enabled on all modes, but cmake defaults to passing
# -DNDEBUG in some modes. We add -UNDEBUG to our private options to
# reenable it. To force asserts off pass -DNDEBUG in
# Seastar_CXX_FLAGS.
#
# To disable -Werror, pass -Wno-error to Seastar_CXX_FLAGS.
#
# We disable _FORTIFY_SOURCE because it generates false positives with longjmp() (src/core/thread.cc)
#
target_compile_options (seastar
PUBLIC
-U_FORTIFY_SOURCE)
target_compile_definitions(seastar
PUBLIC
SEASTAR_API_LEVEL=${Seastar_API_LEVEL}
$<$<BOOL:${Seastar_WITH_OSSL}>:SEASTAR_WITH_TLS_OSSL=1>
$<$<BOOL:${BUILD_SHARED_LIBS}>:SEASTAR_BUILD_SHARED_LIBS>)
target_compile_features(seastar
PUBLIC
cxx_std_${CMAKE_CXX_STANDARD})
include (CheckCXXCompilerFlag)
check_cxx_compiler_flag ("-Wno-maybe-uninitialized -Werror" MaybeUninitialized_FOUND)
if (MaybeUninitialized_FOUND)
target_compile_options (seastar
PUBLIC
# With std::experimental::optional it is easy to hit
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88897. We disable
# -Wmaybe-uninitialized in here since otherwise we would have to
# disable it on many types used inside optional<>.
-Wno-maybe-uninitialized)
endif ()
if (Seastar_SSTRING)
target_compile_definitions (seastar
PUBLIC SEASTAR_SSTRING)
endif ()
if (LinuxMembarrier_FOUND)
list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAS_MEMBARRIER)
target_link_libraries (seastar
PRIVATE LinuxMembarrier::membarrier)
endif ()
tri_state_option (${Seastar_ALLOC_FAILURE_INJECTION}
DEFAULT_BUILD_TYPES "Dev"
CONDITION condition)
if (condition)
target_compile_definitions (seastar
PUBLIC $<${condition}:SEASTAR_ENABLE_ALLOC_FAILURE_INJECTION>)
endif ()
if (Seastar_TASK_BACKTRACE)
target_compile_definitions (seastar
PUBLIC SEASTAR_TASK_BACKTRACE)
endif ()
if (Seastar_DEBUG_ALLOCATIONS)
target_compile_definitions (seastar
PRIVATE SEASTAR_DEBUG_ALLOCATIONS)
endif ()
if (Sanitizers_FIBER_SUPPORT)
list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_ASAN_FIBER_SUPPORT)
endif ()
if (Seastar_ALLOC_PAGE_SIZE)
target_compile_definitions (seastar
PUBLIC SEASTAR_OVERRIDE_ALLOCATOR_PAGE_SIZE=${Seastar_ALLOC_PAGE_SIZE})
endif ()
if (Seastar_LOGGER_COMPILE_TIME_FMT)
target_compile_definitions (seastar
PUBLIC SEASTAR_LOGGER_COMPILE_TIME_FMT)
endif ()
target_compile_definitions (seastar
PUBLIC SEASTAR_SCHEDULING_GROUPS_COUNT=${Seastar_SCHEDULING_GROUPS_COUNT})
if (Seastar_CXX_FLAGS)
list (APPEND Seastar_PRIVATE_CXX_FLAGS ${Seastar_CXX_FLAGS})
endif ()
# When using split dwarf --gdb-index is effectively required since
# otherwise gdb is just too slow. We also want to use split dwarf in
# as many compilation units as possible. So while these flags don't
# have to be public, we don't expect anyone to want to build seastar
# with them and some client code without.
if (Seastar_SPLIT_DWARF)
set (Seastar_SPLIT_DWARF_FLAG "-Wl,--gdb-index")
target_link_libraries (seastar PUBLIC
$<$<NOT:$<CONFIG:Dev>>:${Seastar_SPLIT_DWARF_FLAG}>)
target_compile_options (seastar PUBLIC
$<$<NOT:$<CONFIG:Dev>>:-gsplit-dwarf>)