28 lines
1.1 KiB
Bash
Executable File
28 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the mtgodot GDExtension into project/bin/. macOS only (Phase 1).
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
CONFIG="${1:-Debug}" # Debug | Release
|
|
JOBS="${JOBS:-$(sysctl -n hw.ncpu)}"
|
|
MAC_ARCHES="${MT_MAC_ARCHES:-$(uname -m)}" # arm64, x86_64, or universal
|
|
|
|
# godot-cpp + the vendored deps (zstd, libsodium-cmake and its nested libsodium)
|
|
# are submodules — recurse. miniLZO is vendored in-tree, nothing to fetch.
|
|
if [ ! -f extension/godot-cpp/CMakeLists.txt ] \
|
|
|| [ ! -f extension/third_party/zstd/build/cmake/CMakeLists.txt ] \
|
|
|| [ ! -f extension/third_party/libsodium-cmake/libsodium/src/libsodium/include/sodium.h ]; then
|
|
echo "submodules missing — fetching (git submodule update --init --recursive)…" >&2
|
|
git submodule update --init --recursive
|
|
fi
|
|
|
|
if [ "$MAC_ARCHES" = universal ]; then
|
|
MAC_ARCHES="arm64;x86_64"
|
|
fi
|
|
cmake -S . -B build -DCMAKE_BUILD_TYPE="$CONFIG" -DCMAKE_OSX_ARCHITECTURES="$MAC_ARCHES"
|
|
cmake --build build --config "$CONFIG" -j "$JOBS"
|
|
|
|
echo
|
|
echo "Built libs in project/bin/:"
|
|
ls -la project/bin/*.dylib 2>/dev/null || echo " (none — check build output above)"
|