Merge pull request #230 from boolean-false/main

Fix Apple bundle
This commit is contained in:
MihailRis 2024-06-06 17:54:53 +03:00 committed by GitHub
commit 46ca1bb04a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 0 deletions

View File

@ -30,11 +30,18 @@ jobs:
- name: Build
run: cmake --build build -t install
- name: Make fix_dylibs.sh executable
run: chmod +x fix_dylibs.sh
- name: Fix dylibs
run: ./fix_dylibs.sh VoxelEngine Release build
- name: Create DMG
run: |
mkdir VoxelEngineDmgContent
cp -r build/res VoxelEngineDmgContent/
cp -r build/VoxelEngine VoxelEngineDmgContent/
cp -r build/libs VoxelEngineDmgContent/libs
hdiutil create VoxelEngineMacApp.dmg -volname "VoxelEngine" -srcfolder VoxelEngineDmgContent -ov -format UDZO
- name: Upload artifacts

24
fix_dylibs.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
PROJECT_NAME=$1
CONFIG=$2
OUTPUT_DIR=$3
LIBS_DIR="$OUTPUT_DIR/libs"
mkdir -p "$LIBS_DIR"
TMP_BINARY="$OUTPUT_DIR/tmp_$PROJECT_NAME"
BINARY="$OUTPUT_DIR/$PROJECT_NAME"
cp "$BINARY" "$TMP_BINARY"
otool -L "$TMP_BINARY" | grep -o '/.*dylib' | while read -r dylib; do
if [[ "$dylib" == /usr/lib/* || "$dylib" == /System/Library/* ]]; then
continue
fi
cp "$dylib" "$LIBS_DIR"
install_name_tool -change "$dylib" "@executable_path/libs/$(basename "$dylib")" "$TMP_BINARY"
done
mv "$TMP_BINARY" "$BINARY"