]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/CMakeLists.txt
import quincy beta 17.1.0
[ceph.git] / ceph / src / seastar / CMakeLists.txt
1 #
2 # This file is open source software, licensed to you under the terms
3 # of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 # distributed with this work for additional information regarding copyright
5 # ownership. You may not use this file except in compliance with the License.
6 #
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17 #
18
19 #
20 # Copyright (C) 2018 Scylladb, Ltd.
21 #
22
23 cmake_minimum_required (VERSION 3.5)
24
25 list (APPEND CMAKE_MODULE_PATH
26 ${CMAKE_CURRENT_SOURCE_DIR}/cmake
27 ${CMAKE_CURRENT_BINARY_DIR})
28
29 include (Cooking OPTIONAL)
30
31 # This variable impacts the way DPDK is configured by cmake-cooking (if DPDK is enabled), so its definition needs to
32 # come before PROJECT.
33 set (Seastar_DPDK_MACHINE
34 "native"
35 CACHE
36 STRING
37 "Configure DPDK for this processor architecture (if `Seastar_DPDK` is enabled). A DPDK code name abbreviation (e.g., ivb)")
38
39 project (Seastar
40 VERSION 1.0
41 LANGUAGES CXX)
42
43 # generic boolean values passed as string, potentially from configure.py
44 set (True_STRING_VALUES "ON" "yes" "Yes" "YES" "true" "True" "TRUE")
45 set (False_STRING_VALUES "OFF" "no" "No" "NO" "false" "False" "FALSE")
46 set (Default_STRING_VALUES "DEFAULT" "default" "Default")
47
48 set (Seastar_ALLOC_FAILURE_INJECTION
49 "DEFAULT"
50 CACHE
51 STRING
52 "Enable failure injection into the Seastar allocator. Can be ON, OFF or DEFAULT (which enables it for Dev mode)")
53
54 option (Seastar_TASK_BACKTRACE
55 "Collect backtrace at deferring points."
56 OFF)
57
58 option (Seastar_DEBUG_ALLOCATIONS
59 "For now just writes 0xab to newly allocated memory"
60 OFF)
61
62 option (Seastar_SSTRING
63 "Use seastar's own string implementation"
64 ON)
65
66 set (Seastar_API_LEVEL
67 "6"
68 CACHE
69 STRING
70 "Seastar compatibility API level (2=server_socket::accept() returns accept_result, 3=make_file_output_stream(), make_file_data_sink() returns future<...>, 4=when_all_succeed returns future<std::tuple<>>, 5=future<T>::get() returns T&&), 6=future is not variadic")
71
72 set_property (CACHE Seastar_API_LEVEL
73 PROPERTY
74 STRINGS 2 3 4 5 6)
75
76 set (Seastar_SCHEDULING_GROUPS_COUNT
77 "16"
78 CACHE
79 STRING
80 "A positive number to set Seastar's reactor number of allowed different scheduling groups.")
81
82 if (NOT Seastar_SCHEDULING_GROUPS_COUNT MATCHES "^[1-9][0-9]*")
83 message(FATAL_ERROR "Seastar_SCHEDULING_GROUPS_COUNT must be a positive number (${Seastar_SCHEDULING_GROUPS_COUNT})")
84 endif()
85
86 #
87 # Add a dev build type.
88 #
89 # All pre-defined build modes include optimizations or debug info,
90 # which make them slow to build. The dev build mode is intended for
91 # fast build/test iteration.
92 #
93
94 if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
95 set (CMAKE_CXX_FLAGS_DEV_OPT_LEVEL "-O2")
96 else ()
97 set (CMAKE_CXX_FLAGS_DEV_OPT_LEVEL "-O1")
98 endif ()
99
100 set (CMAKE_CXX_FLAGS_DEV
101 "${CMAKE_CXX_FLAGS_DEV_OPT_LEVEL}"
102 CACHE
103 STRING
104 "Flags used by the C++ compiler during dev builds."
105 FORCE)
106
107 set (CMAKE_C_FLAGS_DEV
108 "-O1"
109 CACHE
110 STRING
111 "Flags used by the C compiler during dev builds."
112 FORCE)
113
114 set (CMAKE_EXE_LINKER_FLAGS_DEV
115 ""
116 CACHE
117 STRING
118 "Flags used for linking binaries during dev builds."
119 FORCE)
120
121 set (CMAKE_SHARED_LINKER_FLAGS_DEV
122 ""
123 CACHE
124 STRING
125 "Flags used by the shared libraries linker during builds."
126 FORCE)
127
128 mark_as_advanced (
129 CMAKE_CXX_FLAGS_DEV
130 CMAKE_C_FLAGS_DEV
131 CMAKE_EXE_LINKER_FLAGS_DEV
132 CMAKE_SHARED_LINKER_FLAGS_DEV)
133
134 set (CMAKE_CXX_FLAGS_SANITIZE
135 "-Os -g"
136 CACHE
137 STRING
138 "Flags used by the C++ compiler during sanitize builds."
139 FORCE)
140
141 set (CMAKE_C_FLAGS_SANITIZE
142 "-Os -g"
143 CACHE
144 STRING
145 "Flags used by the C compiler during sanitize builds."
146 FORCE)
147
148 set (CMAKE_EXE_LINKER_FLAGS_SANITIZE
149 ""
150 CACHE
151 STRING
152 "Flags used for linking binaries during sanitize builds."
153 FORCE)
154
155 set (CMAKE_SHARED_LINKER_FLAGS_SANITIZE
156 ""
157 CACHE
158 STRING
159 "Flags used by the shared libraries linker during sanitize builds."
160 FORCE)
161
162 mark_as_advanced (
163 CMAKE_CXX_FLAGS_SANITIZE
164 CMAKE_C_FLAGS_SANITIZE
165 CMAKE_EXE_LINKER_FLAGS_SANITIZE
166 CMAKE_SHARED_LINKER_FLAGS_SANITIZE)
167
168 set (CMAKE_BUILD_TYPE
169 "${CMAKE_BUILD_TYPE}"
170 CACHE
171 STRING
172 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Dev Sanitize."
173 FORCE)
174
175 if (NOT CMAKE_BUILD_TYPE)
176 set (CMAKE_BUILD_TYPE "Release")
177 endif ()
178
179 set (Seastar_ALLOC_PAGE_SIZE
180 ""
181 CACHE
182 STRING
183 "Override the Seastar allocator page size, in bytes.")
184
185 option (Seastar_APPS
186 "Enable application targets."
187 ON)
188
189 set (Seastar_CXX_DIALECT
190 "gnu++17"
191 CACHE
192 STRING
193 "Compile Seastar according to the named C++ standard.")
194 if (Seastar_CXX_DIALECT)
195 # extract CXX standard (14/17/...) from Seastar_CXX_DIALECT
196 string(SUBSTRING ${Seastar_CXX_DIALECT} 5 2 STANDARD)
197 set(CMAKE_CXX_STANDARD ${STANDARD})
198 set(CMAKE_CXX_STANDARD_REQUIRED ON)
199 endif ()
200
201 set (Seastar_CXX_FLAGS
202 ""
203 CACHE
204 STRING
205 "Semicolon-separated list of extra compilation flags for Seastar itself.")
206
207 option (Seastar_DEMOS
208 "Enable demonstration targets."
209 ON)
210
211 option (Seastar_DOCS
212 "Enable documentation targets."
213 ON)
214
215 option (Seastar_DPDK
216 "Enable DPDK support."
217 OFF)
218
219 option (Seastar_EXCLUDE_APPS_FROM_ALL
220 "When enabled alongside Seastar_APPS, do not build applications by default."
221 OFF)
222
223 option (Seastar_EXCLUDE_DEMOS_FROM_ALL
224 "When enabled alongside Seastar_DEMOS, do not build demonstrations by default."
225 OFF)
226
227 option (Seastar_EXCLUDE_TESTS_FROM_ALL
228 "When enabled alongside Seastar_TESTING, do not build tests by default."
229 OFF)
230
231 option (Seastar_EXECUTE_ONLY_FAST_TESTS
232 "Only execute tests which run quickly."
233 OFF)
234
235 option (Seastar_HWLOC
236 "Enable hwloc support."
237 ON)
238
239 set (Seastar_JENKINS
240 ""
241 CACHE
242 STRING
243 "If non-empty, the prefix for XML files containing the results of running tests (for Jenkins).")
244
245 set (Seastar_LD_FLAGS
246 ""
247 CACHE
248 STRING
249 "Semicolon-separated list of extra linking flags for Seastar itself.")
250
251 option (Seastar_INSTALL
252 "Install targets."
253 ON)
254
255 option (Seastar_NUMA
256 "Enable NUMA support."
257 ON)
258
259 option (Seastar_TESTING
260 "Enable testing targets."
261 ON)
262
263 option (Seastar_COMPRESS_DEBUG
264 "Compress debug info."
265 ON)
266
267 option (Seastar_SPLIT_DWARF
268 "Use split dwarf."
269 OFF)
270
271 option (Seastar_HEAP_PROFILING
272 "Enable heap profiling. No effect when Seastar is compiled with the default allocator."
273 OFF)
274
275 option (Seastar_DEFERRED_ACTION_REQUIRE_NOEXCEPT
276 "Enable noexcept requirement for deferred actions."
277 ON)
278
279 set (Seastar_TEST_TIMEOUT
280 "300"
281 CACHE
282 STRING
283 "Maximum allowed time for a test to run, in seconds.")
284
285 # We set the following environment variables
286 # * ASAN_OPTIONS=disable_coredump=0:abort_on_error=1:detect_stack_use_after_return=1
287 # By default asan disables core dumps because they used to be
288 # huge. This is no longer the case since the shadow memory is
289 # excluded, so it is safe to enable them.
290 # * UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1
291 # Fail the test if any undefined behavior is found and use abort
292 # instead of exit. Using abort is what causes core dumps to be
293 # produced.
294 # * BOOST_TEST_CATCH_SYSTEM_ERRORS=no
295 # Normally the boost test library handles SIGABRT and prevents core
296 # dumps from being produced.
297
298 # This works great with clang and gcc 10.2, but unfortunately not any
299 # previous gcc.
300 set (Seastar_USE_AFTER_RETURN "")
301 if ((NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) OR
302 (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2))
303 set (Seastar_USE_AFTER_RETURN ":detect_stack_use_after_return=1")
304 endif ()
305
306 set (Seastar_TEST_ENVIRONMENT
307 "ASAN_OPTIONS=disable_coredump=0:abort_on_error=1${Seastar_USE_AFTER_RETURN};UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1;BOOST_TEST_CATCH_SYSTEM_ERRORS=no"
308 CACHE
309 STRING
310 "Environment variables for running tests")
311
312 option (Seastar_UNUSED_RESULT_ERROR
313 "Make [[nodiscard]] violations an error (instead of a warning)."
314 OFF)
315
316 set (Seastar_STACK_GUARDS
317 "DEFAULT"
318 CACHE
319 STRING
320 "Enable stack guards. Can be ON, OFF or DEFAULT (which enables it for non release builds)")
321
322 set (Seastar_SANITIZE
323 "DEFAULT"
324 CACHE
325 STRING
326 "Enable ASAN and UBSAN. Can be ON, OFF or DEFAULT (which enables it for Debug and Sanitize)")
327
328 set (Seastar_DEBUG_SHARED_PTR
329 "DEFAULT"
330 CACHE
331 STRING
332 "Enable shared_ptr debugging. Can be ON, OFF or DEFAULT (which enables it for Debug and Sanitize)")
333
334 # When Seastar is embedded with `add_subdirectory`, disable the non-library targets.
335 if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
336 set (Seastar_APPS OFF)
337 set (Seastar_DEMOS OFF)
338 set (Seastar_DOCS OFF)
339 set (Seastar_INSTALL OFF)
340 set (Seastar_TESTING OFF)
341 endif ()
342
343 #
344 # Useful (non-cache) variables.
345 #
346
347 set (Seastar_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
348 set (Seastar_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
349 set (Seastar_GEN_BINARY_DIR ${Seastar_BINARY_DIR}/gen)
350
351 #
352 # Dependencies.
353 #
354
355 include (SeastarDependencies)
356 seastar_find_dependencies ()
357
358 # Private build dependencies not visible to consumers
359 find_package (ragel 6.10 REQUIRED)
360 find_package (Threads REQUIRED)
361 find_package (PthreadSetName REQUIRED)
362
363 #
364 # Code generation helpers.
365 #
366
367 function (seastar_generate_ragel)
368 set (one_value_args TARGET VAR IN_FILE OUT_FILE)
369 cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
370 get_filename_component (out_dir ${args_OUT_FILE} DIRECTORY)
371
372 add_custom_command (
373 DEPENDS ${args_IN_FILE}
374 OUTPUT ${args_OUT_FILE}
375 COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
376 COMMAND ${ragel_RAGEL_EXECUTABLE} -G2 -o ${args_OUT_FILE} ${args_IN_FILE}
377 COMMAND sed -i -e "'1h;2,$$H;$$!d;g'" -re "'s/static const char _nfa[^;]*;//g'" ${args_OUT_FILE})
378
379 add_custom_target (${args_TARGET}
380 DEPENDS ${args_OUT_FILE})
381
382 set (${args_VAR} ${args_OUT_FILE} PARENT_SCOPE)
383 endfunction ()
384
385 function (seastar_generate_swagger)
386 set (one_value_args TARGET VAR IN_FILE OUT_DIR)
387 cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
388 get_filename_component (in_file_name ${args_IN_FILE} NAME)
389 set (generator ${Seastar_SOURCE_DIR}/scripts/seastar-json2code.py)
390 set (header_out ${args_OUT_DIR}/${in_file_name}.hh)
391 set (source_out ${args_OUT_DIR}/${in_file_name}.cc)
392
393 add_custom_command (
394 DEPENDS
395 ${args_IN_FILE}
396 ${generator}
397 OUTPUT ${header_out} ${source_out}
398 COMMAND ${CMAKE_COMMAND} -E make_directory ${args_OUT_DIR}
399 COMMAND ${generator} --create-cc -f ${args_IN_FILE} -o ${header_out})
400
401 add_custom_target (${args_TARGET}
402 DEPENDS
403 ${header_out}
404 ${source_out})
405
406 set (${args_VAR} ${header_out} ${source_out} PARENT_SCOPE)
407 endfunction ()
408
409 #
410 # The `seastar` library.
411 #
412
413 seastar_generate_ragel (
414 TARGET seastar_http_chunk_parsers
415 VAR http_chunk_parsers_file
416 IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/http/chunk_parsers.rl
417 OUT_FILE ${Seastar_GEN_BINARY_DIR}/include/seastar/http/chunk_parsers.hh)
418
419 seastar_generate_ragel (
420 TARGET seastar_http_request_parser
421 VAR http_request_parser_file
422 IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/http/request_parser.rl
423 OUT_FILE ${Seastar_GEN_BINARY_DIR}/include/seastar/http/request_parser.hh)
424
425 seastar_generate_ragel (
426 TARGET seastar_http_response_parser
427 VAR http_response_parser_file
428 IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/http/response_parser.rl
429 OUT_FILE ${Seastar_GEN_BINARY_DIR}/include/seastar/http/response_parser.hh)
430
431 if (Seastar_DPDK)
432 set (seastar_dpdk_obj seastar-dpdk.o)
433 endif ()
434
435 add_library (seastar STATIC
436 ${http_chunk_parsers_file}
437 ${http_request_parser_file}
438 ${seastar_dpdk_obj}
439 include/seastar/core/abort_source.hh
440 include/seastar/core/alien.hh
441 include/seastar/core/align.hh
442 include/seastar/core/aligned_buffer.hh
443 include/seastar/core/app-template.hh
444 include/seastar/core/array_map.hh
445 include/seastar/core/bitops.hh
446 include/seastar/core/bitset-iter.hh
447 include/seastar/core/byteorder.hh
448 include/seastar/core/cacheline.hh
449 include/seastar/core/checked_ptr.hh
450 include/seastar/core/chunked_fifo.hh
451 include/seastar/core/circular_buffer.hh
452 include/seastar/core/circular_buffer_fixed_capacity.hh
453 include/seastar/core/condition-variable.hh
454 include/seastar/core/deleter.hh
455 include/seastar/core/distributed.hh
456 include/seastar/core/do_with.hh
457 include/seastar/core/dpdk_rte.hh
458 include/seastar/core/enum.hh
459 include/seastar/core/exception_hacks.hh
460 include/seastar/core/execution_stage.hh
461 include/seastar/core/expiring_fifo.hh
462 include/seastar/core/fair_queue.hh
463 include/seastar/core/file.hh
464 include/seastar/core/file-types.hh
465 include/seastar/core/fsqual.hh
466 include/seastar/core/fstream.hh
467 include/seastar/core/function_traits.hh
468 include/seastar/core/future-util.hh
469 include/seastar/core/future.hh
470 include/seastar/core/gate.hh
471 include/seastar/core/iostream-impl.hh
472 include/seastar/core/iostream.hh
473 include/seastar/util/later.hh
474 include/seastar/core/layered_file.hh
475 include/seastar/core/linux-aio.hh
476 include/seastar/core/loop.hh
477 include/seastar/core/lowres_clock.hh
478 include/seastar/core/manual_clock.hh
479 include/seastar/core/map_reduce.hh
480 include/seastar/core/memory.hh
481 include/seastar/core/metrics.hh
482 include/seastar/core/metrics_api.hh
483 include/seastar/core/metrics_registration.hh
484 include/seastar/core/metrics_types.hh
485 include/seastar/core/pipe.hh
486 include/seastar/core/posix.hh
487 include/seastar/core/preempt.hh
488 include/seastar/core/prefetch.hh
489 include/seastar/core/print.hh
490 include/seastar/core/prometheus.hh
491 include/seastar/core/queue.hh
492 include/seastar/core/ragel.hh
493 include/seastar/core/reactor.hh
494 include/seastar/core/report_exception.hh
495 include/seastar/core/resource.hh
496 include/seastar/core/rwlock.hh
497 include/seastar/core/scattered_message.hh
498 include/seastar/core/scheduling.hh
499 include/seastar/core/scollectd.hh
500 include/seastar/core/scollectd_api.hh
501 include/seastar/core/seastar.hh
502 include/seastar/core/semaphore.hh
503 include/seastar/core/sharded.hh
504 include/seastar/core/shared_future.hh
505 include/seastar/core/shared_mutex.hh
506 include/seastar/core/shared_ptr.hh
507 include/seastar/core/shared_ptr_debug_helper.hh
508 include/seastar/core/shared_ptr_incomplete.hh
509 include/seastar/core/simple-stream.hh
510 include/seastar/core/slab.hh
511 include/seastar/core/sleep.hh
512 include/seastar/core/sstring.hh
513 include/seastar/core/stall_sampler.hh
514 include/seastar/core/stream.hh
515 include/seastar/core/systemwide_memory_barrier.hh
516 include/seastar/core/task.hh
517 include/seastar/core/temporary_buffer.hh
518 include/seastar/core/thread.hh
519 include/seastar/core/thread_cputime_clock.hh
520 include/seastar/core/thread_impl.hh
521 include/seastar/core/timed_out_error.hh
522 include/seastar/core/timer-set.hh
523 include/seastar/core/timer.hh
524 include/seastar/core/transfer.hh
525 include/seastar/core/unaligned.hh
526 include/seastar/core/units.hh
527 include/seastar/core/vector-data-sink.hh
528 include/seastar/core/weak_ptr.hh
529 include/seastar/core/when_all.hh
530 include/seastar/core/with_scheduling_group.hh
531 include/seastar/core/with_timeout.hh
532 include/seastar/http/api_docs.hh
533 include/seastar/http/common.hh
534 include/seastar/http/exception.hh
535 include/seastar/http/file_handler.hh
536 include/seastar/http/function_handlers.hh
537 include/seastar/http/handlers.hh
538 include/seastar/http/httpd.hh
539 include/seastar/http/json_path.hh
540 include/seastar/http/matcher.hh
541 include/seastar/http/matchrules.hh
542 include/seastar/http/mime_types.hh
543 include/seastar/http/reply.hh
544 include/seastar/http/request.hh
545 include/seastar/http/routes.hh
546 include/seastar/http/short_streams.hh
547 include/seastar/http/transformers.hh
548 include/seastar/json/formatter.hh
549 include/seastar/json/json_elements.hh
550 include/seastar/net/api.hh
551 include/seastar/net/arp.hh
552 include/seastar/net/byteorder.hh
553 include/seastar/net/config.hh
554 include/seastar/net/const.hh
555 include/seastar/net/dhcp.hh
556 include/seastar/net/dns.hh
557 include/seastar/net/dpdk.hh
558 include/seastar/net/ethernet.hh
559 include/seastar/net/inet_address.hh
560 include/seastar/net/ip.hh
561 include/seastar/net/ip_checksum.hh
562 include/seastar/net/native-stack.hh
563 include/seastar/net/net.hh
564 include/seastar/net/packet-data-source.hh
565 include/seastar/net/packet-util.hh
566 include/seastar/net/packet.hh
567 include/seastar/net/posix-stack.hh
568 include/seastar/net/proxy.hh
569 include/seastar/net/socket_defs.hh
570 include/seastar/net/stack.hh
571 include/seastar/net/tcp-stack.hh
572 include/seastar/net/tcp.hh
573 include/seastar/net/tls.hh
574 include/seastar/net/toeplitz.hh
575 include/seastar/net/udp.hh
576 include/seastar/net/unix_address.hh
577 include/seastar/net/virtio-interface.hh
578 include/seastar/net/virtio.hh
579 include/seastar/rpc/lz4_compressor.hh
580 include/seastar/rpc/lz4_fragmented_compressor.hh
581 include/seastar/rpc/multi_algo_compressor_factory.hh
582 include/seastar/rpc/rpc.hh
583 include/seastar/rpc/rpc_impl.hh
584 include/seastar/rpc/rpc_types.hh
585 include/seastar/util/alloc_failure_injector.hh
586 include/seastar/util/backtrace.hh
587 include/seastar/util/concepts.hh
588 include/seastar/util/bool_class.hh
589 include/seastar/util/conversions.hh
590 include/seastar/util/defer.hh
591 include/seastar/util/eclipse.hh
592 include/seastar/util/function_input_iterator.hh
593 include/seastar/util/gcc6-concepts.hh
594 include/seastar/util/indirect.hh
595 include/seastar/util/is_smart_ptr.hh
596 include/seastar/util/lazy.hh
597 include/seastar/util/log-cli.hh
598 include/seastar/util/log-impl.hh
599 include/seastar/util/log.hh
600 include/seastar/util/noncopyable_function.hh
601 include/seastar/util/optimized_optional.hh
602 include/seastar/util/print_safe.hh
603 include/seastar/util/program-options.hh
604 include/seastar/util/read_first_line.hh
605 include/seastar/util/reference_wrapper.hh
606 include/seastar/util/spinlock.hh
607 include/seastar/util/std-compat.hh
608 include/seastar/util/transform_iterator.hh
609 include/seastar/util/tuple_utils.hh
610 include/seastar/util/variant_utils.hh
611 include/seastar/util/closeable.hh
612 include/seastar/util/source_location-compat.hh
613 include/seastar/util/short_streams.hh
614 include/seastar/websocket/server.hh
615 src/core/alien.cc
616 src/core/file.cc
617 src/core/fair_queue.cc
618 src/core/reactor_backend.cc
619 src/core/thread_pool.cc
620 src/core/app-template.cc
621 src/core/dpdk_rte.cc
622 src/core/exception_hacks.cc
623 src/core/execution_stage.cc
624 src/core/file-impl.hh
625 src/core/fsnotify.cc
626 src/core/fsqual.cc
627 src/core/fstream.cc
628 src/core/future.cc
629 src/core/future-util.cc
630 src/core/linux-aio.cc
631 src/core/memory.cc
632 src/core/metrics.cc
633 src/core/on_internal_error.cc
634 src/core/posix.cc
635 src/core/prometheus.cc
636 src/core/program_options.cc
637 src/core/reactor.cc
638 src/core/resource.cc
639 src/core/sharded.cc
640 src/core/scollectd.cc
641 src/core/scollectd-impl.hh
642 src/core/systemwide_memory_barrier.cc
643 src/core/smp.cc
644 src/core/sstring.cc
645 src/core/thread.cc
646 src/core/uname.cc
647 src/core/vla.hh
648 src/core/io_queue.cc
649 src/core/semaphore.cc
650 src/core/condition-variable.cc
651 src/http/api_docs.cc
652 src/http/common.cc
653 src/http/file_handler.cc
654 src/http/httpd.cc
655 src/http/json_path.cc
656 src/http/matcher.cc
657 src/http/mime_types.cc
658 src/http/reply.cc
659 src/http/routes.cc
660 src/http/transformers.cc
661 src/json/formatter.cc
662 src/json/json_elements.cc
663 src/net/arp.cc
664 src/net/config.cc
665 src/net/dhcp.cc
666 src/net/dns.cc
667 src/net/dpdk.cc
668 src/net/ethernet.cc
669 src/net/inet_address.cc
670 src/net/ip.cc
671 src/net/ip_checksum.cc
672 src/net/native-stack-impl.hh
673 src/net/native-stack.cc
674 src/net/net.cc
675 src/net/packet.cc
676 src/net/posix-stack.cc
677 src/net/proxy.cc
678 src/net/socket_address.cc
679 src/net/stack.cc
680 src/net/tcp.cc
681 src/net/tls.cc
682 src/net/udp.cc
683 src/net/unix_address.cc
684 src/net/virtio.cc
685 src/rpc/lz4_compressor.cc
686 src/rpc/lz4_fragmented_compressor.cc
687 src/rpc/rpc.cc
688 src/util/alloc_failure_injector.cc
689 src/util/backtrace.cc
690 src/util/conversions.cc
691 src/util/exceptions.cc
692 src/util/file.cc
693 src/util/log.cc
694 src/util/program-options.cc
695 src/util/read_first_line.cc
696 src/util/tmp_file.cc
697 src/util/short_streams.cc
698 src/websocket/server.cc
699 )
700
701 add_library (Seastar::seastar ALIAS seastar)
702
703 add_dependencies (seastar
704 seastar_http_chunk_parsers
705 seastar_http_request_parser
706 seastar_http_response_parser)
707
708 target_include_directories (seastar
709 PUBLIC
710 $<INSTALL_INTERFACE:include>
711 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
712 $<BUILD_INTERFACE:${Seastar_GEN_BINARY_DIR}/include>
713 PRIVATE
714 ${CMAKE_CURRENT_SOURCE_DIR}/src
715 ${Seastar_GEN_BINARY_DIR}/src)
716
717 set (Seastar_PRIVATE_CXX_FLAGS
718 -fvisibility=hidden
719 -UNDEBUG
720 -Wall
721 -Werror
722 -Wno-array-bounds # Disabled because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93437
723 -Wno-error=deprecated-declarations)
724
725 if (Seastar_COMPRESS_DEBUG)
726 # -gz doesn't imply -g, so it is safe to add it regardless of debug
727 # info being enabled.
728 list (APPEND Seastar_PRIVATE_CXX_FLAGS -gz)
729 endif()
730
731 target_link_libraries (seastar
732 PUBLIC
733 Boost::boost
734 Boost::program_options
735 Boost::thread
736 c-ares::c-ares
737 cryptopp::cryptopp
738 fmt::fmt
739 lz4::lz4
740 PRIVATE
741 ${CMAKE_DL_LIBS}
742 GnuTLS::gnutls
743 StdAtomic::atomic
744 lksctp-tools::lksctp-tools
745 rt::rt
746 yaml-cpp::yaml-cpp
747 Threads::Threads)
748
749 set (Seastar_SANITIZE_MODES "Debug" "Sanitize")
750 if ((Seastar_SANITIZE STREQUAL "ON") OR
751 ((Seastar_SANITIZE STREQUAL "DEFAULT") AND
752 (CMAKE_BUILD_TYPE IN_LIST Seastar_SANITIZE_MODES)))
753 if (NOT Sanitizers_FOUND)
754 message (FATAL_ERROR "Sanitizers not found!")
755 endif ()
756 set (Seastar_Sanitizers_OPTIONS ${Sanitizers_COMPILER_OPTIONS})
757 target_link_libraries (seastar
758 PUBLIC
759 Sanitizers::address
760 Sanitizers::undefined_behavior)
761 endif ()
762
763 # We only need valgrind to find uninitialized memory uses, so disable
764 # the leak sanitizer.
765 # To test with valgrind run "ctest -T memcheck"
766 set( MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --leak-check=no --trace-children=yes" )
767 include (CTest)
768
769 #
770 # We want asserts enabled on all modes, but cmake defaults to passing
771 # -DNDEBUG in some modes. We add -UNDEBUG to our private options to
772 # reenable it. To force asserts off pass -DNDEBUG in
773 # Seastar_CXX_FLAGS.
774 #
775 # To disable -Werror, pass -Wno-error to Seastar_CXX_FLAGS.
776 #
777 # We disable _FORTIFY_SOURCE because it generates false positives with longjmp() (src/core/thread.cc)
778 #
779
780 target_compile_options (seastar
781 PUBLIC
782 $<$<COMPILE_LANGUAGE:CXX>:-std=${Seastar_CXX_DIALECT}>
783 -U_FORTIFY_SOURCE)
784
785 target_compile_definitions(seastar
786 PUBLIC
787 SEASTAR_API_LEVEL=${Seastar_API_LEVEL})
788
789 function (seastar_supports_flag flag var)
790 set (CMAKE_REQUIRED_FLAGS "${flag}")
791 check_cxx_source_compiles ("int main() { return 0; }" tmp_${var})
792 set (${var} ${tmp_${var}} PARENT_SCOPE)
793 endfunction ()
794
795 seastar_supports_flag ("-Wno-maybe-uninitialized -Werror" MaybeUninitialized_FOUND)
796 if (MaybeUninitialized_FOUND)
797 target_compile_options (seastar
798 PUBLIC
799 # With std::experimental::optional it is easy to hit
800 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88897. We disable
801 # -Wmaybe-uninitialized in here since otherwise we would have to
802 # disable it on many types used inside optional<>.
803 -Wno-maybe-uninitialized)
804 endif ()
805
806 if (Seastar_SSTRING)
807 target_compile_options (seastar PUBLIC -DSEASTAR_SSTRING)
808 endif ()
809
810 if (LinuxMembarrier_FOUND)
811 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAS_MEMBARRIER)
812
813 target_link_libraries (seastar
814 PRIVATE LinuxMembarrier::membarrier)
815 endif ()
816
817 set (Seastar_ALLOC_FAILURE_INJECTION_MODES "Dev")
818 if ((Seastar_ALLOC_FAILURE_INJECTION IN_LIST True_STRING_VALUES) OR
819 ((Seastar_ALLOC_FAILURE_INJECTION STREQUAL "DEFAULT") AND
820 (CMAKE_BUILD_TYPE IN_LIST Seastar_ALLOC_FAILURE_INJECTION_MODES)))
821 target_compile_definitions (seastar
822 PUBLIC SEASTAR_ENABLE_ALLOC_FAILURE_INJECTION)
823 endif ()
824
825 if (Seastar_TASK_BACKTRACE)
826 target_compile_definitions (seastar
827 PUBLIC SEASTAR_TASK_BACKTRACE)
828 endif ()
829
830 if (Seastar_DEBUG_ALLOCATIONS)
831 target_compile_definitions (seastar
832 PRIVATE SEASTAR_DEBUG_ALLOCATIONS)
833 endif ()
834
835 if (Sanitizers_FIBER_SUPPORT)
836 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_ASAN_FIBER_SUPPORT)
837 endif ()
838
839 if (Seastar_ALLOC_PAGE_SIZE)
840 target_compile_definitions (seastar
841 PUBLIC SEASTAR_OVERRIDE_ALLOCATOR_PAGE_SIZE=${Seastar_ALLOC_PAGE_SIZE})
842 endif ()
843
844 target_compile_definitions (seastar
845 PUBLIC SEASTAR_SCHEDULING_GROUPS_COUNT=${Seastar_SCHEDULING_GROUPS_COUNT})
846
847 if (Seastar_CXX_FLAGS)
848 list (APPEND Seastar_PRIVATE_CXX_FLAGS ${Seastar_CXX_FLAGS})
849 endif ()
850
851 # When using split dwarf --gdb-index is effectively required since
852 # otherwise gdb is just too slow. We also want to use split dwarf in
853 # as many compilation units as possible. So while these flags don't
854 # have to be public, we don't expect anyone to want to build seastar
855 # with them and some client code without.
856 if (Seastar_SPLIT_DWARF AND (NOT (CMAKE_BUILD_TYPE STREQUAL "Dev")))
857 set (Seastar_SPLIT_DWARF_FLAG "-Wl,--gdb-index")
858 target_link_libraries (seastar PUBLIC ${Seastar_SPLIT_DWARF_FLAG})
859 target_compile_options (seastar PUBLIC "-gsplit-dwarf")
860 endif ()
861
862 if (Seastar_HEAP_PROFILING)
863 set_property (
864 SOURCE "src/core/memory.cc"
865 PROPERTY
866 COMPILE_DEFINITIONS SEASTAR_HEAPPROF)
867 endif ()
868
869 if (Seastar_DEFERRED_ACTION_REQUIRE_NOEXCEPT)
870 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_DEFERRED_ACTION_REQUIRE_NOEXCEPT)
871 endif ()
872
873 if (Seastar_DPDK)
874 if (NOT dpdk_FOUND)
875 message (FATAL_ERROR "dpdk support is enabled but it is not available!")
876 endif ()
877
878 #
879 # The DPDK architecture needs to be transitively applied to consumers of Seastar as well.
880 #
881
882 set (Seastar_ARCH_FOR_native "native")
883 set (Seastar_ARCH_FOR_nhm "nehalem")
884 set (Seastar_ARCH_FOR_wsm "westmere")
885 set (Seastar_ARCH_FOR_snb "sandybridge")
886 set (Seastar_ARCH_FOR_ivb "ivybridge")
887 set (Seastar_ARCH_FOR_armv8a "armv8-a")
888 set (Seastar_ARCH ${Seastar_ARCH_FOR_${Seastar_DPDK_MACHINE}})
889
890 if (NOT Seastar_ARCH)
891 message (FATAL_ERROR "Unrecognized DPDK machine identifier: ${Seastar_DPDK_MACHINE}")
892 endif ()
893
894 target_compile_options (seastar
895 PUBLIC -march=${Seastar_ARCH})
896
897 target_compile_definitions (seastar
898 PUBLIC SEASTAR_HAVE_DPDK)
899
900 # No pmd driver code will be pulled in without "--whole-archive". To
901 # avoid exposing that to seastar users, combine dpdk into a single
902 # .o file.
903 add_custom_command (
904 OUTPUT seastar-dpdk.o
905 COMMAND ld -r -o seastar-dpdk.o --whole-archive ${dpdk_LIBRARIES} --no-whole-archive
906 )
907
908 # This just provides the include path to cmake
909 target_link_libraries (seastar
910 PUBLIC dpdk::dpdk)
911 endif ()
912
913 if (Seastar_HWLOC)
914 if (NOT hwloc_FOUND)
915 message (FATAL_ERROR "`hwloc` support is enabled but it is not available!")
916 endif ()
917
918 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_HWLOC)
919
920 target_link_libraries (seastar
921 PRIVATE hwloc::hwloc)
922 endif ()
923
924 if (Seastar_LD_FLAGS)
925 # In newer versions of CMake, there is `target_link_options`.
926 target_link_libraries (seastar
927 PRIVATE ${Seastar_LD_FLAGS})
928 endif ()
929
930 if (Seastar_NUMA)
931 if (NOT numactl_FOUND)
932 message (FATAL_ERROR "NUMA support is enabled but `numactl` is not available!")
933 endif ()
934
935 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_NUMA)
936
937 target_link_libraries (seastar
938 PRIVATE numactl::numactl)
939 endif ()
940
941 if (lz4_HAVE_COMPRESS_DEFAULT)
942 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_LZ4_COMPRESS_DEFAULT)
943 endif ()
944
945 seastar_supports_flag ("-Werror=unused-result" ErrorUnused_FOUND)
946 if (ErrorUnused_FOUND)
947 if (Seastar_UNUSED_RESULT_ERROR)
948 target_compile_options (seastar
949 PUBLIC -Werror=unused-result)
950 else()
951 target_compile_options (seastar
952 PUBLIC -Wno-error=unused-result)
953 endif ()
954 endif ()
955
956 seastar_supports_flag ("-Wno-error=#warnings" ErrorWarnings_FOUND)
957 if (ErrorWarnings_FOUND)
958 target_compile_options (seastar
959 PUBLIC "-Wno-error=#warnings")
960 endif ()
961
962 if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Sanitize"))
963 target_compile_definitions (seastar
964 PUBLIC
965 SEASTAR_DEBUG
966 SEASTAR_DEFAULT_ALLOCATOR
967 SEASTAR_SHUFFLE_TASK_QUEUE)
968 endif ()
969
970 set (Seastar_DEBUG_SHARED_PTR_MODES "Debug" "Sanitize")
971 if (Seastar_DEBUG_SHARED_PTR IN_LIST True_STRING_VALUES OR
972 ((Seastar_DEBUG_SHARED_PTR IN_LIST Default_STRING_VALUES) AND
973 (CMAKE_BUILD_TYPE IN_LIST Seastar_DEBUG_SHARED_PTR_MODES)))
974 target_compile_definitions (seastar
975 PUBLIC
976 SEASTAR_DEBUG_SHARED_PTR)
977 endif ()
978
979 set (Seastar_STACK_GUARD_MODES "Debug" "Sanitize" "Dev")
980 if ((Seastar_STACK_GUARDS STREQUAL "ON") OR
981 ((Seastar_STACK_GUARDS STREQUAL "DEFAULT") AND
982 (CMAKE_BUILD_TYPE IN_LIST Seastar_STACK_GUARD_MODES)))
983 # check for -fstack-clash-protection together with -Werror, because
984 # otherwise clang can soft-fail (return 0 but emit a warning) instead.
985 seastar_supports_flag ("-fstack-clash-protection -Werror" StackClashProtection_FOUND)
986 if (StackClashProtection_FOUND)
987 target_compile_options (seastar
988 PUBLIC
989 -fstack-clash-protection)
990 endif ()
991 target_compile_definitions (seastar
992 PRIVATE
993 SEASTAR_THREAD_STACK_GUARDS)
994 endif ()
995
996 if ((CMAKE_BUILD_TYPE STREQUAL "Dev") OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
997 target_compile_definitions (seastar
998 PUBLIC
999 SEASTAR_TYPE_ERASE_MORE)
1000 endif ()
1001
1002 target_compile_definitions (seastar
1003 PRIVATE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
1004
1005 target_compile_options (seastar
1006 PRIVATE ${Seastar_PRIVATE_CXX_FLAGS})
1007
1008 add_library (seastar_private INTERFACE)
1009
1010 target_compile_definitions (seastar_private
1011 INTERFACE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
1012
1013 target_compile_options (seastar_private
1014 INTERFACE ${Seastar_PRIVATE_CXX_FLAGS})
1015
1016 target_link_libraries (seastar_private
1017 INTERFACE seastar)
1018
1019 #
1020 # The testing library.
1021 #
1022
1023 if (Seastar_INSTALL OR Seastar_TESTING)
1024 add_library (seastar_testing
1025 include/seastar/testing/entry_point.hh
1026 include/seastar/testing/exchanger.hh
1027 include/seastar/testing/random.hh
1028 include/seastar/testing/seastar_test.hh
1029 include/seastar/testing/test_case.hh
1030 include/seastar/testing/test_runner.hh
1031 include/seastar/testing/thread_test_case.hh
1032 src/testing/entry_point.cc
1033 src/testing/random.cc
1034 src/testing/seastar_test.cc
1035 src/testing/test_runner.cc)
1036
1037 add_library (Seastar::seastar_testing ALIAS seastar_testing)
1038
1039 target_compile_definitions (seastar_testing
1040 PUBLIC BOOST_TEST_DYN_LINK
1041 PRIVATE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
1042
1043 target_compile_options (seastar_testing
1044 PRIVATE ${Seastar_PRIVATE_CXX_FLAGS})
1045
1046 target_link_libraries (seastar_testing
1047 PUBLIC
1048 Boost::unit_test_framework
1049 seastar)
1050
1051 add_library(seastar_perf_testing
1052 src/testing/random.cc
1053 include/seastar/testing/perf_tests.hh
1054 tests/perf/perf_tests.cc)
1055 add_library (Seastar::seastar_perf_testing ALIAS seastar_perf_testing)
1056 target_compile_definitions (seastar_perf_testing
1057 PRIVATE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
1058 target_compile_options (seastar_perf_testing
1059 PRIVATE ${Seastar_PRIVATE_CXX_FLAGS})
1060 target_link_libraries (seastar_perf_testing
1061 PUBLIC
1062 seastar)
1063
1064 endif ()
1065
1066 #
1067 # The tests themselves.
1068 #
1069
1070 if (Seastar_TESTING)
1071 enable_testing ()
1072
1073 if (Seastar_EXCLUDE_TESTS_FROM_ALL)
1074 set (exclude EXCLUDE_FROM_ALL)
1075 else ()
1076 set (exclude "")
1077 endif ()
1078
1079 add_subdirectory (tests ${exclude})
1080 endif ()
1081
1082 #
1083 # Demonstrations.
1084 #
1085
1086 if (Seastar_DEMOS)
1087 if (Seastar_EXCLUDE_DEMOS_FROM_ALL)
1088 set (exclude EXCLUDE_FROM_ALL)
1089 else ()
1090 set (exclude "")
1091 endif ()
1092
1093 add_subdirectory (demos ${exclude})
1094 endif ()
1095
1096 #
1097 # Documentation.
1098 #
1099
1100 if (Seastar_DOCS)
1101 add_subdirectory (doc)
1102 endif ()
1103
1104 #
1105 # Applications.
1106 #
1107
1108 if (Seastar_APPS)
1109 if (Seastar_EXCLUDE_APPS_FROM_ALL)
1110 set (exclude EXCLUDE_FROM_ALL)
1111 else ()
1112 set (exclude "")
1113 endif ()
1114
1115 add_subdirectory (apps ${exclude})
1116 endif ()
1117
1118 #
1119 # Installation and export.
1120 #
1121
1122 if (Seastar_INSTALL)
1123 #
1124 # pkg-config generation.
1125 #
1126 # Note that unlike the CMake "config module", this description is not relocatable because
1127 # some dependencies do not natively support pkg-config.
1128 #
1129
1130 # Necessary here for pkg-config.
1131 include (GNUInstallDirs)
1132
1133 # Set paths in pkg-config files for installation.
1134 set (Seastar_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
1135 set (Seastar_PKG_CONFIG_LIBDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
1136 set (Seastar_PKG_CONFIG_SEASTAR_INCLUDE_FLAGS "-I${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}")
1137
1138 configure_file (
1139 ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/seastar.pc.in
1140 ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar-install.pc.in
1141 @ONLY)
1142
1143 configure_file (
1144 ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/seastar-testing.pc.in
1145 ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar-testing-install.pc.in
1146 @ONLY)
1147
1148 # Set paths in pkg-config files for direct use in the build directory.
1149 set (Seastar_PKG_CONFIG_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
1150 set (Seastar_PKG_CONFIG_LIBDIR ${CMAKE_CURRENT_BINARY_DIR})
1151 set (Seastar_PKG_CONFIG_SEASTAR_INCLUDE_FLAGS "-I${CMAKE_CURRENT_SOURCE_DIR}/include -I${CMAKE_CURRENT_BINARY_DIR}/gen/include")
1152
1153 configure_file (
1154 ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/seastar.pc.in
1155 ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar.pc.in
1156 @ONLY)
1157
1158 configure_file (
1159 ${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/seastar-testing.pc.in
1160 ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar-testing.pc.in
1161 @ONLY)
1162
1163 file (GENERATE
1164 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/seastar.pc
1165 INPUT ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar.pc.in)
1166
1167 file (GENERATE
1168 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/seastar-testing.pc
1169 INPUT ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar-testing.pc.in)
1170
1171 file (GENERATE
1172 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/seastar-install.pc
1173 INPUT ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar-install.pc.in)
1174
1175 file (GENERATE
1176 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/seastar-testing-install.pc
1177 INPUT ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/seastar-testing-install.pc.in)
1178
1179 include (CMakePackageConfigHelpers)
1180 set (install_cmakedir ${CMAKE_INSTALL_LIBDIR}/cmake/Seastar)
1181
1182 install (
1183 DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
1184 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
1185
1186 install (
1187 DIRECTORY ${Seastar_GEN_BINARY_DIR}/include/
1188 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
1189
1190 install (
1191 PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/seastar-json2code.py
1192 DESTINATION ${CMAKE_INSTALL_BINDIR})
1193
1194 install (
1195 TARGETS
1196 seastar
1197 seastar_testing
1198 seastar_perf_testing
1199 EXPORT seastar-export
1200 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
1201 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
1202
1203 install (
1204 EXPORT seastar-export
1205 FILE SeastarTargets.cmake
1206 NAMESPACE Seastar::
1207 DESTINATION ${install_cmakedir})
1208
1209 write_basic_package_version_file (
1210 ${CMAKE_CURRENT_BINARY_DIR}/SeastarConfigVersion.cmake
1211 VERSION ${PROJECT_VERSION}
1212 COMPATIBILITY ExactVersion)
1213
1214 configure_package_config_file (
1215 ${CMAKE_CURRENT_LIST_DIR}/cmake/SeastarConfig.cmake.in
1216 ${CMAKE_CURRENT_BINARY_DIR}/SeastarConfig.cmake
1217 INSTALL_DESTINATION ${install_cmakedir})
1218
1219 install (
1220 FILES
1221 ${CMAKE_CURRENT_BINARY_DIR}/SeastarConfig.cmake
1222 ${CMAKE_CURRENT_BINARY_DIR}/SeastarConfigVersion.cmake
1223 DESTINATION ${install_cmakedir})
1224
1225 install (
1226 FILES
1227 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindConcepts.cmake
1228 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGnuTLS.cmake
1229 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLinuxMembarrier.cmake
1230 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindSanitizers.cmake
1231 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindStdAtomic.cmake
1232 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findc-ares.cmake
1233 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findcryptopp.cmake
1234 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Finddpdk.cmake
1235 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findhwloc.cmake
1236 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findlksctp-tools.cmake
1237 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findlz4.cmake
1238 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findnumactl.cmake
1239 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findragel.cmake
1240 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findrt.cmake
1241 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findyaml-cpp.cmake
1242 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/SeastarDependencies.cmake
1243 DESTINATION ${install_cmakedir})
1244
1245 install (
1246 DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/cmake/code_tests
1247 DESTINATION ${install_cmakedir})
1248
1249 install (
1250 FILES ${CMAKE_CURRENT_BINARY_DIR}/seastar-install.pc
1251 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
1252 RENAME seastar.pc)
1253
1254 install (
1255 FILES ${CMAKE_CURRENT_BINARY_DIR}/seastar-testing-install.pc
1256 DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
1257 RENAME seastar-testing.pc)
1258
1259 #
1260 # Export targets from the build tree for the user package registry.
1261 #
1262
1263 export (
1264 EXPORT seastar-export
1265 FILE ${CMAKE_CURRENT_BINARY_DIR}/SeastarTargets.cmake
1266 NAMESPACE Seastar::)
1267
1268 export (PACKAGE Seastar)
1269
1270 #
1271 # Packaging.
1272 #
1273
1274 set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
1275 set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
1276 set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
1277
1278 include (CPack)
1279 endif ()