seastar icon indicating copy to clipboard operation
seastar copied to clipboard

`vcpkg` and CMake `FetchContent` installation of Seastar + dependencies

Open GavinRay97 opened this issue 2 years ago • 2 comments

Hiya,

I think that using vcpkg and FetchContent could be a potentially simpler solution to the current installation, with the added bonus of being idempotent (versus one command that builds/installs seastar and its dependencies, and then one to build your own project).

I'm not an expert in either of these technologies, but I've got the below as a draft:

{
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
  "name": "learning-database",
  "version": "0.0.1",
  "dependencies": ["fmt", "folly", "catch2", "liburing", "jemalloc"], // ignore these, custom to my project
  "default-features": ["seastar"],
  "features": {
    "seastar": {
      "description": "https://github.com/scylladb/seastar",
      "dependencies": [
          {"name": "boost-atomic", "version>=": "1.77.0"},
          {"name": "boost-chrono", "version>=": "1.77.0"},
          {"name": "boost-date-time", "version>=": "1.77.0"},
          {"name": "boost-filesystem", "version>=": "1.77.0"},
          {"name": "boost-program-options", "version>=": "1.77.0"},
          {"name": "boost-system", "version>=": "1.77.0"},
          {"name": "boost-test", "version>=": "1.77.0"},
          {"name": "boost-thread", "version>=": "1.77.0"},
          {"name": "gmp", "version>=": "6.1.2"},
          {"name": "hwloc", "version>=": "2.2.0"},
          {"name": "ragel", "version>=": "6.10"},
          {"name": "libgnutls", "version>=": "3.5.18"},
          {"name":  "zlib", "version>=": "1.2.12"},
          {"name":  "yaml-cpp", "version>=": "0.5.3"},
          {"name":  "c-ares", "version>=": "1.13.0"},
          {"name":  "cryptopp", "version>=": "5.6.5"},
          {"name":  "lz4", "version>=": "1.8.0"},
          {"name":  "fmt", "version>=": "5.2.1"},
          {"name":  "liburing", "version>=": "2.1.0"}
      ]
    },
    "seastar-dpdk": {
      "description": "DPDK support for Seastar",
        "dependencies": [
            {"name": "dpdk", "version>=": "19.0.5"}
        ]
    }
  }
}
cmake_minimum_required(VERSION 3.22)
set(CMAKE_CXX_STANDARD 23)
set(VCPKG_TARGET_TRIPLET x64-linux)

include(FetchContent)
FetchContent_Declare(vcpkg
    GIT_REPOSITORY https://github.com/microsoft/vcpkg/
    GIT_TAG 2022.09.27
)
FetchContent_MakeAvailable(vcpkg)

# NOTE: This must be defined before the first project call
set(CMAKE_TOOLCHAIN_FILE "${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake" CACHE FILEPATH "")

FetchContent_Declare(seastar
        GIT_REPOSITORY https://github.com/scylladb/seastar
        GIT_TAG ac59132009f0ebd32a199031ac6579997d147da3
)
FetchContent_MakeAvailable(seastar)

project(my_project)
find_package(seastar CONFIG REQUIRED)

There are two small issues with this that I can see:

  1. Every library in https://github.com/scylladb/seastar/blob/master/cooking_recipe.cmake exists in vcpkg ports, except for lksctp-tools, so that one will need to be installed manually or with CMake external projects I guess?
  2. It seems like many of the projects in cooking_recipe.cmake have custom compile configs. Will it break seastar if these are not present?
    • If so, I suppose that would mean that either:
      • A) Custom vcpkg port patches would need to be made with Seastar compile options
      • B) CMake ExternalProject commands could be used instead of vcpkg?

This is just a suggestion/idea, maybe it is not feasible in practice, but I would be interested in hearing what other folks think of this 👍

GavinRay97 avatar Oct 22 '22 16:10 GavinRay97

if anyone is interested, i can share our Meson build for Seastar. Meson has a built-in package manager, so no bolt-on or homebrewed solutions needed.

dotnwat avatar Nov 02 '22 17:11 dotnwat

sharing is caring @dotnwat why hasn't the vcpkg port been followed up with

ebenali avatar Mar 11 '24 10:03 ebenali