83 lines
2.1 KiB
Bash
Executable File
83 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# macOS Run Script for ScreenLockDetector
|
|
# This script runs the application on macOS
|
|
|
|
set -e # Exit on error
|
|
|
|
echo "=========================================="
|
|
echo "Running ScreenLockDetector on macOS"
|
|
echo "=========================================="
|
|
|
|
# Colors for output
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Check if we're on macOS
|
|
if [[ "$OSTYPE" != "darwin"* ]]; then
|
|
echo -e "${RED}Error: This script is for macOS only${NC}"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if executable exists
|
|
EXECUTABLE="build/bin/ScreenLockDetector"
|
|
|
|
if [ ! -f "$EXECUTABLE" ]; then
|
|
echo -e "${RED}Error: Executable not found at $EXECUTABLE${NC}"
|
|
echo ""
|
|
echo "Please build the project first:"
|
|
echo " ./build_mac.sh"
|
|
exit 1
|
|
fi
|
|
|
|
# Function to find Qt installation
|
|
find_qt() {
|
|
# Try to find Qt in common locations
|
|
QT_PATHS=(
|
|
"/opt/local" # MacPorts
|
|
"/usr/local/opt/qt@5" # Homebrew (Intel)
|
|
"/opt/homebrew/opt/qt@5" # Homebrew (Apple Silicon)
|
|
"$HOME/Qt/5.15.2/clang_64" # Official Qt installer
|
|
"$HOME/sdk/qt-5.15.2" # Custom installation
|
|
)
|
|
|
|
for path in "${QT_PATHS[@]}"; do
|
|
if [ -d "$path" ]; then
|
|
# Check if Qt cmake files exist
|
|
if [ -f "$path/lib/cmake/Qt5/Qt5Config.cmake" ]; then
|
|
echo "$path"
|
|
return 0
|
|
fi
|
|
fi
|
|
done
|
|
|
|
return 1
|
|
}
|
|
|
|
# Find Qt installation and set up library path
|
|
QT_PATH=$(find_qt)
|
|
|
|
if [ -n "$QT_PATH" ]; then
|
|
echo -e "${GREEN}Found Qt at: $QT_PATH${NC}"
|
|
export DYLD_LIBRARY_PATH="$QT_PATH/lib:$DYLD_LIBRARY_PATH"
|
|
export DYLD_FRAMEWORK_PATH="$QT_PATH/lib:$DYLD_FRAMEWORK_PATH"
|
|
else
|
|
echo -e "${YELLOW}Warning: Qt not found in common locations${NC}"
|
|
echo "If the application fails to run, please set DYLD_LIBRARY_PATH manually:"
|
|
echo " export DYLD_LIBRARY_PATH=/path/to/qt/lib:\$DYLD_LIBRARY_PATH"
|
|
echo ""
|
|
fi
|
|
|
|
# Run the application
|
|
echo ""
|
|
echo "Starting ScreenLockDetector..."
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
./"$EXECUTABLE"
|
|
|
|
echo ""
|
|
echo "Application exited."
|