Skip to content

Commit

Permalink
Wip: Vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
ADKaster committed Oct 13, 2024
1 parent ca5752d commit 95f8e66
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
9 changes: 4 additions & 5 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {},
"./features/ladybird": {
"llvm_version": 18,
"llvm_version": 18
},
"./features/vcpkg-cache": {},
"ghcr.io/devcontainers/features/desktop-lite": {
"password": "vscode",
"webPort": "6080",
Expand Down Expand Up @@ -44,17 +45,15 @@
"Toolchain/Local/**": true,
"Toolchain/Tarballs/**": true,
"Toolchain/Build/**": true,
"Build/**": true,
"Build/**": true
},
"search.exclude": {
"**/.git": true,
"Toolchain/Local/**": true,
"Toolchain/Tarballs/**": true,
"Toolchain/Build/**": true,
"Build/**": true,
"Build/**": true
},
// Force clang-format to respect Ladybird's .clang-format style file. This is not necessary if you're not using the Microsoft C++ extension.
"C_Cpp.clang_format_style": "file",
// Tab settings
"editor.tabSize": 4,
"editor.useTabStops": false,
Expand Down
10 changes: 10 additions & 0 deletions .devcontainer/features/vcpkg-cache/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "Caches Ladybird's vcpkg dependencies",
"id": "vcpkg-cache",
"version": "1.0.0",
"description": "Create a prebuilt vcpkg binary cache for Ladybird developer use",
"installsAfter": [ "./features/ladybird" ],
"containerEnv": {
"VCPKG_BINARY_SOURCES": ";files,/usr/local/share/vcpkg-binary-cache,read"
}
}
24 changes: 24 additions & 0 deletions .devcontainer/features/vcpkg-cache/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
# Prebuild ladybird's vcpkg dependencies
set -e

# FIXME: Add some options to make this more flexible
# FIXME: Find a way to do this without cloning ladybird

cd /tmp

CACHE_DIR=/usr/local/share/vcpkg-binary-cache
mkdir -p ${CACHE_DIR}

# Clone ladybird to get access to vcpkg.json and vcpkg commit id
git clone https://github.com/LadybirdBrowser/ladybird.git --depth 1
cd ladybird
# Grab and bootstrap the exact commit of vcpkg that trunk is using
python3 ./Toolchain/BuildVcpkg.py

# Install the vcpkg.json in manifest mode from the root of the repo
# Set the binary cache directory to the one we intend to use at container runtime
export VCPKG_ROOT="${PWD}/Toolchain/Tarballs/vcpkg"
export VCPKG_BINARY_SOURCES="clear;files,${CACHE_DIR},readwrite"

./Toolchain/Local/vcpkg/bin/vcpkg install
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"SERENITY_CACHE_DIR": "${fileDir}/Build/caches",
"CMAKE_TOOLCHAIN_FILE": "${fileDir}/Toolchain/Tarballs/vcpkg/scripts/buildsystems/vcpkg.cmake",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_INSTALL_OPTIONS": "--no-print-usage",
"VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/release-triplets"
},
"environment": {
"LADYBIRD_SOURCE_DIR": "${fileDir}",
"VCPKG_ROOT": "${fileDir}/Toolchain/Tarballs/vcpkg",
"VCPKG_BINARY_SOURCES": "clear;files,${fileDir}/Toolchain/Build/vcpkg-binary-cache,readwrite"
"VCPKG_BINARY_SOURCES": "clear;files,${fileDir}/Toolchain/Build/vcpkg-binary-cache,readwrite;$penv{VCPKG_BINARY_SOURCES}"
},
"vendor": {
"jetbrains.com/clion": {
Expand Down

0 comments on commit 95f8e66

Please sign in to comment.