#!/bin/bash # Qt Screen Lock Detection Demo - Build Script # This script builds the Qt application using CMake set -e # Exit on error # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo "========================================" echo "Qt Screen Lock Detection Demo - Build" echo "========================================" echo "" # Check if Qt5 directory exists QT5_DIR="$HOME/sdk/qt-5.15.2" if [ ! -d "$QT5_DIR" ]; then echo -e "${RED}Error: Qt5 directory not found at $QT5_DIR${NC}" echo "Please install Qt5 or update the path in CMakeLists.txt" exit 1 fi echo -e "${GREEN}✓ Qt5 directory found: $QT5_DIR${NC}" echo "" # Create build directory BUILD_DIR="build" if [ -d "$BUILD_DIR" ]; then echo -e "${YELLOW}Removing existing build directory...${NC}" rm -rf "$BUILD_DIR" fi echo "Creating build directory..." mkdir -p "$BUILD_DIR" cd "$BUILD_DIR" echo "" echo "Running CMake..." echo "----------------------------------------" # Run CMake configuration cmake .. -DCMAKE_BUILD_TYPE=Release echo "" echo "Building application..." echo "----------------------------------------" # Build the project make -j$(nproc) echo "" echo "========================================" echo -e "${GREEN}✓ Build completed successfully!${NC}" echo "========================================" echo "" echo "Executable location: $BUILD_DIR/bin/ScreenLockDemo" echo "" echo "To run the application:" echo " cd build/bin" echo " ./ScreenLockDemo" echo "" echo "Or use the run.sh script from the project root:" echo " ./run.sh" echo ""