mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Android: Integrate vcpkg with Gradle build
This ensures that vcpkg downloads and builds all dependencies for Android. We add it as a CMAKE_TOOLCHAIN_FILE that then chainloads the Android NDK's toolchain file, as per the vcpkg documentation.
This commit is contained in:
committed by
Andrew Kaster
parent
ab82fc8993
commit
1d0de0b450
@@ -4,24 +4,39 @@ set -eo pipefail
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
SERENITY_ROOT="$(realpath "${DIR}"/../..)"
|
||||
LADYBIRD_SOURCE_DIR="$(realpath "${DIR}"/../..)"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "${SERENITY_ROOT}/Meta/shell_include.sh"
|
||||
. "${LADYBIRD_SOURCE_DIR}/Meta/shell_include.sh"
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. "${SERENITY_ROOT}/Meta/find_compiler.sh"
|
||||
. "${LADYBIRD_SOURCE_DIR}/Meta/find_compiler.sh"
|
||||
|
||||
pick_host_compiler
|
||||
|
||||
BUILD_DIR=${BUILD_DIR:-"${SERENITY_ROOT}/Build"}
|
||||
BUILD_DIR=${BUILD_DIR:-"${LADYBIRD_SOURCE_DIR}/Build"}
|
||||
CACHE_DIR=${CACHE_DIR:-"${BUILD_DIR}/caches"}
|
||||
|
||||
cmake -S "$SERENITY_ROOT/Meta/Lagom" -B "$BUILD_DIR/lagom-tools" \
|
||||
# HACK: This export of XDG_CACHE_HOME is required to make vcpkg happy.
|
||||
# This is because vcpkg tries to find a cache directory by:
|
||||
# 1) checking $XDG_CACHE_HOME
|
||||
# 2) appending "/.cache" to $HOME
|
||||
# The problem is, in the Android build environment, neither of those environment variables are set.
|
||||
# This causes vcpkg to fail; so, we set a dummy $XDG_CACHE_HOME, ensuring that vcpkg is happy.
|
||||
# (Note that vcpkg appends "/vcpkg" to the cache directory we give it.)
|
||||
# (And this also works on macOS, despite the fact that $XDG_CACHE_HOME is a Linux-ism.)
|
||||
export XDG_CACHE_HOME="$CACHE_DIR"
|
||||
|
||||
cmake -S "${LADYBIRD_SOURCE_DIR}/Meta/Lagom" -B "$BUILD_DIR/lagom-tools" \
|
||||
-GNinja -Dpackage=LagomTools \
|
||||
-DCMAKE_INSTALL_PREFIX="$BUILD_DIR/lagom-tools-install" \
|
||||
-DCMAKE_C_COMPILER="$CC" \
|
||||
-DCMAKE_CXX_COMPILER="$CXX" \
|
||||
-DSERENITY_CACHE_DIR="$CACHE_DIR"
|
||||
-DSERENITY_CACHE_DIR="$CACHE_DIR" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$LADYBIRD_SOURCE_DIR/Toolchain/Tarballs/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_MANIFEST_DIR="$LADYBIRD_SOURCE_DIR"
|
||||
|
||||
ninja -C "$BUILD_DIR/lagom-tools" install
|
||||
|
||||
Reference in New Issue
Block a user