Meta: Use a common function for getting build directory

Between WPT.sh and ladybird.sh.

This is useful to me as I set my default build configuration to Debug,
and have been hacking around with the WPT script to align with this
configuration.
This commit is contained in:
Shannon Booth 2024-10-09 18:32:11 +13:00 committed by Tim Ledbetter
parent 16f68ab1bd
commit 7ea17d2fea
Notes: github-actions[bot] 2024-10-09 10:32:49 +00:00
3 changed files with 31 additions and 14 deletions

View file

@ -12,13 +12,18 @@ ensure_ladybird_source_dir
WPT_SOURCE_DIR=${WPT_SOURCE_DIR:-"${LADYBIRD_SOURCE_DIR}/Tests/LibWeb/WPT/wpt"}
WPT_REPOSITORY_URL=${WPT_REPOSITORY_URL:-"https://github.com/web-platform-tests/wpt.git"}
BUILD_PRESET=${BUILD_PRESET:-default}
BUILD_DIR=$(get_build_dir "$BUILD_PRESET")
default_binary_path() {
if [ "$(uname -s)" = "Darwin" ]; then
echo "${LADYBIRD_SOURCE_DIR}/Build/ladybird/bin/Ladybird.app/Contents/MacOS/"
echo "${BUILD_DIR}/bin/Ladybird.app/Contents/MacOS/"
else
echo "${LADYBIRD_SOURCE_DIR}/Build/ladybird/bin/"
echo "${BUILD_DIR}/bin/"
fi
}
LADYBIRD_BINARY=${LADYBIRD_BINARY:-"$(default_binary_path)/Ladybird"}
WEBDRIVER_BINARY=${WEBDRIVER_BINARY:-"$(default_binary_path)/WebDriver"}
WPT_PROCESSES=${WPT_PROCESSES:-$(get_number_of_processing_units)}

View file

@ -95,18 +95,7 @@ cmd_with_target() {
ensure_ladybird_source_dir
# Note: Keep in sync with buildDir defaults in CMakePresets.json
case "${BUILD_PRESET}" in
"default")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird"
;;
"Debug")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-debug"
;;
"Sanitizer")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-sanitizers"
;;
esac
BUILD_DIR=$(get_build_dir "$BUILD_PRESET")
CMAKE_ARGS+=("-DCMAKE_INSTALL_PREFIX=$LADYBIRD_SOURCE_DIR/Build/ladybird-install-${BUILD_PRESET}")

View file

@ -60,3 +60,26 @@ ensure_ladybird_source_dir() {
export LADYBIRD_SOURCE_DIR
fi
}
get_build_dir() {
ensure_ladybird_source_dir
# Note: Keep in sync with buildDir defaults in CMakePresets.json
case "$1" in
"default")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird"
;;
"Debug")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-debug"
;;
"Sanitizer")
BUILD_DIR="${LADYBIRD_SOURCE_DIR}/Build/ladybird-sanitizers"
;;
*)
echo "Unknown BUILD_PRESET: '$1'" >&2
exit 1
;;
esac
echo "${BUILD_DIR}"
}