From 5681dbee64647b23eb61cd21e5e5349ecf9ca9c3 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 30 Sep 2024 12:55:24 -0400 Subject: [PATCH] Meta: Move the vcpkg installation/cache directories under Build In addition to changing the build-type dependent build directories, we can take this opportunity to move the vcpkg cache directory to the Build folder itself. This probably isn't 100% needed, but it ensures that no leftover artifacts are used from non-dynamic vcpkg builds, and it's also generally nice to have all build artifacts under Build. --- .github/workflows/ladybird-js-artifacts.yml | 2 +- .github/workflows/lagom-template.yml | 2 +- .github/workflows/libjs-test262.yml | 2 +- .github/workflows/nightly-android.yml | 2 +- CMakePresets.json | 4 ++-- Documentation/Troubleshooting.md | 2 +- Ladybird/Android/BuildLagomTools.sh | 4 ++-- Ladybird/Android/build.gradle.kts | 2 +- Meta/ladybird.sh | 4 ++-- Toolchain/BuildVcpkg.py | 15 ++++----------- 10 files changed, 16 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ladybird-js-artifacts.yml b/.github/workflows/ladybird-js-artifacts.yml index 44996e1c625..6a7bd12b470 100644 --- a/.github/workflows/ladybird-js-artifacts.yml +++ b/.github/workflows/ladybird-js-artifacts.yml @@ -5,7 +5,7 @@ on: [push] env: LADYBIRD_SOURCE_DIR: ${{ github.workspace }} CCACHE_DIR: ${{ github.workspace }}/.ccache - VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg + VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" jobs: diff --git a/.github/workflows/lagom-template.yml b/.github/workflows/lagom-template.yml index 12fd0367d94..793ae7c1874 100644 --- a/.github/workflows/lagom-template.yml +++ b/.github/workflows/lagom-template.yml @@ -26,7 +26,7 @@ env: # github.workspace = /home/runner/work/ladybird/ladybird LADYBIRD_SOURCE_DIR: ${{ github.workspace }} CCACHE_DIR: ${{ github.workspace }}/.ccache - VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg + VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # Use the compiler version for the ccache compiler hash. Otherwise, if plugins are enabled, the plugin .so files diff --git a/.github/workflows/libjs-test262.yml b/.github/workflows/libjs-test262.yml index 7bfcc415fe0..99f49220368 100644 --- a/.github/workflows/libjs-test262.yml +++ b/.github/workflows/libjs-test262.yml @@ -4,7 +4,7 @@ on: [push] env: LADYBIRD_SOURCE_DIR: ${{ github.workspace }} - VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg + VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg jobs: run_and_update_results: diff --git a/.github/workflows/nightly-android.yml b/.github/workflows/nightly-android.yml index b610d649068..4643f01f22e 100644 --- a/.github/workflows/nightly-android.yml +++ b/.github/workflows/nightly-android.yml @@ -10,7 +10,7 @@ env: # github.workspace = /home/runner/work/ladybird/ladybird LADYBIRD_SOURCE_DIR: ${{ github.workspace }} CCACHE_DIR: ${{ github.workspace }}/.ccache - VCPKG_ROOT: ${{ github.workspace }}/Toolchain/Tarballs/vcpkg + VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" concurrency: diff --git a/CMakePresets.json b/CMakePresets.json index ee569282325..b0540ed3752 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -20,8 +20,8 @@ }, "environment": { "LADYBIRD_SOURCE_DIR": "${fileDir}", - "VCPKG_ROOT": "${fileDir}/Toolchain/Tarballs/vcpkg", - "VCPKG_BINARY_SOURCES": "clear;files,${fileDir}/Toolchain/Build/vcpkg-binary-cache,readwrite;$penv{VCPKG_BINARY_SOURCES}" + "VCPKG_ROOT": "${fileDir}/Build/vcpkg", + "VCPKG_BINARY_SOURCES": "clear;files,${fileDir}/Build/caches/vcpkg-binary-cache,readwrite;$penv{VCPKG_BINARY_SOURCES}" }, "vendor": { "jetbrains.com/clion": { diff --git a/Documentation/Troubleshooting.md b/Documentation/Troubleshooting.md index 1d2eb6286aa..8b56b577583 100644 --- a/Documentation/Troubleshooting.md +++ b/Documentation/Troubleshooting.md @@ -42,6 +42,6 @@ When building with the Qt chrome on macOS, you may encounter the following messa …followed by 14-line stack trace, the top of which is this: -> Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package) +> Build/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package) …and all of it shown in bright yellow, making you think it must be important and something must need to be fixed. But that’s not the case. Instead, despite that, you’ll be able to build successfully with the Qt chrome. diff --git a/Ladybird/Android/BuildLagomTools.sh b/Ladybird/Android/BuildLagomTools.sh index c0f93aa97ef..61955ef0e15 100755 --- a/Ladybird/Android/BuildLagomTools.sh +++ b/Ladybird/Android/BuildLagomTools.sh @@ -37,10 +37,10 @@ cmake -S "${LADYBIRD_SOURCE_DIR}/Meta/Lagom" -B "$BUILD_DIR/lagom-tools" \ -DSERENITY_CACHE_DIR="$CACHE_DIR" \ -DLAGOM_TOOLS_ONLY=ON \ -DINSTALL_LAGOM_TOOLS=ON \ - -DCMAKE_TOOLCHAIN_FILE="$LADYBIRD_SOURCE_DIR/Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake" \ + -DCMAKE_TOOLCHAIN_FILE="$LADYBIRD_SOURCE_DIR/Build/vcpkg/scripts/buildsystems/vcpkg.cmake" \ -DVCPKG_INSTALL_OPTIONS="--no-print-usage" \ -DVCPKG_OVERLAY_TRIPLETS="$LADYBIRD_SOURCE_DIR/Meta/CMake/vcpkg/release-triplets" \ - -DVCPKG_ROOT="$LADYBIRD_SOURCE_DIR/Toolchain/Tarballs/vcpkg" \ + -DVCPKG_ROOT="$LADYBIRD_SOURCE_DIR/Build/vcpkg" \ -DVCPKG_MANIFEST_DIR="$LADYBIRD_SOURCE_DIR" ninja -C "$BUILD_DIR/lagom-tools" install diff --git a/Ladybird/Android/build.gradle.kts b/Ladybird/Android/build.gradle.kts index 38633dbc8eb..b14de17efc3 100644 --- a/Ladybird/Android/build.gradle.kts +++ b/Ladybird/Android/build.gradle.kts @@ -40,7 +40,7 @@ android { "-DLagomTools_DIR=$buildDir/lagom-tools-install/share/LagomTools", "-DANDROID_STL=c++_shared", "-DSERENITY_CACHE_DIR=$cacheDir", - "-DVCPKG_ROOT=$sourceDir/Toolchain/Tarballs/vcpkg", + "-DVCPKG_ROOT=$sourceDir/Build/vcpkg", "-DVCPKG_TARGET_ANDROID=ON" ) } diff --git a/Meta/ladybird.sh b/Meta/ladybird.sh index 2255f53f88e..741dcbe1935 100755 --- a/Meta/ladybird.sh +++ b/Meta/ladybird.sh @@ -99,8 +99,8 @@ cmd_with_target() { CMAKE_ARGS+=("-DCMAKE_INSTALL_PREFIX=$LADYBIRD_SOURCE_DIR/Build/ladybird-install-${BUILD_PRESET}") - export PATH="$LADYBIRD_SOURCE_DIR/Toolchain/Local/cmake/bin:$LADYBIRD_SOURCE_DIR/Toolchain/Local/vcpkg/bin:$PATH" - export VCPKG_ROOT="$LADYBIRD_SOURCE_DIR/Toolchain/Tarballs/vcpkg" + export VCPKG_ROOT="${LADYBIRD_SOURCE_DIR}/Build/vcpkg" + export PATH="${LADYBIRD_SOURCE_DIR}/Toolchain/Local/cmake/bin:${VCPKG_ROOT}:${PATH}" } ensure_target() { diff --git a/Toolchain/BuildVcpkg.py b/Toolchain/BuildVcpkg.py index 44c68c40a0a..0b6d8ca8a5f 100755 --- a/Toolchain/BuildVcpkg.py +++ b/Toolchain/BuildVcpkg.py @@ -4,7 +4,6 @@ import os import subprocess import pathlib import sys -import shutil def main() -> int: @@ -13,12 +12,12 @@ def main() -> int: git_repo = "https://github.com/microsoft/vcpkg.git" git_rev = "10b7a178346f3f0abef60cecd5130e295afd8da4" # 2024.10.21 - tarball_dir = script_dir / "Tarballs" - tarball_dir.mkdir(parents=True, exist_ok=True) - vcpkg_checkout = tarball_dir / "vcpkg" + build_dir = script_dir.parent / "Build" + build_dir.mkdir(parents=True, exist_ok=True) + vcpkg_checkout = build_dir / "vcpkg" if not vcpkg_checkout.is_dir(): - subprocess.check_call(args=["git", "clone", git_repo], cwd=tarball_dir) + subprocess.check_call(args=["git", "clone", git_repo], cwd=build_dir) else: bootstrapped_vcpkg_version = subprocess.check_output( ["git", "-C", vcpkg_checkout, "rev-parse", "HEAD"]).strip().decode() @@ -34,12 +33,6 @@ def main() -> int: bootstrap_script = "bootstrap-vcpkg.bat" if os.name == 'nt' else "bootstrap-vcpkg.sh" subprocess.check_call(args=[vcpkg_checkout / bootstrap_script, "-disableMetrics"], cwd=vcpkg_checkout, shell=True) - install_dir = script_dir / "Local" / "vcpkg" / "bin" - install_dir.mkdir(parents=True, exist_ok=True) - - vcpkg_name = "vcpkg.exe" if os.name == 'nt' else "vcpkg" - shutil.copy(vcpkg_checkout / vcpkg_name, install_dir / vcpkg_name) - return 0