diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/seastar/cmake | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
26 files changed, 1731 insertions, 0 deletions
diff --git a/src/seastar/cmake/FindGnuTLS.cmake b/src/seastar/cmake/FindGnuTLS.cmake new file mode 100644 index 000000000..79e38dda3 --- /dev/null +++ b/src/seastar/cmake/FindGnuTLS.cmake @@ -0,0 +1,62 @@ +# +# 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. +# + +find_package (PkgConfig REQUIRED) + +pkg_check_modules (PC_GnuTLS QUIET gnutls) + +find_library (GnuTLS_LIBRARY + NAMES gnutls + HINTS + ${PC_GnuTLS_LIBDIR} + ${PC_GnuTLS_LIBRARY_DIRS}) + +find_path (GnuTLS_INCLUDE_DIR + NAMES gnutls/gnutls.h + HINTS + ${PC_GnuTLS_INCLUDEDIR} + ${PC_GnuTLS_INCLUDE_DIRS}) + +mark_as_advanced ( + GnuTLS_LIBRARY + GnuTLS_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (GnuTLS + REQUIRED_VARS + GnuTLS_LIBRARY + GnuTLS_INCLUDE_DIR + VERSION_VAR PC_GnuTLS_VERSION) + +if (GnuTLS_FOUND) + set (GnuTLS_LIBRARIES ${GnuTLS_LIBRARY}) + set (GnuTLS_INCLUDE_DIRS ${GnuTLS_INCLUDE_DIR}) + if (NOT (TARGET GnuTLS::gnutls)) + add_library (GnuTLS::gnutls UNKNOWN IMPORTED) + + set_target_properties (GnuTLS::gnutls + PROPERTIES + IMPORTED_LOCATION ${GnuTLS_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${GnuTLS_INCLUDE_DIRS}) + endif () +endif () diff --git a/src/seastar/cmake/FindLibUring.cmake b/src/seastar/cmake/FindLibUring.cmake new file mode 100644 index 000000000..63893fde4 --- /dev/null +++ b/src/seastar/cmake/FindLibUring.cmake @@ -0,0 +1,74 @@ +# +# 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) 2022 ScyllaDB +# + +find_package (PkgConfig REQUIRED) + +pkg_check_modules (PC_URING QUIET liburing) + +find_library (URING_LIBRARY + NAMES uring + HINTS + ${PC_URING_LIBDIR} + ${PC_URING_LIBRARY_DIRS}) + +find_path (URING_INCLUDE_DIR + NAMES liburing.h + HINTS + ${PC_URING_INCLUDEDIR} + ${PC_URING_INCLUDE_DIRS}) + +if (URING_INCLUDE_DIR) + include (CheckStructHasMember) + include (CMakePushCheckState) + cmake_push_check_state (RESET) + list(APPEND CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIR}) + CHECK_STRUCT_HAS_MEMBER ("struct io_uring" features liburing.h + HAVE_IOURING_FEATURES LANGUAGE CXX) + cmake_pop_check_state () +endif () + +mark_as_advanced ( + URING_LIBRARY + URING_INCLUDE_DIR + HAVE_IOURING_FEATURES) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (LibUring + REQUIRED_VARS + URING_LIBRARY + URING_INCLUDE_DIR + HAVE_IOURING_FEATURES + VERSION_VAR PC_URING_VERSION) + +if (LibUring_FOUND) + set (URING_LIBRARIES ${URING_LIBRARY}) + set (URING_INCLUDE_DIRS ${URING_INCLUDE_DIR}) + if (NOT (TARGET URING::uring)) + add_library (URING::uring UNKNOWN IMPORTED) + + set_target_properties (URING::uring + PROPERTIES + IMPORTED_LOCATION ${URING_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${URING_INCLUDE_DIRS}) + endif () +endif () diff --git a/src/seastar/cmake/FindLinuxMembarrier.cmake b/src/seastar/cmake/FindLinuxMembarrier.cmake new file mode 100644 index 000000000..d4645cffa --- /dev/null +++ b/src/seastar/cmake/FindLinuxMembarrier.cmake @@ -0,0 +1,40 @@ +# +# 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. +# + +find_path (LinuxMembarrier_INCLUDE_DIR + NAMES linux/membarrier.h) + +include (CheckCXXSourceCompiles) +file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/LinuxMembarrier_test.cc _linuxmembarrier_test_code) +check_cxx_source_compiles ("${_linuxmembarrier_test_code}" LinuxMembarrier_FOUND) + +if (LinuxMembarrier_FOUND) + set (LinuxMembarrier_INCLUDE_DIRS ${LinuxMembarrier_INCLUDE_DIR}) +endif () + +if (LinuxMembarrier_FOUND AND NOT (TARGET LinuxMembarrier::membarrier)) + add_library (LinuxMembarrier::membarrier INTERFACE IMPORTED) + + set_target_properties (LinuxMembarrier::membarrier + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${LinuxMembarrier_INCLUDE_DIRS}) +endif () diff --git a/src/seastar/cmake/FindPthreadSetName.cmake b/src/seastar/cmake/FindPthreadSetName.cmake new file mode 100644 index 000000000..547b9f5a3 --- /dev/null +++ b/src/seastar/cmake/FindPthreadSetName.cmake @@ -0,0 +1,12 @@ +include (CMakePushCheckState) + +cmake_push_check_state (RESET) +set (CMAKE_REQUIRED_FLAGS "-pthread") +set (CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") +check_symbol_exists (pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP) +cmake_pop_check_state () + +find_package_handle_standard_args (PthreadSetName + FOUND_VAR PthreadSetName_FOUND + REQUIRED_VARS + HAVE_PTHREAD_SETNAME_NP) diff --git a/src/seastar/cmake/FindSanitizers.cmake b/src/seastar/cmake/FindSanitizers.cmake new file mode 100644 index 000000000..316f88ea2 --- /dev/null +++ b/src/seastar/cmake/FindSanitizers.cmake @@ -0,0 +1,73 @@ +# +# 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. +# + +include (CheckCXXSourceCompiles) + +set (CMAKE_REQUIRED_FLAGS -fsanitize=address) +check_cxx_source_compiles ("int main() {}" Sanitizers_ADDRESS_FOUND) + +if (Sanitizers_ADDRESS_FOUND) + set (Sanitizers_ADDRESS_COMPILER_OPTIONS -fsanitize=address) +endif () + +set (CMAKE_REQUIRED_FLAGS -fsanitize=undefined) +check_cxx_source_compiles ("int main() {}" Sanitizers_UNDEFINED_BEHAVIOR_FOUND) + +if (Sanitizers_UNDEFINED_BEHAVIOR_FOUND) + # Disable vptr because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88684 + set (Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS "-fsanitize=undefined;-fno-sanitize=vptr") +endif () + +set (Sanitizers_COMPILER_OPTIONS + ${Sanitizers_ADDRESS_COMPILER_OPTIONS} + ${Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS}) + +file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Sanitizers_fiber_test.cc _sanitizers_fiber_test_code) +set (CMAKE_REQUIRED_FLAGS ${Sanitizers_COMPILER_OPTIONS}) +check_cxx_source_compiles ("${_sanitizers_fiber_test_code}" Sanitizers_FIBER_SUPPORT) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (Sanitizers + REQUIRED_VARS + Sanitizers_ADDRESS_COMPILER_OPTIONS + Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS) + +if (Sanitizers_FOUND) + if (NOT (TARGET Sanitizers::address)) + add_library (Sanitizers::address INTERFACE IMPORTED) + + set_target_properties (Sanitizers::address + PROPERTIES + INTERFACE_COMPILE_OPTIONS ${Sanitizers_ADDRESS_COMPILER_OPTIONS} + INTERFACE_LINK_LIBRARIES ${Sanitizers_ADDRESS_COMPILER_OPTIONS}) + endif () + + if (NOT (TARGET Sanitizers::undefined_behavior)) + add_library (Sanitizers::undefined_behavior INTERFACE IMPORTED) + + set_target_properties (Sanitizers::undefined_behavior + PROPERTIES + INTERFACE_COMPILE_OPTIONS "${Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS}" + INTERFACE_LINK_LIBRARIES "${Sanitizers_UNDEFINED_BEHAVIOR_COMPILER_OPTIONS}") + endif () +endif () diff --git a/src/seastar/cmake/FindSourceLocation.cmake b/src/seastar/cmake/FindSourceLocation.cmake new file mode 100644 index 000000000..b8a274b2a --- /dev/null +++ b/src/seastar/cmake/FindSourceLocation.cmake @@ -0,0 +1,46 @@ +# +# 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) 2022 Kefu Chai ( tchaikov@gmail.com ) +# + +include (CheckCXXSourceCompiles) +include (CheckCXXSourceRuns) +include (CMakePushCheckState) + +cmake_push_check_state () +file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Source_location_test.cc _source_location_test_code) +set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}") +check_cxx_source_compiles ("${_source_location_test_code}" CxxSourceLocation_SUPPORTED) + +file (READ ${CMAKE_CURRENT_LIST_DIR}/code_tests/Source_location_default_argument.cc _source_location_test_code) +set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION}") +# see also https://cplusplus.github.io/CWG/issues/2631.html +check_cxx_source_runs ("${_source_location_test_code}" CxxSourceLocation_IMPLEMENTS_CWG2631) +cmake_pop_check_state () + +if (NOT (TARGET SourceLocation::source_location)) + add_library (SourceLocation::source_location INTERFACE IMPORTED) + if ((NOT CxxSourceLocation_SUPPORTED) OR + (NOT CxxSourceLocation_IMPLEMENTS_CWG2631)) + set_target_properties (SourceLocation::source_location + PROPERTIES + INTERFACE_COMPILE_DEFINITIONS SEASTAR_BROKEN_SOURCE_LOCATION) + endif () +endif () diff --git a/src/seastar/cmake/FindStdAtomic.cmake b/src/seastar/cmake/FindStdAtomic.cmake new file mode 100644 index 000000000..2d14c0b2b --- /dev/null +++ b/src/seastar/cmake/FindStdAtomic.cmake @@ -0,0 +1,51 @@ +# +# 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) 2019 Scylladb, Ltd. +# + +function (_stdatomic_can_link var) + include (CheckCXXSourceCompiles) + set (test_code "int main() {}") + set (CMAKE_REQUIRED_LIBRARIES -latomic) + check_cxx_source_compiles ("${test_code}" ${var}) +endfunction () + +_stdatomic_can_link (StdAtomic_EXPLICIT_LINK) + +# +# If linking against `-latomic` is successful, then do it unconditionally. +# + +if (StdAtomic_EXPLICIT_LINK) + set (StdAtomic_LIBRARY_NAME atomic) + set (StdAtomic_LIBRARIES -l${StdAtomic_LIBRARY_NAME}) + include (FindPackageHandleStandardArgs) + + find_package_handle_standard_args (StdAtomic + REQUIRED_VARS StdAtomic_LIBRARIES) +endif () + +if (NOT (TARGET StdAtomic::atomic)) + add_library (StdAtomic::atomic INTERFACE IMPORTED) + + set_target_properties (StdAtomic::atomic + PROPERTIES + INTERFACE_LINK_LIBRARIES "${StdAtomic_LIBRARIES}") +endif () diff --git a/src/seastar/cmake/FindValgrind.cmake b/src/seastar/cmake/FindValgrind.cmake new file mode 100644 index 000000000..6f8a24235 --- /dev/null +++ b/src/seastar/cmake/FindValgrind.cmake @@ -0,0 +1,53 @@ +# +# 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) 2022 Kefu Chai ( tchaikov@gmail.com ) +# + + +find_package (PkgConfig REQUIRED) + +pkg_check_modules (PC_valgrind QUIET valgrind) + +find_path (Valgrind_INCLUDE_DIR + NAMES valgrind/valgrind.h + HINTS + ${PC_valgrind_INCLUDEDIR} + ${PC_valgrind_INCLUDE_DIRS}) + +mark_as_advanced ( + Valgrind_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (Valgrind + REQUIRED_VARS + Valgrind_INCLUDE_DIR) + +if (Valgrind_FOUND) + set (Valgrind_INCLUDE_DIRS ${Valgrind_INCLUDE_DIR}) + + if (NOT (TARGET Valgrind::valgrind)) + add_library (Valgrind::valgrind INTERFACE IMPORTED) + + set_target_properties (Valgrind::valgrind + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${Valgrind_INCLUDE_DIRS}) + endif () +endif () diff --git a/src/seastar/cmake/Findc-ares.cmake b/src/seastar/cmake/Findc-ares.cmake new file mode 100644 index 000000000..4524f804c --- /dev/null +++ b/src/seastar/cmake/Findc-ares.cmake @@ -0,0 +1,62 @@ +# +# 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. +# + +find_package (PkgConfig REQUIRED) + +pkg_check_modules (PC_c-ares QUIET libcares) + +find_library (c-ares_LIBRARY + NAMES cares + HINTS + ${PC_c-ares_LIBDIR} + ${PC_c-ares_LIBRARY_DIRS}) + +find_path (c-ares_INCLUDE_DIR + NAMES ares_dns.h + HINTS + ${PC_c-ares_INCLUDEDIR} + ${PC_c-ares_INCLUDE_DIRS}) + +mark_as_advanced ( + c-ares_LIBRARY + c-ares_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (c-ares + REQUIRED_VARS + c-ares_LIBRARY + c-ares_INCLUDE_DIR + VERSION_VAR PC_c-ares_VERSION) + +if (c-ares_FOUND) + set (c-ares_LIBRARIES ${c-ares_LIBRARY}) + set (c-ares_INCLUDE_DIRS ${c-ares_INCLUDE_DIR}) + if (NOT (TARGET c-ares::cares)) + add_library (c-ares::cares UNKNOWN IMPORTED) + + set_target_properties (c-ares::cares + PROPERTIES + IMPORTED_LOCATION ${c-ares_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${c-ares_INCLUDE_DIRS}) + endif () +endif () diff --git a/src/seastar/cmake/Findcryptopp.cmake b/src/seastar/cmake/Findcryptopp.cmake new file mode 100644 index 000000000..def4072ed --- /dev/null +++ b/src/seastar/cmake/Findcryptopp.cmake @@ -0,0 +1,51 @@ +# +# 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. +# + +find_library (cryptopp_LIBRARY + NAMES cryptopp) + +find_path (cryptopp_INCLUDE_DIR + NAMES cryptopp/aes.h + PATH_SUFFIXES cryptopp) + +mark_as_advanced ( + cryptopp_LIBRARY + cryptopp_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (cryptopp + REQUIRED_VARS + cryptopp_LIBRARY + cryptopp_INCLUDE_DIR) + +set (cryptopp_LIBRARIES ${cryptopp_LIBRARY}) +set (cryptopp_INCLUDE_DIRS ${cryptopp_INCLUDE_DIR}) + +if (cryptopp_FOUND AND NOT (TARGET cryptopp::cryptopp)) + add_library (cryptopp::cryptopp UNKNOWN IMPORTED) + + set_target_properties (cryptopp::cryptopp + PROPERTIES + IMPORTED_LOCATION ${cryptopp_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${cryptopp_INCLUDE_DIRS}) +endif () diff --git a/src/seastar/cmake/Finddpdk.cmake b/src/seastar/cmake/Finddpdk.cmake new file mode 100644 index 000000000..c70b8e026 --- /dev/null +++ b/src/seastar/cmake/Finddpdk.cmake @@ -0,0 +1,493 @@ +# +# 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. +# + +find_path (dpdk_INCLUDE_DIR + NAMES rte_atomic.h + PATH_SUFFIXES dpdk) + +find_library (dpdk_PMD_VMXNET3_UIO_LIBRARY rte_pmd_vmxnet3_uio) +find_library (dpdk_PMD_I40E_LIBRARY rte_pmd_i40e) +find_library (dpdk_PMD_IXGBE_LIBRARY rte_pmd_ixgbe) +find_library (dpdk_PMD_E1000_LIBRARY rte_pmd_e1000) +find_library (dpdk_PMD_BNXT_LIBRARY rte_pmd_bnxt) +find_library (dpdk_PMD_RING_LIBRARY rte_pmd_ring) +find_library (dpdk_PMD_CXGBE_LIBRARY rte_pmd_cxgbe) +find_library (dpdk_PMD_ENA_LIBRARY rte_pmd_ena) +find_library (dpdk_PMD_ENIC_LIBRARY rte_pmd_enic) +find_library (dpdk_PMD_FM10K_LIBRARY rte_pmd_fm10k) +find_library (dpdk_PMD_NFP_LIBRARY rte_pmd_nfp) +find_library (dpdk_PMD_QEDE_LIBRARY rte_pmd_qede) +find_library (dpdk_RING_LIBRARY rte_ring) +find_library (dpdk_KVARGS_LIBRARY rte_kvargs) +find_library (dpdk_MEMPOOL_LIBRARY rte_mempool) +find_library (dpdk_MEMPOOL_RING_LIBRARY rte_mempool_ring) +find_library (dpdk_PMD_SFC_EFX_LIBRARY rte_pmd_sfc_efx) +find_library (dpdk_HASH_LIBRARY rte_hash) +find_library (dpdk_CMDLINE_LIBRARY rte_cmdline) +find_library (dpdk_MBUF_LIBRARY rte_mbuf) +find_library (dpdk_CFGFILE_LIBRARY rte_cfgfile) +find_library (dpdk_EAL_LIBRARY rte_eal) +find_library (dpdk_ETHDEV_LIBRARY rte_ethdev) +find_library (dpdk_NET_LIBRARY rte_net) +find_library (dpdk_TIMER_LIBRARY rte_timer) +find_library (dpdk_PCI_LIBRARY rte_pci) +find_library (dpdk_BUS_PCI_LIBRARY rte_bus_pci) +find_library (dpdk_BUS_VDEV_LIBRARY rte_bus_vdev) + +include (FindPackageHandleStandardArgs) + +set (dpdk_REQUIRED + dpdk_INCLUDE_DIR + dpdk_PMD_VMXNET3_UIO_LIBRARY + dpdk_PMD_I40E_LIBRARY + dpdk_PMD_IXGBE_LIBRARY + dpdk_PMD_E1000_LIBRARY + dpdk_PMD_BNXT_LIBRARY + dpdk_PMD_RING_LIBRARY + dpdk_PMD_CXGBE_LIBRARY + dpdk_PMD_ENA_LIBRARY + dpdk_PMD_ENIC_LIBRARY + dpdk_PMD_NFP_LIBRARY + dpdk_PMD_QEDE_LIBRARY + dpdk_RING_LIBRARY + dpdk_KVARGS_LIBRARY + dpdk_MEMPOOL_LIBRARY + dpdk_MEMPOOL_RING_LIBRARY + dpdk_HASH_LIBRARY + dpdk_CMDLINE_LIBRARY + dpdk_MBUF_LIBRARY + dpdk_CFGFILE_LIBRARY + dpdk_EAL_LIBRARY + dpdk_ETHDEV_LIBRARY + dpdk_NET_LIBRARY + dpdk_TIMER_LIBRARY + dpdk_PCI_LIBRARY + dpdk_BUS_PCI_LIBRARY + dpdk_BUS_VDEV_LIBRARY) + +# fm10k, sfc_efx driver can only build on x86 +if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + set (dpdk_REQUIRED + ${dpdk_REQUIRED} + dpdk_PMD_FM10K_LIBRARY + dpdk_PMD_SFC_EFX_LIBRARY) +endif() + +find_package_handle_standard_args (dpdk + REQUIRED_VARS + ${dpdk_REQUIRED} +) + +if (dpdk_FOUND AND NOT (TARGET dpdk::dpdk)) + set (dpdk_LIBRARIES + ${dpdk_CFGFILE_LIBRARY} + ${dpdk_CMDLINE_LIBRARY} + ${dpdk_ETHDEV_LIBRARY} + ${dpdk_HASH_LIBRARY} + ${dpdk_MBUF_LIBRARY} + ${dpdk_EAL_LIBRARY} + ${dpdk_KVARGS_LIBRARY} + ${dpdk_MEMPOOL_LIBRARY} + ${dpdk_MEMPOOL_RING_LIBRARY} + ${dpdk_PMD_BNXT_LIBRARY} + ${dpdk_PMD_E1000_LIBRARY} + ${dpdk_PMD_ENA_LIBRARY} + ${dpdk_PMD_ENIC_LIBRARY} + ${dpdk_PMD_QEDE_LIBRARY} + ${dpdk_PMD_I40E_LIBRARY} + ${dpdk_PMD_IXGBE_LIBRARY} + ${dpdk_PMD_NFP_LIBRARY} + ${dpdk_PMD_RING_LIBRARY} + ${dpdk_PMD_VMXNET3_UIO_LIBRARY}) + + if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + set (dpdk_LIBRARIES + ${dpdk_LIBRARIES} + ${dpdk_PMD_FM10K_LIBRARY} + ${dpdk_PMD_SFC_EFX_LIBRARY}) + endif() + + set (dpdk_LIBRARIES + ${dpdk_LIBRARIES} + ${dpdk_RING_LIBRARY} + ${dpdk_NET_LIBRARY} + ${dpdk_TIMER_LIBRARY} + ${dpdk_PCI_LIBRARY} + ${dpdk_BUS_PCI_LIBRARY} + ${dpdk_BUS_VDEV_LIBRARY}) + + # + # pmd_vmxnet3_uio + # + + add_library (dpdk::pmd_vmxnet3_uio UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_vmxnet3_uio + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_VMXNET3_UIO_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_i40e + # + + add_library (dpdk::pmd_i40e UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_i40e + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_I40E_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_ixgbe + # + + add_library (dpdk::pmd_ixgbe UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_ixgbe + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_IXGBE_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_e1000 + # + + add_library (dpdk::pmd_e1000 UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_e1000 + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_E1000_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_bnxt + # + + add_library (dpdk::pmd_bnxt UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_bnxt + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_BNXT_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_ring + # + + add_library (dpdk::pmd_ring UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_ring + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_RING_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_cxgbe + # + + add_library (dpdk::pmd_cxgbe UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_cxgbe + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_CXGBE_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_ena + # + + add_library (dpdk::pmd_ena UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_ena + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_ENA_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_enic + # + + add_library (dpdk::pmd_enic UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_enic + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_ENIC_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_fm10k + # + + add_library (dpdk::pmd_fm10k UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_fm10k + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_FM10K_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_nfp + # + + add_library (dpdk::pmd_nfp UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_nfp + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_NFP_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_qede + # + + add_library (dpdk::pmd_qede UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_qede + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_QEDE_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pmd_sfc_efx + # + + add_library (dpdk::pmd_sfc_efx UNKNOWN IMPORTED) + + set_target_properties (dpdk::pmd_sfc_efx + PROPERTIES + IMPORTED_LOCATION ${dpdk_PMD_SFC_EFX_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # hash + # + + add_library (dpdk::hash UNKNOWN IMPORTED) + + set_target_properties (dpdk::hash + PROPERTIES + IMPORTED_LOCATION ${dpdk_HASH_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # kvargs + # + + add_library (dpdk::kvargs UNKNOWN IMPORTED) + + set_target_properties (dpdk::kvargs + PROPERTIES + IMPORTED_LOCATION ${dpdk_KVARGS_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # mbuf + # + + add_library (dpdk::mbuf UNKNOWN IMPORTED) + + set_target_properties (dpdk::mbuf + PROPERTIES + IMPORTED_LOCATION ${dpdk_MBUF_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES dpdk::eal) + + # + # eal (since dpdk 18.08, eal depends on kvargs) + # + + add_library (dpdk::eal UNKNOWN IMPORTED) + + set_target_properties (dpdk::eal + PROPERTIES + IMPORTED_LOCATION ${dpdk_EAL_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES dpdk::kvargs) + + # + # ethdev + # + + add_library (dpdk::ethdev UNKNOWN IMPORTED) + + set_target_properties (dpdk::ethdev + PROPERTIES + IMPORTED_LOCATION ${dpdk_ETHDEV_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR} + INTERACE_LINK_LIBRARIES dpdk::eal) + + # + # mempool + # + + add_library (dpdk::mempool UNKNOWN IMPORTED) + + set_target_properties (dpdk::mempool + PROPERTIES + IMPORTED_LOCATION ${dpdk_MEMPOOL_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # mempool_ring + # + + add_library (dpdk::mempool_ring UNKNOWN IMPORTED) + + set_target_properties (dpdk::mempool_ring + PROPERTIES + IMPORTED_LOCATION ${dpdk_MEMPOOL_RING_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # ring + # + + add_library (dpdk::ring UNKNOWN IMPORTED) + + set_target_properties (dpdk::ring + PROPERTIES + IMPORTED_LOCATION ${dpdk_RING_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # cmdline + # + + add_library (dpdk::cmdline UNKNOWN IMPORTED) + + set_target_properties (dpdk::cmdline + PROPERTIES + IMPORTED_LOCATION ${dpdk_CMDLINE_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # cfgfile + # + + add_library (dpdk::cfgfile UNKNOWN IMPORTED) + + set_target_properties (dpdk::cfgfile + PROPERTIES + IMPORTED_LOCATION ${dpdk_CFGFILE_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # net + # + + add_library (dpdk::net UNKNOWN IMPORTED) + + set_target_properties (dpdk::net + PROPERTIES + IMPORTED_LOCATION ${dpdk_NET_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # timer + # + + add_library (dpdk::timer UNKNOWN IMPORTED) + + set_target_properties (dpdk::timer + PROPERTIES + IMPORTED_LOCATION ${dpdk_TIMER_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # pci + # + + add_library (dpdk::pci UNKNOWN IMPORTED) + + set_target_properties (dpdk::pci + PROPERTIES + IMPORTED_LOCATION ${dpdk_PCI_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # bus_pci + # + + add_library (dpdk::bus_pci UNKNOWN IMPORTED) + + set_target_properties (dpdk::bus_pci + PROPERTIES + IMPORTED_LOCATION ${dpdk_BUS_PCI_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # bus_vdev + # + + add_library (dpdk::bus_vdev UNKNOWN IMPORTED) + + set_target_properties (dpdk::bus_vdev + PROPERTIES + IMPORTED_LOCATION ${dpdk_BUS_VDEV_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${dpdk_INCLUDE_DIR}) + + # + # Summary. + # + + add_library (dpdk::dpdk INTERFACE IMPORTED) + + set (_dpdk_libraries + dpdk::cfgfile + dpdk::cmdline + dpdk::eal + dpdk::ethdev + dpdk::hash + dpdk::kvargs + dpdk::mbuf + dpdk::mempool + dpdk::mempool_ring + dpdk::pmd_bnxt + dpdk::pmd_cxgbe + dpdk::pmd_e1000 + dpdk::pmd_ena + dpdk::pmd_enic + dpdk::pmd_qede + dpdk::pmd_i40e + dpdk::pmd_ixgbe + dpdk::pmd_nfp + dpdk::pmd_ring + dpdk::pmd_vmxnet3_uio + dpdk::ring + dpdk::net + dpdk::timer + dpdk::pci + dpdk::bus_pci + dpdk::bus_vdev) + + if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + set (_dpdk_libraries + ${_dpdk_libraries} + dpdk::pmd_fm10k + dpdk::pmd_sfc_efx) + endif() + + set_target_properties (dpdk::dpdk + PROPERTIES + INTERFACE_LINK_LIBRARIES "${_dpdk_libraries}") +endif () diff --git a/src/seastar/cmake/Findhwloc.cmake b/src/seastar/cmake/Findhwloc.cmake new file mode 100644 index 000000000..a48521b7c --- /dev/null +++ b/src/seastar/cmake/Findhwloc.cmake @@ -0,0 +1,62 @@ +# +# 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. +# + +find_package (PkgConfig REQUIRED) + +pkg_search_module (PC_hwloc QUIET hwloc) + +find_library (hwloc_LIBRARY + NAMES hwloc + HINTS + ${PC_hwloc_LIBDIR} + ${PC_hwloc_LIBRARY_DIRS}) + +find_path (hwloc_INCLUDE_DIR + NAMES hwloc.h + HINTS + ${PC_hwloc_INCLUDEDIR} + ${PC_hwloc_INCLUDE_DIRS}) + +mark_as_advanced ( + hwloc_LIBRARY + hwloc_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (hwloc + REQUIRED_VARS + hwloc_LIBRARY + hwloc_INCLUDE_DIR + VERSION_VAR hwloc_VERSION) + +if (hwloc_FOUND) + set (hwloc_LIBRARIES ${hwloc_LIBRARY}) + set (hwloc_INCLUDE_DIRS ${hwloc_INCLUDE_DIR}) + if (NOT (TARGET hwloc::hwloc)) + add_library (hwloc::hwloc UNKNOWN IMPORTED) + + set_target_properties (hwloc::hwloc + PROPERTIES + IMPORTED_LOCATION ${hwloc_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${hwloc_INCLUDE_DIRS}) + endif () +endif () diff --git a/src/seastar/cmake/Findlksctp-tools.cmake b/src/seastar/cmake/Findlksctp-tools.cmake new file mode 100644 index 000000000..c048edf60 --- /dev/null +++ b/src/seastar/cmake/Findlksctp-tools.cmake @@ -0,0 +1,54 @@ +# +# 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. +# + +find_library (lksctp-tools_LIBRARY + NAMES sctp) + +find_path (lksctp-tools_INCLUDE_DIR + NAMES netinet/sctp.h) + +mark_as_advanced ( + lksctp-tools_LIBRARY + lksctp-tools_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (lksctp-tools + REQUIRED_VARS + lksctp-tools_LIBRARY + lksctp-tools_INCLUDE_DIR) + +set (lksctp-tools_LIBRARIES ${lksctp-tools_LIBRARY}) +set (lksctp-tools_INCLUDE_DIRS ${lksctp-tools_INCLUDE_DIR}) + +if (lksctp-tools_FOUND AND NOT (TARGET lksctp-tools::lksctp-tools)) + add_library (lksctp-tools::lksctp-tools UNKNOWN IMPORTED) + + set_target_properties (lksctp-tools::lksctp-tools + PROPERTIES + IMPORTED_LOCATION ${lksctp-tools_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${lksctp-tools_INCLUDE_DIRS}) +endif () + +mark_as_advanced ( + lksctp-tools_INCLUDE_DIR + lksctp-tools_LIBRARY) diff --git a/src/seastar/cmake/Findlz4.cmake b/src/seastar/cmake/Findlz4.cmake new file mode 100644 index 000000000..a2cd09fdc --- /dev/null +++ b/src/seastar/cmake/Findlz4.cmake @@ -0,0 +1,70 @@ +# +# 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. +# + +find_package (PkgConfig REQUIRED) + +pkg_search_module (PC_lz4 QUIET liblz4) + +find_library (lz4_LIBRARY + NAMES lz4 + HINTS + ${PC_lz4_LIBDIR} + ${PC_lz4_LIBRARY_DIRS}) + +find_path (lz4_INCLUDE_DIR + NAMES lz4.h + HINTS + ${PC_lz4_INCLUDEDIR} + ${PC_lz4_INCLUDE_DIRS}) + +mark_as_advanced ( + lz4_LIBRARY + lz4_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (lz4 + REQUIRED_VARS + lz4_LIBRARY + lz4_INCLUDE_DIR + VERSION_VAR lz4_VERSION) + +if (lz4_FOUND) + set (CMAKE_REQUIRED_LIBRARIES ${lz4_LIBRARY}) + include (CheckSymbolExists) + + check_symbol_exists (LZ4_compress_default + ${lz4_INCLUDE_DIR}/lz4.h + lz4_HAVE_COMPRESS_DEFAULT) + + set (lz4_LIBRARIES ${lz4_LIBRARY}) + set (lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR}) + + if (NOT (TARGET lz4::lz4)) + add_library (lz4::lz4 UNKNOWN IMPORTED) + + set_target_properties (lz4::lz4 + PROPERTIES + IMPORTED_LOCATION ${lz4_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS}) + endif () +endif () diff --git a/src/seastar/cmake/Findnumactl.cmake b/src/seastar/cmake/Findnumactl.cmake new file mode 100644 index 000000000..82f015274 --- /dev/null +++ b/src/seastar/cmake/Findnumactl.cmake @@ -0,0 +1,50 @@ +# +# 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. +# + +find_path (numactl_INCLUDE_DIR + NAMES numaif.h) + +find_library (numactl_LIBRARY + NAMES numa) + +mark_as_advanced ( + numactl_INCLUDE_DIR + numactl_LIBRARY) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (numactl + REQUIRED_VARS + numactl_LIBRARY + numactl_INCLUDE_DIR) + +set (numactl_INCLUDE_DIRS ${numactl_INCLUDE_DIR}) +set (numactl_LIBRARIES ${numactl_LIBRARY}) + +if (numactl_FOUND AND NOT (TARGET numactl::numactl)) + add_library (numactl::numactl UNKNOWN IMPORTED) + + set_target_properties (numactl::numactl + PROPERTIES + IMPORTED_LOCATION ${numactl_LIBRARIES} + INTERFACE_INCLUDE_DIRECTORIES ${numactl_INCLUDE_DIRS}) +endif () diff --git a/src/seastar/cmake/Findragel.cmake b/src/seastar/cmake/Findragel.cmake new file mode 100644 index 000000000..7bea8735b --- /dev/null +++ b/src/seastar/cmake/Findragel.cmake @@ -0,0 +1,45 @@ +# +# 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. +# + +find_program ( + ragel_RAGEL_EXECUTABLE + ragel) + +mark_as_advanced (ragel_RAGEL_EXECUTABLE) + +set (_ragel_version_pattern "[0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9]+)?") + +if (ragel_RAGEL_EXECUTABLE) + set (ragel_FOUND ON) + + exec_program (${ragel_RAGEL_EXECUTABLE} + ARGS -v + OUTPUT_VARIABLE _ragel_version_output) + + if (${_ragel_version_output} MATCHES "version (${_ragel_version_pattern})") + set (ragel_VERSION ${CMAKE_MATCH_1}) + endif () +endif () + +find_package_handle_standard_args (ragel + REQUIRED_VARS ragel_RAGEL_EXECUTABLE + VERSION_VAR ragel_VERSION) diff --git a/src/seastar/cmake/Findrt.cmake b/src/seastar/cmake/Findrt.cmake new file mode 100644 index 000000000..359043c0e --- /dev/null +++ b/src/seastar/cmake/Findrt.cmake @@ -0,0 +1,57 @@ +# +# 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. +# + +set (_rt_test_source ${CMAKE_CURRENT_LIST_DIR}/code_tests/rt_test.cc) + +# Try to compile without the library first. +try_compile (rt_NO_EXPLICIT_LINK + ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${_rt_test_source}) + +if (rt_NO_EXPLICIT_LINK) + set (rt_FOUND yes) +else () + # The `rt` library is required. + + try_compile (_rt_test + ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${_rt_test_source} + LINK_LIBRARIES rt) + + if (_rt_test) + set (rt_LIBRARY_NAME rt) + set (rt_LIBRARIES -l${rt_LIBRARY_NAME}) + endif () + + include (FindPackageHandleStandardArgs) + + find_package_handle_standard_args (rt + REQUIRED_VARS rt_LIBRARIES) +endif () + +if (rt_FOUND AND NOT (TARGET rt::rt)) + add_library (rt::rt INTERFACE IMPORTED) + + set_target_properties (rt::rt + PROPERTIES + INTERFACE_LINK_LIBRARIES "${rt_LIBRARIES}") +endif () diff --git a/src/seastar/cmake/Findyaml-cpp.cmake b/src/seastar/cmake/Findyaml-cpp.cmake new file mode 100644 index 000000000..eda5eb489 --- /dev/null +++ b/src/seastar/cmake/Findyaml-cpp.cmake @@ -0,0 +1,85 @@ +# +# 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. +# + +find_package (PkgConfig REQUIRED) + +pkg_search_module (PC_yaml-cpp QUIET yaml-cpp) + +find_library (yaml-cpp_LIBRARY_RELEASE + NAMES yaml-cpp + HINTS + ${PC_yaml-cpp_LIBDIR} + ${PC_yaml-cpp_LIBRARY_DIRS}) + +find_library (yaml-cpp_LIBRARY_DEBUG + NAMES yaml-cppd + HINTS + ${PC_yaml-cpp_LIBDIR} + ${PC_yaml-cpp_LIBRARY_DIRS}) + +include (SelectLibraryConfigurations) +select_library_configurations (yaml-cpp) + +find_path (yaml-cpp_INCLUDE_DIR + NAMES yaml-cpp/yaml.h + PATH_SUFFIXES yaml-cpp + HINTS + ${PC_yaml-cpp_INCLUDEDIR} + ${PC_yaml-cpp_INCLUDE_DIRS}) + +mark_as_advanced ( + yaml-cpp_LIBRARY_RELEASE + yaml-cpp_LIBRARY_DEBUG + yaml-cpp_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (yaml-cpp + REQUIRED_VARS + yaml-cpp_LIBRARY + yaml-cpp_INCLUDE_DIR + VERSION_VAR yaml-cpp_VERSION) + +if (yaml-cpp_FOUND) + set (yaml-cpp_LIBRARIES ${yaml-cpp_LIBRARY}) + set (yaml-cpp_INCLUDE_DIRS ${yaml-cpp_INCLUDE_DIR}) + if (NOT (TARGET yaml-cpp::yaml-cpp)) + add_library (yaml-cpp::yaml-cpp UNKNOWN IMPORTED) + + set_target_properties (yaml-cpp::yaml-cpp + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${yaml-cpp_INCLUDE_DIRS}) + if (EXISTS "${yaml-cpp_LIBRARY}") + set_target_properties (yaml-cpp::yaml-cpp + PROPERTIES + IMPORTED_LOCATION "${yaml-cpp_LIBRARY}") + endif () + foreach (build "RELEASE" "DEBUG") + if (yaml-cpp_LIBRARY_${build}) + set_property (TARGET yaml-cpp::yaml-cpp APPEND PROPERTY + IMPORTED_CONFIGURATIONS "${build}") + set_target_properties (yaml-cpp::yaml-cpp PROPERTIES + IMPORTED_LOCATION_${build} "${yaml-cpp_LIBRARY_${build}}") + endif () + endforeach () + endif () +endif () diff --git a/src/seastar/cmake/SeastarConfig.cmake.in b/src/seastar/cmake/SeastarConfig.cmake.in new file mode 100644 index 000000000..9fc8bd3de --- /dev/null +++ b/src/seastar/cmake/SeastarConfig.cmake.in @@ -0,0 +1,37 @@ +# +# 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. +# + +# We would like to use `find_dependency`, but it is not supported properly until CMake 3.8. +#include (FindDependencyMacro) + +list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +# +# Dependencies. +# + +include (SeastarDependencies) +seastar_find_dependencies () + +if (NOT TARGET Seastar::seastar) + include ("${CMAKE_CURRENT_LIST_DIR}/SeastarTargets.cmake") +endif () diff --git a/src/seastar/cmake/SeastarDependencies.cmake b/src/seastar/cmake/SeastarDependencies.cmake new file mode 100644 index 000000000..fbd5a8e1d --- /dev/null +++ b/src/seastar/cmake/SeastarDependencies.cmake @@ -0,0 +1,148 @@ +# +# 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) 2019 Scylladb, Ltd. +# + +include(CMakeParseArguments) + +# +# CMake bundles `FindBoost.cmake`, which is coupled to the Boost version. If +# we're on a system without a recent enough version of `FindBoost.cmake`, then +# we need to use the one bundled with Seastar. +# +# The "real" FIND_PACKAGE invocation for Boost is inside SEASTAR_FIND_DEPENDENCIES. +# + +# Be consistent in results from FindBoost.cmake. +# This is required because cmake-boost may return to Boost_{component}_LIBRARY: +# - /usr/lib64/libboost_foo.so +# - Boost::foo +set (Boost_NO_BOOST_CMAKE ON) + +if (CMAKE_CXX_STANDARD LESS 20) + set (_seastar_boost_version 1.64.0) +else () + # for including the fix of https://github.com/boostorg/test/pull/252 + set (_seastar_boost_version 1.73.0) +endif () + +# This is the minimum version of Boost we need the CMake-bundled `FindBoost.cmake` to know about. +find_package (Boost ${_seastar_boost_version} MODULE) + +# - set _seastar_dep_args_<package> for additional args for find_package(). +# add REQUIRED if the corresponding option is explicitly enabled, so +# find_package() can stop the cmake generation. +# - set _seastar_dep_skip_<package> if the option is explicitly disabled +macro (seastar_set_dep_args package) + cmake_parse_arguments(args "REQUIRED" "VERSION;OPTION" "COMPONENTS" ${ARGN}) + if (DEFINED args_VERSION) + list (APPEND _seastar_dep_args_${package} ${args_VERSION}) + endif () + if (args_REQUIRED) + list (APPEND _seastar_dep_args_${package} REQUIRED) + elseif (DEFINED args_OPTION) + if (args_OPTION) + list (APPEND _seastar_dep_args_${package} REQUIRED) + else () + set (_seastar_dep_skip_${package} TRUE) + endif () + endif () + if (args_COMPONENTS) + list (APPEND _seastar_dep_args_${package} COMPONENTS + ${args_COMPONENTS}) + endif () +endmacro () + +# +# Iterate through the dependency list defined below and execute `find_package` +# with the corresponding configuration for each 3rd-party dependency. +# +macro (seastar_find_dependencies) + # + # List of Seastar dependencies that is meant to be used + # both in Seastar configuration and by clients which + # consume Seastar via SeastarConfig.cmake. + # + set (_seastar_all_dependencies + # Public dependencies. + Boost + c-ares + cryptopp + dpdk # No version information published. + fmt + lz4 + # Private and private/public dependencies. + GnuTLS + LibUring + LinuxMembarrier + Sanitizers + SourceLocation + StdAtomic + hwloc + lksctp-tools # No version information published. + numactl # No version information published. + rt + yaml-cpp) + + # Arguments to `find_package` for each 3rd-party dependency. + # Note that the version specification is a "minimal" version requirement. + + # `unit_test_framework` is not required in the case we are building Seastar + # without the testing library, however the component is always specified as required + # to keep the CMake code minimalistic and easy-to-use. + seastar_set_dep_args (Boost REQUIRED + VERSION ${_seastar_boost_version} + COMPONENTS + filesystem + program_options + thread + unit_test_framework) + seastar_set_dep_args (c-ares REQUIRED + VERSION 1.13) + seastar_set_dep_args (cryptopp REQUIRED + VERSION 5.6.5) + seastar_set_dep_args (dpdk + OPTION ${Seastar_DPDK}) + seastar_set_dep_args (fmt REQUIRED + VERSION 5.0.0) + seastar_set_dep_args (lz4 REQUIRED + VERSION 1.7.3) + seastar_set_dep_args (GnuTLS REQUIRED + VERSION 3.3.26) + seastar_set_dep_args (LibUring + VERSION 2.0 + OPTION ${Seastar_IO_URING}) + seastar_set_dep_args (StdAtomic REQUIRED) + seastar_set_dep_args (hwloc + VERSION 1.11.2 + OPTION ${Seastar_HWLOC}) + seastar_set_dep_args (lksctp-tools REQUIRED) + seastar_set_dep_args (rt REQUIRED) + seastar_set_dep_args (numactl + OPTION ${Seastar_NUMA}) + seastar_set_dep_args (yaml-cpp REQUIRED + VERSION 0.5.1) + + foreach (third_party ${_seastar_all_dependencies}) + if (NOT _seastar_dep_skip_${third_party}) + find_package ("${third_party}" ${_seastar_dep_args_${third_party}}) + endif () + endforeach () +endmacro () diff --git a/src/seastar/cmake/code_tests/LinuxMembarrier_test.cc b/src/seastar/cmake/code_tests/LinuxMembarrier_test.cc new file mode 100644 index 000000000..7cb1fdfb0 --- /dev/null +++ b/src/seastar/cmake/code_tests/LinuxMembarrier_test.cc @@ -0,0 +1,8 @@ +extern "C" { +#include <linux/membarrier.h> +} + +int main() { + int x = MEMBARRIER_CMD_PRIVATE_EXPEDITED | MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED; + (void)x; +} diff --git a/src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc b/src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc new file mode 100644 index 000000000..9df531f26 --- /dev/null +++ b/src/seastar/cmake/code_tests/Sanitizers_fiber_test.cc @@ -0,0 +1,11 @@ +#include <cstddef> + +extern "C" { + void __sanitizer_start_switch_fiber(void**, const void*, size_t); + void __sanitizer_finish_switch_fiber(void*, const void**, size_t*); +} + +int main() { + __sanitizer_start_switch_fiber(nullptr, nullptr, 0); + __sanitizer_finish_switch_fiber(nullptr, nullptr, nullptr); +} diff --git a/src/seastar/cmake/code_tests/Source_location_default_argument.cc b/src/seastar/cmake/code_tests/Source_location_default_argument.cc new file mode 100644 index 000000000..828d91b87 --- /dev/null +++ b/src/seastar/cmake/code_tests/Source_location_default_argument.cc @@ -0,0 +1,10 @@ +#include<source_location> + +int test_source_location(int line, + std::source_location loc = std::source_location::current()) { + return line == loc.line() ? 0 : 1; +} + +int main() { + return test_source_location(__LINE__); +} diff --git a/src/seastar/cmake/code_tests/Source_location_test.cc b/src/seastar/cmake/code_tests/Source_location_test.cc new file mode 100644 index 000000000..fa43d3d42 --- /dev/null +++ b/src/seastar/cmake/code_tests/Source_location_test.cc @@ -0,0 +1,26 @@ +#if __has_include(<source_location>) +#include <source_location> +#endif + +#ifdef __cpp_lib_source_location +using source_location = std::source_location; +#elif __has_include(<experimental/source_location>) +#include <experimental/source_location> +using source_location = std::experimental::source_location; +#endif + +#if defined(__cpp_lib_source_location) || defined(__cpp_lib_experimental_source_location) +struct format_info { + format_info(source_location loc = source_location::current()) noexcept + : loc(loc) + { } + source_location loc; +}; +#else +struct format_info { }; +#endif + +int main() +{ + format_info fi; +} diff --git a/src/seastar/cmake/code_tests/rt_test.cc b/src/seastar/cmake/code_tests/rt_test.cc new file mode 100644 index 000000000..c0bf83e32 --- /dev/null +++ b/src/seastar/cmake/code_tests/rt_test.cc @@ -0,0 +1,10 @@ +extern "C" { +#include <signal.h> +#include <time.h> +} + +int main() { + timer_t td; + struct sigevent sev; + timer_create(CLOCK_MONOTONIC, &sev, &td); +} diff --git a/src/seastar/cmake/dpdk_configure.cmake b/src/seastar/cmake/dpdk_configure.cmake new file mode 100644 index 000000000..46b9bb759 --- /dev/null +++ b/src/seastar/cmake/dpdk_configure.cmake @@ -0,0 +1,41 @@ +# +# 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. +# + +file (READ ${Seastar_DPDK_CONFIG_FILE_IN} dpdk_config) +file (STRINGS ${Seastar_DPDK_CONFIG_FILE_CHANGES} dpdk_config_changes) +set (word_pattern "[^\n\r \t]+") + +foreach (var ${dpdk_config_changes}) + if (var MATCHES "(${word_pattern})=(${word_pattern})") + set (key ${CMAKE_MATCH_1}) + set (value ${CMAKE_MATCH_2}) + + string (REGEX REPLACE + "${key}=${word_pattern}" + "${key}=${value}" + dpdk_config + ${dpdk_config}) + endif () +endforeach () + +file (WRITE ${Seastar_DPDK_CONFIG_FILE_OUT} ${dpdk_config}) +file (APPEND ${Seastar_DPDK_CONFIG_FILE_OUT} "CONFIG_RTE_MACHINE=${Seastar_DPDK_MACHINE}") |