Apple bundle with dylib's

This commit is contained in:
Danila Artyukhov 2024-06-06 15:57:34 +03:00
parent 7cbacba0c6
commit d818cec7bb
3 changed files with 91 additions and 60 deletions

View File

@ -30,11 +30,18 @@ jobs:
- name: Build - name: Build
run: cmake --build build -t install 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 - name: Create DMG
run: | run: |
mkdir VoxelEngineDmgContent mkdir VoxelEngineDmgContent
cp -r build/res VoxelEngineDmgContent/ cp -r build/res VoxelEngineDmgContent/
cp -r build/VoxelEngine VoxelEngineDmgContent/ cp -r build/VoxelEngine VoxelEngineDmgContent/
cp -r build/libs VoxelEngineDmgContent/libs
hdiutil create VoxelEngineMacApp.dmg -volname "VoxelEngine" -srcfolder VoxelEngineDmgContent -ov -format UDZO hdiutil create VoxelEngineMacApp.dmg -volname "VoxelEngine" -srcfolder VoxelEngineDmgContent -ov -format UDZO
- name: Upload artifacts - 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"