完善客户端功能并同步差距文档
This commit is contained in:
+31
-9
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# ./build-macos-client.sh [debug|release]
|
||||
#
|
||||
# 产物:build/export/mtgodot-poc.app + 旁边一个 assets 符号链接(不进包,2.1G)。
|
||||
# 产物:build/export/mtgodot-poc.app(资源和 BGM 自包含在 Contents/Resources/)。
|
||||
# 依赖:Godot 4.7.1 的 macOS 导出模板(editor 里 “管理导出模板” 装,或放
|
||||
# ~/Library/Application Support/Godot/export_templates/4.7.1.stable/macos.zip)。
|
||||
set -euo pipefail
|
||||
@@ -13,14 +13,32 @@ CFG="${1:-debug}"
|
||||
OUT="$REPO/build/export"
|
||||
APP="$OUT/mtgodot-poc.app"
|
||||
GODOT="${GODOT:-godot}"
|
||||
MAC_ARCHES="${MT_MAC_ARCHES:-universal}"
|
||||
BUILD_TYPE="Debug"
|
||||
if [ "$CFG" = release ]; then
|
||||
BUILD_TYPE="Release"
|
||||
fi
|
||||
|
||||
echo "== 1. GDExtension .dylib =="
|
||||
if [ "$MAC_ARCHES" = universal ]; then
|
||||
CMAKE_ARCHES="arm64;x86_64"
|
||||
else
|
||||
CMAKE_ARCHES="$MAC_ARCHES"
|
||||
fi
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE="$BUILD_TYPE" -DCMAKE_OSX_ARCHITECTURES="$CMAKE_ARCHES"
|
||||
cmake --build build --target mtgodot -j8
|
||||
DYLIB="project/bin/libmtgodot.macos.template_${CFG}.dylib"
|
||||
if [ ! -f "$DYLIB" ]; then
|
||||
# CMake 目前只出 debug 名;release 就复用它
|
||||
cp -f project/bin/libmtgodot.macos.template_debug.dylib "$DYLIB"
|
||||
fi
|
||||
if [ "$MAC_ARCHES" = universal ]; then
|
||||
LIPO_INFO="$(lipo -info "$DYLIB")"
|
||||
case "$LIPO_INFO" in
|
||||
*x86_64*arm64*|*arm64*x86_64*) ;;
|
||||
*) echo "错误:GDExtension 不是 universal:$LIPO_INFO" >&2; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "== 2. 导出 =="
|
||||
mkdir -p "$OUT"
|
||||
@@ -30,16 +48,20 @@ else
|
||||
"$GODOT" --headless --path project --export-debug macOS "$APP"
|
||||
fi
|
||||
|
||||
echo "== 3. 资源(不打进包)=="
|
||||
# .app 同级放一个 assets 链接;AssetRoot 会在 <.app 同级>/assets 找到它。
|
||||
ln -sfn "$REPO/assets" "$OUT/assets"
|
||||
ln -sfn "$REPO/bgm" "$OUT/bgm"
|
||||
echo "== 3. 资源(自包含)=="
|
||||
mkdir -p "$APP/Contents/Resources"
|
||||
ditto "$REPO/assets" "$APP/Contents/Resources/assets"
|
||||
ditto "$REPO/bgm" "$APP/Contents/Resources/bgm"
|
||||
test -f "$APP/Contents/Resources/assets/asset_index.txt"
|
||||
|
||||
echo "== 4. ad-hoc 签名(Apple Silicon 直跑)=="
|
||||
codesign --force --deep --sign - "$APP" 2>/dev/null || true
|
||||
echo "== 4. 签名(默认 ad-hoc;CODESIGN_IDENTITY 可切正式证书)=="
|
||||
CODESIGN_IDENTITY="${CODESIGN_IDENTITY:--}"
|
||||
find "$APP/Contents" -type f \( -name '*.dylib' -o -name '*.so' -o -name '*.a' \) -exec \
|
||||
codesign --force --options runtime --timestamp=none --sign "$CODESIGN_IDENTITY" {} \; 2>/dev/null || true
|
||||
codesign --force --options runtime --timestamp=none --sign "$CODESIGN_IDENTITY" "$APP" 2>/dev/null || true
|
||||
xattr -dr com.apple.quarantine "$APP" 2>/dev/null || true
|
||||
|
||||
echo
|
||||
echo "OK -> $APP"
|
||||
echo "跑: open '$APP' (用 $OUT/assets)"
|
||||
echo "或: MT_ASSETS='$REPO/assets' '$APP/Contents/MacOS/mtgodot-poc' (看控制台日志)"
|
||||
echo "跑: open '$APP'"
|
||||
echo "开发覆盖资源:MT_ASSETS='$REPO/assets' '$APP/Contents/MacOS/mtgodot-poc'"
|
||||
|
||||
Reference in New Issue
Block a user