From 7c813d3992d4e498d33fc7a67cc4f3acdabafc2e Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Wed, 17 Jul 2024 13:03:09 -0400 Subject: [PATCH] Meta+CI: Hook up the Lagom tools build with vcpkg AK will depend on some vcpkg dependencies, so the Lagom tools build will need to know how to use vcpkg. We can do this by sym-linking vcpkg.json to Meta/Lagom (as vcpkg.json has to be in the CMake source directory). We also need a CMakePresets.json in the source directory, which can just include the root file. The root CMakePresets then needs to define paths relative to ${fileDir} rather than ${sourceDir}. --- .github/workflows/lagom-template.yml | 9 ++++----- CMakePresets.json | 26 +++++++++++++------------- Meta/Lagom/CMakePresets.json | 11 +++++++++++ Meta/Lagom/vcpkg-configuration.json | 10 ++++++++++ Meta/Lagom/vcpkg.json | 1 + 5 files changed, 39 insertions(+), 18 deletions(-) create mode 100644 Meta/Lagom/CMakePresets.json create mode 100644 Meta/Lagom/vcpkg-configuration.json create mode 120000 Meta/Lagom/vcpkg.json diff --git a/.github/workflows/lagom-template.yml b/.github/workflows/lagom-template.yml index 26b9c8ec74d..8985ee69944 100644 --- a/.github/workflows/lagom-template.yml +++ b/.github/workflows/lagom-template.yml @@ -104,21 +104,20 @@ jobs: run: | set -e - cmake -GNinja -S Meta/Lagom -B ${{ github.workspace }}/tools-build \ + cmake --preset=CI -S Meta/Lagom -B ${{ github.workspace }}/Build/tools-build \ -DLAGOM_TOOLS_ONLY=ON \ -DINSTALL_LAGOM_TOOLS=ON \ - -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/tool-install \ - -DSERENITY_CACHE_DIR=${{ github.workspace }}/Build/caches \ + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/Build/tools-install \ -DCMAKE_C_COMPILER=gcc-13 \ -DCMAKE_CXX_COMPILER=g++-13 \ -Dpackage=LagomTools - ninja -C tools-build install + ninja -C ${{ github.workspace }}/Build/tools-build install cmake --preset Fuzzers_CI -B Build \ -DCMAKE_C_COMPILER=${{ steps.build-parameters.outputs.host_cc }} \ -DCMAKE_CXX_COMPILER=${{ steps.build-parameters.outputs.host_cxx }} \ - -DCMAKE_PREFIX_PATH=${{ github.workspace }}/tool-install + -DCMAKE_PREFIX_PATH=${{ github.workspace }}/Build/tools-install # === BUILD === diff --git a/CMakePresets.json b/CMakePresets.json index 54fbbe6665b..ccae939d40f 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -11,18 +11,18 @@ "displayName": "Default Config", "description": "Default build using Ninja generator", "generator": "Ninja", - "binaryDir": "${sourceDir}/Build/ladybird", + "binaryDir": "${fileDir}/Build/ladybird", "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "SERENITY_CACHE_DIR": "${sourceDir}/Build/caches", - "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake", + "SERENITY_CACHE_DIR": "${fileDir}/Build/caches", + "CMAKE_TOOLCHAIN_FILE": "${fileDir}/Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake", "VCPKG_INSTALL_OPTIONS": "--no-print-usage", - "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/Meta/CMake/vcpkg/release-triplets" + "VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/release-triplets" }, "environment": { - "LADYBIRD_SOURCE_DIR": "${sourceDir}", - "VCPKG_ROOT": "${sourceDir}/Toolchain/Tarballs/vcpkg", - "VCPKG_BINARY_SOURCES": "clear;files,${sourceDir}/Toolchain/Build/vcpkg-binary-cache,readwrite" + "LADYBIRD_SOURCE_DIR": "${fileDir}", + "VCPKG_ROOT": "${fileDir}/Toolchain/Tarballs/vcpkg", + "VCPKG_BINARY_SOURCES": "clear;files,${fileDir}/Toolchain/Build/vcpkg-binary-cache,readwrite" }, "vendor": { "jetbrains.com/clion": { @@ -35,10 +35,10 @@ "inherits": "default", "displayName": "Debug Config", "description": "Debug build using Ninja generator", - "binaryDir": "${sourceDir}/Build/ladybird-debug", + "binaryDir": "${fileDir}/Build/ladybird-debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/Meta/CMake/vcpkg/debug-triplets" + "VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/debug-triplets" } }, { @@ -46,11 +46,11 @@ "inherits": "Debug", "displayName": "Sanitizer Config", "description": "Debug build using Sanitizers", - "binaryDir": "${sourceDir}/Build/ladybird-sanitizers", + "binaryDir": "${fileDir}/Build/ladybird-sanitizers", "cacheVariables": { "ENABLE_UNDEFINED_SANITIZER": "ON", "ENABLE_ADDRESS_SANITIZER": "ON", - "VCPKG_OVERLAY_TRIPLETS": "${sourceDir}/Meta/CMake/vcpkg/sanitizer-triplets" + "VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/sanitizer-triplets" } }, { @@ -79,7 +79,7 @@ "inherits": ["vcpkg_ci", "default" ], "displayName": "Fuzzers Config", "description": "Fuzzers build with GitHub Actions cache", - "binaryDir": "${sourceDir}/Build/ladybird-fuzzers", + "binaryDir": "${fileDir}/Build/ladybird-fuzzers", "cacheVariables": { "CMAKE_BUILD_TYPE": "", "ENABLE_QT": "OFF", @@ -120,7 +120,7 @@ "stopOnFailure": true }, "environment": { - "LADYBIRD_SOURCE_DIR": "${sourceDir}" + "LADYBIRD_SOURCE_DIR": "${fileDir}" } }, { diff --git a/Meta/Lagom/CMakePresets.json b/Meta/Lagom/CMakePresets.json new file mode 100644 index 00000000000..6939dbdaf81 --- /dev/null +++ b/Meta/Lagom/CMakePresets.json @@ -0,0 +1,11 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "include": [ + "../../CMakePresets.json" + ] +} diff --git a/Meta/Lagom/vcpkg-configuration.json b/Meta/Lagom/vcpkg-configuration.json new file mode 100644 index 00000000000..0cc5bcb0c70 --- /dev/null +++ b/Meta/Lagom/vcpkg-configuration.json @@ -0,0 +1,10 @@ +{ + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ], + "overlay-ports": [ "../../Meta/CMake/vcpkg/overlay-ports" ] +} diff --git a/Meta/Lagom/vcpkg.json b/Meta/Lagom/vcpkg.json new file mode 120000 index 00000000000..fa268e15ef8 --- /dev/null +++ b/Meta/Lagom/vcpkg.json @@ -0,0 +1 @@ +../../vcpkg.json \ No newline at end of file