Classic mode ============ `vcpkg classic mode`_ is less recommended than `vcpkg manifest mode`_ but remains a solid approach to compile Rat C++ libraries with vcpkg_. It allows to install packages globally using the local vcpkg repository which has been bootsrapped during the previous :doc:`setup` section. All binaries then reside in this directory and all projects can share this same installation. `vcpkg classic mode`_ however does not allow precise versioning of the packages to compile and install, unlike `vcpkg manifest mode`_. Consume packages ---------------- Using `vcpkg classic mode`_ the idea is to exposes `rat-vcpkg/ports`_ as **overlays** by passing the ``--overlay-ports=ports`` flag to the install command to make vcpkg_ aware of these port definitions. vcpkg_ solves dependencies quite neatly so one can try to install ``rat-models`` using the desired `vcpkg triplet`_ to get the whole dependency chain started. .. warning:: VTK ports recently changed to introduce a ``vtk-compile-tools`` port which is host specific and might break CMake_ configuration. To fix this, ensure the ``vtk-compile-tools`` package is installed in **global vcpkg using classic mode** by running the following command from outside the current manifest project: ``vcpkg install vtk-compile-tools`` - Clone the Rat-vcpkg_ repository: .. code-block:: powershell git clone https://gitlab.com/project-rat-extras/rat-vcpkg.git - Run the following command from within the cloned Rat-vcpkg_ repository: .. code-block:: powershell # Need to point to local Rat-vcpkg ports directory vcpkg install rat-models:x64-windows-release --overlay-ports=ports --clean-after-build # or if one needs to keep the buildtrees for debugging purposes vcpkg install rat-models:x64-windows-release --overlay-ports=ports .. note:: Depencies might take some time to build depending on the hardware. The heaviest one for Rat seems to be VTK, which is even longer to build in ``Debug``. This will install packages in the local vcpkg repository. - Ensure the ``VCPKG_ROOT`` environment variable is defined and points to the local vcpkg repository installation. - Configure a CMake_ project using the vcpkg toolchain file: .. code-block:: powershell cd myproject cmake -B build -S . -G "Ninja" ` -DCMAKE_BUILD_TYPE="Release" ` -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" ` -DVCPKG_TARGET_TRIPLET="x64-windows-release" ` -DVCPKG_HOST_TRIPLET="x64-windows-release" - Build the project: .. code-block:: powershell cmake --build build .. Links .. _CMake: https://cmake.org .. _Project-Rat: https://gitlab.com/project-rat .. _Rat-Docs: https://gitlab.com/project-rat/rat-documentation .. _Rat-vcpkg: https://gitlab.com/project-rat-extras/rat-vcpkg .. _rat-vcpkg/ports: https://gitlab.com/project-rat-extras/rat-vcpkg/-/tree/main/ports?ref_type=heads .. _vcpkg: https://vcpkg.io/en/ .. _vcpkg binary caching: https://learn.microsoft.com/en-us/vcpkg/users/binarycaching .. _vcpkg classic mode: https://learn.microsoft.com/en-us/vcpkg/concepts/ports .. _vcpkg manifest mode: https://learn.microsoft.com/en-us/vcpkg/consume/manifest-mode?tabs=msbuild%2Cbuild-MSBuild .. _vcpkg ports: https://learn.microsoft.com/en-us/vcpkg/concepts/ports .. _vcpkg triplet: https://learn.microsoft.com/en-gb/vcpkg/concepts/triplets