]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/CMakeLists.txt
import quincy beta 17.1.0
[ceph.git] / ceph / src / seastar / CMakeLists.txt
CommitLineData
11fdf7f2
TL
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
23cmake_minimum_required (VERSION 3.5)
24
9f95a23c
TL
25list (APPEND CMAKE_MODULE_PATH
26 ${CMAKE_CURRENT_SOURCE_DIR}/cmake
27 ${CMAKE_CURRENT_BINARY_DIR})
28
11fdf7f2
TL
29include (Cooking OPTIONAL)
30
9f95a23c
TL
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.
33set (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
11fdf7f2
TL
39project (Seastar
40 VERSION 1.0
41 LANGUAGES CXX)
42
f67539c2
TL
43# generic boolean values passed as string, potentially from configure.py
44set (True_STRING_VALUES "ON" "yes" "Yes" "YES" "true" "True" "TRUE")
45set (False_STRING_VALUES "OFF" "no" "No" "NO" "false" "False" "FALSE")
46set (Default_STRING_VALUES "DEFAULT" "default" "Default")
47
48set (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
54option (Seastar_TASK_BACKTRACE
55 "Collect backtrace at deferring points."
11fdf7f2
TL
56 OFF)
57
f67539c2
TL
58option (Seastar_DEBUG_ALLOCATIONS
59 "For now just writes 0xab to newly allocated memory"
9f95a23c
TL
60 OFF)
61
f67539c2
TL
62option (Seastar_SSTRING
63 "Use seastar's own string implementation"
64 ON)
65
9f95a23c 66set (Seastar_API_LEVEL
f67539c2 67 "6"
9f95a23c
TL
68 CACHE
69 STRING
f67539c2 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")
9f95a23c
TL
71
72set_property (CACHE Seastar_API_LEVEL
73 PROPERTY
f67539c2 74 STRINGS 2 3 4 5 6)
9f95a23c 75
20effc67
TL
76set (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
82if (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})")
84endif()
85
11fdf7f2
TL
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
20effc67
TL
94if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
95 set (CMAKE_CXX_FLAGS_DEV_OPT_LEVEL "-O2")
96else ()
97 set (CMAKE_CXX_FLAGS_DEV_OPT_LEVEL "-O1")
98endif ()
99
11fdf7f2 100set (CMAKE_CXX_FLAGS_DEV
20effc67 101 "${CMAKE_CXX_FLAGS_DEV_OPT_LEVEL}"
11fdf7f2
TL
102 CACHE
103 STRING
104 "Flags used by the C++ compiler during dev builds."
105 FORCE)
106
107set (CMAKE_C_FLAGS_DEV
108 "-O1"
109 CACHE
110 STRING
111 "Flags used by the C compiler during dev builds."
112 FORCE)
113
114set (CMAKE_EXE_LINKER_FLAGS_DEV
115 ""
116 CACHE
117 STRING
118 "Flags used for linking binaries during dev builds."
119 FORCE)
120
121set (CMAKE_SHARED_LINKER_FLAGS_DEV
122 ""
123 CACHE
124 STRING
125 "Flags used by the shared libraries linker during builds."
126 FORCE)
127
128mark_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
9f95a23c
TL
134set (CMAKE_CXX_FLAGS_SANITIZE
135 "-Os -g"
136 CACHE
137 STRING
138 "Flags used by the C++ compiler during sanitize builds."
139 FORCE)
140
141set (CMAKE_C_FLAGS_SANITIZE
142 "-Os -g"
143 CACHE
144 STRING
145 "Flags used by the C compiler during sanitize builds."
146 FORCE)
147
148set (CMAKE_EXE_LINKER_FLAGS_SANITIZE
149 ""
150 CACHE
151 STRING
152 "Flags used for linking binaries during sanitize builds."
153 FORCE)
154
155set (CMAKE_SHARED_LINKER_FLAGS_SANITIZE
156 ""
157 CACHE
158 STRING
159 "Flags used by the shared libraries linker during sanitize builds."
160 FORCE)
161
162mark_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
11fdf7f2
TL
168set (CMAKE_BUILD_TYPE
169 "${CMAKE_BUILD_TYPE}"
170 CACHE
171 STRING
9f95a23c 172 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Dev Sanitize."
11fdf7f2
TL
173 FORCE)
174
9f95a23c
TL
175if (NOT CMAKE_BUILD_TYPE)
176 set (CMAKE_BUILD_TYPE "Release")
177endif ()
178
11fdf7f2
TL
179set (Seastar_ALLOC_PAGE_SIZE
180 ""
181 CACHE
182 STRING
183 "Override the Seastar allocator page size, in bytes.")
184
185option (Seastar_APPS
186 "Enable application targets."
187 ON)
188
189set (Seastar_CXX_DIALECT
190 "gnu++17"
191 CACHE
192 STRING
193 "Compile Seastar according to the named C++ standard.")
20effc67
TL
194if (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)
199endif ()
11fdf7f2
TL
200
201set (Seastar_CXX_FLAGS
202 ""
203 CACHE
204 STRING
205 "Semicolon-separated list of extra compilation flags for Seastar itself.")
206
207option (Seastar_DEMOS
208 "Enable demonstration targets."
209 ON)
210
211option (Seastar_DOCS
212 "Enable documentation targets."
213 ON)
214
215option (Seastar_DPDK
216 "Enable DPDK support."
217 OFF)
218
11fdf7f2
TL
219option (Seastar_EXCLUDE_APPS_FROM_ALL
220 "When enabled alongside Seastar_APPS, do not build applications by default."
221 OFF)
222
223option (Seastar_EXCLUDE_DEMOS_FROM_ALL
224 "When enabled alongside Seastar_DEMOS, do not build demonstrations by default."
225 OFF)
226
227option (Seastar_EXCLUDE_TESTS_FROM_ALL
228 "When enabled alongside Seastar_TESTING, do not build tests by default."
229 OFF)
230
231option (Seastar_EXECUTE_ONLY_FAST_TESTS
232 "Only execute tests which run quickly."
233 OFF)
234
11fdf7f2
TL
235option (Seastar_HWLOC
236 "Enable hwloc support."
237 ON)
238
239set (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
245set (Seastar_LD_FLAGS
246 ""
247 CACHE
248 STRING
249 "Semicolon-separated list of extra linking flags for Seastar itself.")
250
251option (Seastar_INSTALL
252 "Install targets."
253 ON)
254
255option (Seastar_NUMA
256 "Enable NUMA support."
257 ON)
258
11fdf7f2
TL
259option (Seastar_TESTING
260 "Enable testing targets."
261 ON)
262
9f95a23c
TL
263option (Seastar_COMPRESS_DEBUG
264 "Compress debug info."
265 ON)
266
267option (Seastar_SPLIT_DWARF
268 "Use split dwarf."
269 OFF)
270
271option (Seastar_HEAP_PROFILING
272 "Enable heap profiling. No effect when Seastar is compiled with the default allocator."
273 OFF)
274
20effc67
TL
275option (Seastar_DEFERRED_ACTION_REQUIRE_NOEXCEPT
276 "Enable noexcept requirement for deferred actions."
277 ON)
278
11fdf7f2
TL
279set (Seastar_TEST_TIMEOUT
280 "300"
281 CACHE
282 STRING
283 "Maximum allowed time for a test to run, in seconds.")
284
9f95a23c 285# We set the following environment variables
f67539c2 286# * ASAN_OPTIONS=disable_coredump=0:abort_on_error=1:detect_stack_use_after_return=1
9f95a23c
TL
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.
f67539c2
TL
297
298# This works great with clang and gcc 10.2, but unfortunately not any
299# previous gcc.
300set (Seastar_USE_AFTER_RETURN "")
301if ((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")
304endif ()
305
9f95a23c 306set (Seastar_TEST_ENVIRONMENT
f67539c2 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"
9f95a23c
TL
308 CACHE
309 STRING
310 "Environment variables for running tests")
311
312option (Seastar_UNUSED_RESULT_ERROR
313 "Make [[nodiscard]] violations an error (instead of a warning)."
314 OFF)
315
f67539c2
TL
316set (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
322set (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
328set (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
11fdf7f2
TL
334# When Seastar is embedded with `add_subdirectory`, disable the non-library targets.
335if (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)
341endif ()
342
343#
344# Useful (non-cache) variables.
345#
346
347set (Seastar_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
348set (Seastar_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
349set (Seastar_GEN_BINARY_DIR ${Seastar_BINARY_DIR}/gen)
350
351#
352# Dependencies.
353#
354
9f95a23c 355include (SeastarDependencies)
9f95a23c
TL
356seastar_find_dependencies ()
357
358# Private build dependencies not visible to consumers
11fdf7f2 359find_package (ragel 6.10 REQUIRED)
11fdf7f2
TL
360find_package (Threads REQUIRED)
361find_package (PthreadSetName REQUIRED)
362
363#
364# Code generation helpers.
365#
366
11fdf7f2
TL
367function (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)
383endfunction ()
384
385function (seastar_generate_swagger)
f67539c2 386 set (one_value_args TARGET VAR IN_FILE OUT_DIR)
11fdf7f2 387 cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
f67539c2 388 get_filename_component (in_file_name ${args_IN_FILE} NAME)
11fdf7f2 389 set (generator ${Seastar_SOURCE_DIR}/scripts/seastar-json2code.py)
f67539c2
TL
390 set (header_out ${args_OUT_DIR}/${in_file_name}.hh)
391 set (source_out ${args_OUT_DIR}/${in_file_name}.cc)
11fdf7f2
TL
392
393 add_custom_command (
394 DEPENDS
395 ${args_IN_FILE}
396 ${generator}
f67539c2
TL
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})
11fdf7f2
TL
400
401 add_custom_target (${args_TARGET}
f67539c2
TL
402 DEPENDS
403 ${header_out}
404 ${source_out})
11fdf7f2 405
f67539c2 406 set (${args_VAR} ${header_out} ${source_out} PARENT_SCOPE)
11fdf7f2
TL
407endfunction ()
408
409#
410# The `seastar` library.
411#
412
20effc67
TL
413seastar_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
11fdf7f2
TL
419seastar_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
425seastar_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
9f95a23c
TL
431if (Seastar_DPDK)
432 set (seastar_dpdk_obj seastar-dpdk.o)
433endif ()
434
11fdf7f2 435add_library (seastar STATIC
20effc67 436 ${http_chunk_parsers_file}
11fdf7f2 437 ${http_request_parser_file}
9f95a23c 438 ${seastar_dpdk_obj}
11fdf7f2
TL
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
11fdf7f2
TL
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
9f95a23c 464 include/seastar/core/file-types.hh
11fdf7f2
TL
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
f67539c2
TL
473 include/seastar/util/later.hh
474 include/seastar/core/layered_file.hh
11fdf7f2 475 include/seastar/core/linux-aio.hh
f67539c2 476 include/seastar/core/loop.hh
11fdf7f2
TL
477 include/seastar/core/lowres_clock.hh
478 include/seastar/core/manual_clock.hh
f67539c2 479 include/seastar/core/map_reduce.hh
11fdf7f2
TL
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
f67539c2 521 include/seastar/core/timed_out_error.hh
11fdf7f2
TL
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
f67539c2
TL
529 include/seastar/core/when_all.hh
530 include/seastar/core/with_scheduling_group.hh
531 include/seastar/core/with_timeout.hh
11fdf7f2
TL
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
20effc67 546 include/seastar/http/short_streams.hh
11fdf7f2
TL
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
9f95a23c 576 include/seastar/net/unix_address.hh
11fdf7f2
TL
577 include/seastar/net/virtio-interface.hh
578 include/seastar/net/virtio.hh
579 include/seastar/rpc/lz4_compressor.hh
9f95a23c 580 include/seastar/rpc/lz4_fragmented_compressor.hh
11fdf7f2
TL
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
f67539c2 587 include/seastar/util/concepts.hh
11fdf7f2
TL
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
f67539c2 598 include/seastar/util/log-impl.hh
11fdf7f2
TL
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
20effc67
TL
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
11fdf7f2 615 src/core/alien.cc
9f95a23c
TL
616 src/core/file.cc
617 src/core/fair_queue.cc
618 src/core/reactor_backend.cc
619 src/core/thread_pool.cc
11fdf7f2
TL
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
f67539c2 625 src/core/fsnotify.cc
11fdf7f2
TL
626 src/core/fsqual.cc
627 src/core/fstream.cc
9f95a23c 628 src/core/future.cc
11fdf7f2
TL
629 src/core/future-util.cc
630 src/core/linux-aio.cc
631 src/core/memory.cc
632 src/core/metrics.cc
f67539c2 633 src/core/on_internal_error.cc
11fdf7f2
TL
634 src/core/posix.cc
635 src/core/prometheus.cc
20effc67 636 src/core/program_options.cc
11fdf7f2
TL
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
9f95a23c 643 src/core/smp.cc
f67539c2 644 src/core/sstring.cc
11fdf7f2 645 src/core/thread.cc
9f95a23c 646 src/core/uname.cc
11fdf7f2 647 src/core/vla.hh
9f95a23c 648 src/core/io_queue.cc
f67539c2
TL
649 src/core/semaphore.cc
650 src/core/condition-variable.cc
11fdf7f2
TL
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
9f95a23c 678 src/net/socket_address.cc
11fdf7f2
TL
679 src/net/stack.cc
680 src/net/tcp.cc
681 src/net/tls.cc
682 src/net/udp.cc
9f95a23c 683 src/net/unix_address.cc
11fdf7f2
TL
684 src/net/virtio.cc
685 src/rpc/lz4_compressor.cc
9f95a23c 686 src/rpc/lz4_fragmented_compressor.cc
11fdf7f2
TL
687 src/rpc/rpc.cc
688 src/util/alloc_failure_injector.cc
689 src/util/backtrace.cc
690 src/util/conversions.cc
f67539c2
TL
691 src/util/exceptions.cc
692 src/util/file.cc
11fdf7f2
TL
693 src/util/log.cc
694 src/util/program-options.cc
f67539c2 695 src/util/read_first_line.cc
20effc67
TL
696 src/util/tmp_file.cc
697 src/util/short_streams.cc
698 src/websocket/server.cc
699 )
11fdf7f2
TL
700
701add_library (Seastar::seastar ALIAS seastar)
702
703add_dependencies (seastar
20effc67 704 seastar_http_chunk_parsers
11fdf7f2 705 seastar_http_request_parser
20effc67 706 seastar_http_response_parser)
11fdf7f2
TL
707
708target_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
9f95a23c 717set (Seastar_PRIVATE_CXX_FLAGS
11fdf7f2
TL
718 -fvisibility=hidden
719 -UNDEBUG
720 -Wall
9f95a23c
TL
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
725if (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)
729endif()
730
11fdf7f2
TL
731target_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}
11fdf7f2
TL
742 GnuTLS::gnutls
743 StdAtomic::atomic
11fdf7f2 744 lksctp-tools::lksctp-tools
11fdf7f2
TL
745 rt::rt
746 yaml-cpp::yaml-cpp
747 Threads::Threads)
748
f67539c2
TL
749set (Seastar_SANITIZE_MODES "Debug" "Sanitize")
750if ((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 ()
9f95a23c
TL
756 set (Seastar_Sanitizers_OPTIONS ${Sanitizers_COMPILER_OPTIONS})
757 target_link_libraries (seastar
758 PUBLIC
759 Sanitizers::address
760 Sanitizers::undefined_behavior)
761endif ()
762
f67539c2
TL
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"
766set( MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --leak-check=no --trace-children=yes" )
767include (CTest)
768
11fdf7f2
TL
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
780target_compile_options (seastar
781 PUBLIC
f67539c2 782 $<$<COMPILE_LANGUAGE:CXX>:-std=${Seastar_CXX_DIALECT}>
11fdf7f2
TL
783 -U_FORTIFY_SOURCE)
784
9f95a23c
TL
785target_compile_definitions(seastar
786 PUBLIC
787 SEASTAR_API_LEVEL=${Seastar_API_LEVEL})
788
789function (seastar_supports_flag flag var)
20effc67
TL
790 set (CMAKE_REQUIRED_FLAGS "${flag}")
791 check_cxx_source_compiles ("int main() { return 0; }" tmp_${var})
792 set (${var} ${tmp_${var}} PARENT_SCOPE)
9f95a23c
TL
793endfunction ()
794
795seastar_supports_flag ("-Wno-maybe-uninitialized -Werror" MaybeUninitialized_FOUND)
796if (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)
804endif ()
805
f67539c2
TL
806if (Seastar_SSTRING)
807 target_compile_options (seastar PUBLIC -DSEASTAR_SSTRING)
11fdf7f2
TL
808endif ()
809
810if (LinuxMembarrier_FOUND)
9f95a23c 811 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAS_MEMBARRIER)
11fdf7f2
TL
812
813 target_link_libraries (seastar
814 PRIVATE LinuxMembarrier::membarrier)
815endif ()
816
f67539c2
TL
817set (Seastar_ALLOC_FAILURE_INJECTION_MODES "Dev")
818if ((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)))
11fdf7f2
TL
821 target_compile_definitions (seastar
822 PUBLIC SEASTAR_ENABLE_ALLOC_FAILURE_INJECTION)
823endif ()
824
f67539c2
TL
825if (Seastar_TASK_BACKTRACE)
826 target_compile_definitions (seastar
827 PUBLIC SEASTAR_TASK_BACKTRACE)
828endif ()
829
830if (Seastar_DEBUG_ALLOCATIONS)
11fdf7f2 831 target_compile_definitions (seastar
f67539c2 832 PRIVATE SEASTAR_DEBUG_ALLOCATIONS)
11fdf7f2
TL
833endif ()
834
835if (Sanitizers_FIBER_SUPPORT)
9f95a23c 836 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_ASAN_FIBER_SUPPORT)
11fdf7f2
TL
837endif ()
838
839if (Seastar_ALLOC_PAGE_SIZE)
840 target_compile_definitions (seastar
841 PUBLIC SEASTAR_OVERRIDE_ALLOCATOR_PAGE_SIZE=${Seastar_ALLOC_PAGE_SIZE})
842endif ()
843
20effc67
TL
844target_compile_definitions (seastar
845 PUBLIC SEASTAR_SCHEDULING_GROUPS_COUNT=${Seastar_SCHEDULING_GROUPS_COUNT})
846
11fdf7f2 847if (Seastar_CXX_FLAGS)
9f95a23c
TL
848 list (APPEND Seastar_PRIVATE_CXX_FLAGS ${Seastar_CXX_FLAGS})
849endif ()
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.
856if (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")
860endif ()
861
862if (Seastar_HEAP_PROFILING)
863 set_property (
864 SOURCE "src/core/memory.cc"
865 PROPERTY
866 COMPILE_DEFINITIONS SEASTAR_HEAPPROF)
11fdf7f2
TL
867endif ()
868
20effc67
TL
869if (Seastar_DEFERRED_ACTION_REQUIRE_NOEXCEPT)
870 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_DEFERRED_ACTION_REQUIRE_NOEXCEPT)
871endif ()
872
11fdf7f2
TL
873if (Seastar_DPDK)
874 if (NOT dpdk_FOUND)
875 message (FATAL_ERROR "dpdk support is enabled but it is not available!")
876 endif ()
877
9f95a23c
TL
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
11fdf7f2
TL
897 target_compile_definitions (seastar
898 PUBLIC SEASTAR_HAVE_DPDK)
899
9f95a23c
TL
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
11fdf7f2
TL
909 target_link_libraries (seastar
910 PUBLIC dpdk::dpdk)
911endif ()
912
11fdf7f2
TL
913if (Seastar_HWLOC)
914 if (NOT hwloc_FOUND)
915 message (FATAL_ERROR "`hwloc` support is enabled but it is not available!")
916 endif ()
917
9f95a23c 918 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_HWLOC)
11fdf7f2
TL
919
920 target_link_libraries (seastar
921 PRIVATE hwloc::hwloc)
922endif ()
923
924if (Seastar_LD_FLAGS)
925 # In newer versions of CMake, there is `target_link_options`.
926 target_link_libraries (seastar
927 PRIVATE ${Seastar_LD_FLAGS})
928endif ()
929
930if (Seastar_NUMA)
931 if (NOT numactl_FOUND)
932 message (FATAL_ERROR "NUMA support is enabled but `numactl` is not available!")
933 endif ()
934
9f95a23c 935 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_NUMA)
11fdf7f2
TL
936
937 target_link_libraries (seastar
938 PRIVATE numactl::numactl)
939endif ()
940
941if (lz4_HAVE_COMPRESS_DEFAULT)
9f95a23c
TL
942 list (APPEND Seastar_PRIVATE_COMPILE_DEFINITIONS SEASTAR_HAVE_LZ4_COMPRESS_DEFAULT)
943endif ()
944
945seastar_supports_flag ("-Werror=unused-result" ErrorUnused_FOUND)
946if (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 ()
11fdf7f2
TL
954endif ()
955
20effc67
TL
956seastar_supports_flag ("-Wno-error=#warnings" ErrorWarnings_FOUND)
957if (ErrorWarnings_FOUND)
958 target_compile_options (seastar
959 PUBLIC "-Wno-error=#warnings")
960endif ()
961
9f95a23c 962if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Sanitize"))
11fdf7f2
TL
963 target_compile_definitions (seastar
964 PUBLIC
965 SEASTAR_DEBUG
966 SEASTAR_DEFAULT_ALLOCATOR
9f95a23c
TL
967 SEASTAR_SHUFFLE_TASK_QUEUE)
968endif ()
969
f67539c2
TL
970set (Seastar_DEBUG_SHARED_PTR_MODES "Debug" "Sanitize")
971if (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
9f95a23c 975 PUBLIC
f67539c2
TL
976 SEASTAR_DEBUG_SHARED_PTR)
977endif ()
978
979set (Seastar_STACK_GUARD_MODES "Debug" "Sanitize" "Dev")
980if ((Seastar_STACK_GUARDS STREQUAL "ON") OR
981 ((Seastar_STACK_GUARDS STREQUAL "DEFAULT") AND
982 (CMAKE_BUILD_TYPE IN_LIST Seastar_STACK_GUARD_MODES)))
20effc67
TL
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)
f67539c2
TL
986 if (StackClashProtection_FOUND)
987 target_compile_options (seastar
988 PUBLIC
9f95a23c 989 -fstack-clash-protection)
f67539c2 990 endif ()
9f95a23c
TL
991 target_compile_definitions (seastar
992 PRIVATE
11fdf7f2
TL
993 SEASTAR_THREAD_STACK_GUARDS)
994endif ()
995
9f95a23c
TL
996if ((CMAKE_BUILD_TYPE STREQUAL "Dev") OR (CMAKE_BUILD_TYPE STREQUAL "Debug"))
997 target_compile_definitions (seastar
998 PUBLIC
999 SEASTAR_TYPE_ERASE_MORE)
1000endif ()
1001
11fdf7f2 1002target_compile_definitions (seastar
9f95a23c 1003 PRIVATE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
11fdf7f2
TL
1004
1005target_compile_options (seastar
9f95a23c 1006 PRIVATE ${Seastar_PRIVATE_CXX_FLAGS})
11fdf7f2 1007
9f95a23c 1008add_library (seastar_private INTERFACE)
11fdf7f2 1009
9f95a23c
TL
1010target_compile_definitions (seastar_private
1011 INTERFACE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
11fdf7f2 1012
9f95a23c
TL
1013target_compile_options (seastar_private
1014 INTERFACE ${Seastar_PRIVATE_CXX_FLAGS})
11fdf7f2 1015
9f95a23c
TL
1016target_link_libraries (seastar_private
1017 INTERFACE seastar)
11fdf7f2
TL
1018
1019#
1020# The testing library.
1021#
1022
1023if (Seastar_INSTALL OR Seastar_TESTING)
1024 add_library (seastar_testing
1025 include/seastar/testing/entry_point.hh
1026 include/seastar/testing/exchanger.hh
20effc67 1027 include/seastar/testing/random.hh
11fdf7f2
TL
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
20effc67 1033 src/testing/random.cc
11fdf7f2
TL
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
9f95a23c 1041 PRIVATE ${Seastar_PRIVATE_COMPILE_DEFINITIONS})
11fdf7f2
TL
1042
1043 target_compile_options (seastar_testing
9f95a23c 1044 PRIVATE ${Seastar_PRIVATE_CXX_FLAGS})
11fdf7f2
TL
1045
1046 target_link_libraries (seastar_testing
1047 PUBLIC
1048 Boost::unit_test_framework
9f95a23c
TL
1049 seastar)
1050
1051 add_library(seastar_perf_testing
20effc67 1052 src/testing/random.cc
9f95a23c
TL
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
11fdf7f2
TL
1064endif ()
1065
1066#
1067# The tests themselves.
1068#
1069
1070if (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})
1080endif ()
1081
1082#
1083# Demonstrations.
1084#
1085
1086if (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})
1094endif ()
1095
1096#
1097# Documentation.
1098#
1099
1100if (Seastar_DOCS)
1101 add_subdirectory (doc)
1102endif ()
1103
1104#
1105# Applications.
1106#
1107
1108if (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})
1116endif ()
1117
1118#
1119# Installation and export.
1120#
1121
1122if (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
11fdf7f2
TL
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
9f95a23c 1198 seastar_perf_testing
11fdf7f2
TL
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
11fdf7f2
TL
1227 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindConcepts.cmake
1228 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindGnuTLS.cmake
1229 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindLinuxMembarrier.cmake
11fdf7f2
TL
1230 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindSanitizers.cmake
1231 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindStdAtomic.cmake
11fdf7f2
TL
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
9f95a23c 1242 ${CMAKE_CURRENT_SOURCE_DIR}/cmake/SeastarDependencies.cmake
11fdf7f2
TL
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)
1279endif ()