#!/bin/bash # macOS Ghost Client Build Script # Usage: ./build.sh set -e echo "=== macOS Ghost Client Build ===" echo "" # Check for Xcode Command Line Tools if ! command -v clang &> /dev/null; then echo "Error: Xcode Command Line Tools not installed" echo "Run: xcode-select --install" exit 1 fi # Check for CMake if ! command -v cmake &> /dev/null; then echo "Error: CMake not installed" echo "Install with: brew install cmake" exit 1 fi # Create build directory mkdir -p build cd build # Configure # 架构与最低系统版本显式传:两者都是 CMake 的 cache 变量,旧 build 目录里可能还存着 # universal / 10.13 的旧值,只改 CMakeLists.txt 不会生效(arm64 + Homebrew OpenSSL # 是单架构组合,留着 x86_64 slice 会链接失败)。 echo "Configuring..." cmake .. -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_OSX_ARCHITECTURES=arm64 \ -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 # Build echo "" echo "Building..." cmake --build . --config Release -j$(sysctl -n hw.ncpu) # Done echo "" echo "=== Build Complete ===" echo "Executable: build/bin/ghost" echo "" echo "To run:" echo " ./bin/ghost [server_ip] [port]" echo "" echo "Example:" echo " ./bin/ghost 192.168.0.55 6543"