OpenMS
Loading...
Searching...
No Matches
Managing dependencies with vcpkg

OpenMS can obtain its third-party dependencies (Boost,Eigen, Apache Arrow, etc.) through vcpkg, Microsoft's cross-platform C/C++ package manager, instead of the system package manager or the contrib package. vcpkg builds vcpkg resolves the manifest and builds or restores packages as needed in a fixed, reproducible configuration, which make it easiest way to get a consistent set of libraries across Linux, macOS and Windows.

The set of dependencies and their versions or features are declared in the manifest file vcpkg.json at the root of the repository, and an overlay settings are declared in vcpkg-configuration.json. For a general introduction to vcpkg and manifest mode, see the vcpkg documentation.

The overlay directory

Most of the libraries OpenMS depends are available, unmodified from the public vcpkg directory. A few, however needs a patch, file changes or do not exist in the registry at all (for example the header-only pylmcf/wnet/wnetalign libraries used for Wasserstein network alignment feature or the openms-thermo-bridge library used for native Thermo RAW file support). For these cases OpenMS ships its own overlay ports in the vcpkg-overlays/ directory:

  • vcpkg-overlays/ports contain one subdirectory per port. A port here can either replace a port of the same name from the public registry(e.g., to apply a patch or edit the existing port files) or provide an entirely a new port that is not available upstream at all (e.g., opentime, isospec, pylmcf, etc.).
  • vcpkg-overlays/triplets contains custom triplets used to build these dependencies with non-default settings.

These locations are wired up via the overlay-ports and overlay-triplets keys in vcpkg-configuration.json, so vcpkg automatically picks them up whenever it resolves a port name. If you need to add or edit the corresponding subdirectory under vcpkg-overlays/ports; see the vcpkg overlay-ports and the packaging details for details on writing a overlay-port.

System prerequisites

OpenMS need an underlying compiler, build generator, and (because some vcpkg ports build upstream projects using an autotools build system, and because WITH_GUI is on by default) the autotools chain and GUI/OpenGL prerequisites below.

Linux

A C++23-capable compiler is required; see Compiler Requirements for the minimum supported GCC/Clang versions.

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -qq install -y \
build-essential \
cmake \
ninja-build \
autoconf \
autoconf-archive \
automake \
libtool \
patch \
ccache \
curl \
git \
zip \
unzip \
pkg-config \
flex \
bison
# GUI dependencies (can be skipped for non-GUI builds):
if [ "${SKIP_GUI_DEPS:-false}" = false ]; then
# GUI dependencies (libgl-dev, xvfb) for building/testing TOPPView, TOPPAS:
sudo apt-get -qq install -y \
libgl-dev \
xvfb
sudo apt-get -qq install -y \
qt6-base-dev \
libqt6svg6-dev \
libqt6opengl6-dev \
libqt6openglwidgets6
fi
# Install uv (Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Optional dependencies:
sudo apt-get -qq install -y \
doxygen \
graphviz

macOS

A C++23-capable Xcode installation is required; see Required Applications and Dependencies.

brew update
brew install \
ccache \
ninja \
bison \
flex \
autoconf \
autoconf-archive \
automake \
libtool \
pkg-config \
bash \
uv
# bison/flex: vcpkg requires newer versions than the one Apple ships.
# In CI, prepend the Homebrew versions to PATH via GITHUB_PATH. For
# local build add equivalent lines:
if [ -n "${GITHUB_PATH:-}" ]; then
echo "$(brew --prefix bison)/bin" >> "$GITHUB_PATH"
echo "$(brew --prefix flex)/bin" >> "$GITHUB_PATH"
else
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH"
#To make it permanent, add the same line to ~/.zshrc
fi
# GUI dependencies (can be skipped for non-GUI builds):
if [ "$SKIP_GUI_DEPS" = false ]; then
brew install qtbase qtsvg
fi
# Optional documentation dependencies:
if [ "$SKIP_DOC_DEPS" = false ]; then
brew install \
doxygen \
graphviz
fi

Building OpenMS with vcpkg

  1. vcpkg is included as a git submodule, so make it sure it is checked out alongside the rest of source tree:

    OPENMS_DIR=~/openms-development
    mkdir -p "$OPENMS_DIR"
    cd "$OPENMS_DIR"
    git clone --recurse-submodules https://github.com/OpenMS/OpenMS

    If you already have a clone without the vcpkg submodule initialized. run:

    cd "$OPENMS_DIR/OpenMS"
    git submodule update --init vcpkg

    Building with presets uses [Ninja][https://ninja-build.org/] as the generator, so make sure it is installed and available on your PATH.

  2. Configure, build and (optionally) test using a preset name for your platform. For example, on Linux x64:

    cd "$OPENMS_DIR/OpenMS"
    cmake --preset linux-x64-release
    cmake --build --preset linux-x64-release
    ctest --preset linux-x64-release

    The resulting build directory is build/linux-x64-release (each preset gets its own directory, so debug/release/relwithdebinfo builds don't clash). Substitute the preset name for your platform and desired build type; run cmake --list-presets to see all available presets, including the *-ci presets used by the CI pipeline, which additionally enable most optional features via VCPKG_MANIFEST_FEATURES (see below).

    The first configure of a given preset can take a while, since it builds all vcpkg dependencies for that triplet from source; subsequent configures reuse the already-built packages from build/<preset>/vcpkg_installed/.

  3. If you need a configuration that isn't covered by a preset, you can still configure manually, mirroring what the presets do under the hood:

    mkdir -p "$OPENMS_DIR/openms_build"
    cd "$OPENMS_DIR/openms_build"
    cmake -DOPENMS_USE_VCPKG=ON \
    -DCMAKE_TOOLCHAIN_FILE="$OPENMS_DIR/OpenMS/vcpkg/scripts/buildsystems/vcpkg.cmake" \
    "$OPENMS_DIR/OpenMS"
    cmake --build .

Optional OpenMS features that pull in additional dependencies (HDF5, ONNX Runtime, the Wasserstein network alignment libraries, etc.) need two** things to be turned on together: the corresponding CMake option (e.g. -DWITH_HDF5=ON, -DWITH_ONNX=ON) and the matching vcpkg manifest feature via -DVCPKG_MANIFEST_FEATURES="<feature1>;<feature2>;...", so that vcpkg actually installs the extra dependency. The *-ci presets show an example enabling several of these together:

-DVCPKG_MANIFEST_FEATURES="isospec;wnetalign;onnxruntime" \
-DWITH_ONNX=ON -DWITH_WNETALIGN=ON -DUSE_EXTERNAL_ISOSPEC=ON

See Building OpenMS on GNU/Linux or other operating system build docs for the full list of WITH_*/USE_EXTERNAL_* build flags and what each optional feature does.

Note
OPENMS_USE_VCPKG is an alternative to, not a combination with, the system/contrib-based dependency discovery.