Files
ResInsight/vcpkg-readme.md
T
Magne Sjaastad 3052d3d554 Select RHEL8 vcpkg-configuration.json via CMake instead of renaming the tracked file
* Select RHEL8 vcpkg-configuration.json via CMake instead of renaming the tracked file

RHEL8 CI jobs previously ran 'cp vcpkg-configuration-rhel8.json vcpkg-configuration.json'
before configuring, temporarily overwriting the tracked default configuration
in the checkout. The vcpkg toolchain file only defaults VCPKG_MANIFEST_DIR to
CMAKE_SOURCE_DIR when it is not already defined, and reads it while processing
project(), so setting VCPKG_MANIFEST_DIR earlier -- before project() -- lets
vcpkg read a different vcpkg-configuration.json without ever touching the
tracked file.

Add a RESINSIGHT_VCPKG_PROFILE cache variable, implemented in the new
cmake/ResInsightVcpkgProfile.cmake (included from the root CMakeLists.txt
before project(), which is required for VCPKG_MANIFEST_DIR to take effect).
When set (e.g. to 'rhel8'), it copies vcpkg.json and
vcpkg-configuration-<profile>.json into a profile-specific directory under
the build tree and points VCPKG_MANIFEST_DIR there. The copy is regenerated on
every configure, so it can never drift from the root vcpkg.json.

overlay-ports/overlay-triplets entries (e.g. 'ThirdParty/vcpkg-overlay-ports')
are resolved by vcpkg relative to the directory vcpkg-configuration.json lives
in, so repo-relative 'ThirdParty/...' paths are rewritten to absolute paths
right after the copy is generated, keeping them valid from the new location.

Update the RHEL8 workflows and Dockerfile.rhel8 build-warmup stage to pass
-DRESINSIGHT_VCPKG_PROFILE=rhel8 instead of the cp step, and update
vcpkg-readme.md to describe the new mechanism.

* #14733 Use x64-linux-release vcpkg triplet explicitly in RHEL8 CI

The RHEL8 CI workflows and the Docker image's warmup/vcpkg-cache stages
did not set VCPKG_TARGET_TRIPLET/VCPKG_HOST_TRIPLET, so vcpkg fell back
to its plain x64-linux default triplet, which builds both debug and
release variants of every dependency even though the CI build is
Release-only. Set both to x64-linux-release consistently across the
image's vcpkg install, the warmup CMake configure, and the two
consuming workflows so the baked binary cache and the CI configure use
matching ABI hashes and skip the unused debug builds.
2026-09-11 22:49:16 +02:00

1.9 KiB

vcpkg Configuration

Files

File Purpose
vcpkg-configuration.json Default registry configuration used by all builds
vcpkg-configuration-rhel8.json RHEL8-specific registry configuration with a separate baseline

Changing the baseline

The baseline field in each configuration file pins the vcpkg registry to a specific commit of microsoft/vcpkg. Packages available at that commit are used for dependency resolution.

  • Update vcpkg-configuration.json for the default (Ubuntu/Windows) builds.
  • Update vcpkg-configuration-rhel8.json independently when a different baseline is needed for RHEL8 (Rocky Linux 8) compatibility — e.g. to match older system libraries (glibc 2.28, OpenSSL 1.1).

RHEL8 CI usage

Selecting the RHEL8 configuration does not rename or overwrite the tracked vcpkg-configuration.json. Instead, the root CMakeLists.txt accepts a RESINSIGHT_VCPKG_PROFILE cache variable. When set, it copies vcpkg.json and vcpkg-configuration-<profile>.json into a profile-specific directory under the build tree and points vcpkg's VCPKG_MANIFEST_DIR at it, before project() triggers the vcpkg toolchain file. This must happen before project(): the toolchain file only defaults VCPKG_MANIFEST_DIR to CMAKE_SOURCE_DIR when the variable is not already defined, and it reads that value while processing project().

The workflows .github/workflows/rhel8-unit-tests.yml and .github/workflows/rhel8-package.yml (and .github/docker/Dockerfile.rhel8) select the RHEL8 baseline by passing this flag to cmake:

cmake -S /src -B /src/cmakebuild -G Ninja \
  ... \
  -DRESINSIGHT_VCPKG_PROFILE=rhel8 \
  -DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake

This ensures vcpkg uses the RHEL8 baseline without affecting other CI runs, and without ever mutating a tracked file in the source tree.