[cmake] more modules, general "cleanup" (#3126)

Successor to that old MoltenVK PR. Does a lot of cleanups within root CMakeLists.txt, hands over MoltenVK and VulkanValidationLayers to CPMUtil, and separates out common operations into my modules.

Hopefully reduces the monstrosity that is root CMakeLists.txt. Please test:

- builds on all platforms
- VulkanValidationLayers

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3126
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
This commit is contained in:
crueter 2025-12-04 06:00:58 +01:00
parent 1d2b9de496
commit 18135424df
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
21 changed files with 697 additions and 638 deletions

View file

@ -8,10 +8,14 @@
RETURN=0
filter() {
filter_out() {
TAGS=$(echo "$TAGS" | jq "[.[] | select(.name | test(\"$1\"; \"i\") | not)]")
}
filter_in() {
TAGS=$(echo "$TAGS" | jq "[.[] | select(.name | test(\"$1\"; \"i\"))]")
}
usage() {
cat << EOF
Usage: $0 [uf] [PACKAGE]...
@ -83,19 +87,27 @@ while true; do
# filter out some commonly known annoyances
# TODO add more
filter vulkan-sdk # vulkan
filter yotta # mbedtls
if [ "$PACKAGE" = "vulkan-validation-layers" ]; then
filter_in vulkan-sdk
else
filter_out vulkan-sdk
fi
[ "$CI" = "true" ] && filter_in "-"
filter_out yotta # mbedtls
# ignore betas/alphas (remove if needed)
filter alpha
filter beta
filter rc
filter_out alpha
filter_out beta
filter_out rc
# Add package-specific overrides here, e.g. here for fmt:
[ "$PACKAGE" = fmt ] && filter v0.11
[ "$PACKAGE" = fmt ] && filter_out v0.11
LATEST=$(echo "$TAGS" | jq -r '.[0].name')
[ "$LATEST" = "null" ] && echo "-- * Up-to-date" && continue
[ "$LATEST" = "$TAG" ] && [ "$FORCE" != "true" ] && echo "-- * Up-to-date" && continue
RETURN=1

View file

@ -20,10 +20,13 @@ download_package() {
ACTUAL_HASH=$("${HASH_ALGO}"sum "$OUTFILE" | cut -d" " -f1)
[ "$ACTUAL_HASH" != "$HASH" ] && echo "!! $FILENAME did not match expected hash; expected $HASH but got $ACTUAL_HASH" && exit 1
TMPDIR="$TMP/extracted"
mkdir -p "$OUTDIR"
mkdir -p "$TMPDIR"
PREVDIR="$PWD"
cd "$OUTDIR"
mkdir -p "$TMPDIR"
cd "$TMPDIR"
case "$FILENAME" in
(*.7z)
@ -44,11 +47,16 @@ download_package() {
# thanks gnu
if [ "$(echo "$DIRS" | wc -l)" -eq 2 ]; then
SUBDIR=$(find . -maxdepth 1 -type d -not -name ".")
mv "$SUBDIR"/* .
mv "$SUBDIR"/.* . 2>/dev/null || true
mv "$SUBDIR"/* "$OUTDIR"
mv "$SUBDIR"/.* "$OUTDIR" 2>/dev/null || true
rmdir "$SUBDIR"
else
mv ./* "$OUTDIR"
mv ./.* "$OUTDIR" 2>/dev/null || true
fi
cd "$OUTDIR"
if echo "$JSON" | grep -e "patches" > /dev/null; then
PATCHES=$(echo "$JSON" | jq -r '.patches | join(" ")')
for patch in $PATCHES; do