#!/bin/bash # Build script for DTC C/C++ IDE on macOS echo "🚀 Building DTC C/C++ IDE for macOS..." # Check if Qt6 is installed if ! command -v qmake6 &> /dev/null && ! command -v qmake &> /dev/null; then echo "❌ Qt6 is not installed. Please install Qt6 first:" echo " brew install qt@6" echo " or download from https://qt.io" exit 1 fi # Find Qt6 installation path QT_PATH="" if [ -d "/opt/homebrew/opt/qt@6" ]; then QT_PATH="/opt/homebrew/opt/qt@6" elif [ -d "/usr/local/opt/qt@6" ]; then QT_PATH="/usr/local/opt/qt@6" elif [ -d "$HOME/Qt" ]; then # Find latest Qt version QT_VERSION=$(ls "$HOME/Qt" | grep "^6\." | sort -V | tail -n1) if [ ! -z "$QT_VERSION" ]; then QT_PATH="$HOME/Qt/$QT_VERSION/macos" fi fi if [ -z "$QT_PATH" ]; then echo "❌ Could not find Qt6 installation. Please set CMAKE_PREFIX_PATH manually." echo "Example: export CMAKE_PREFIX_PATH=/path/to/qt6" exit 1 fi echo "✅ Found Qt6 at: $QT_PATH" # Create build directory if [ ! -d "build" ]; then mkdir build fi cd build # Configure with CMake echo "🔧 Configuring project..." cmake .. -DCMAKE_PREFIX_PATH="$QT_PATH" -DCMAKE_BUILD_TYPE=Release if [ $? -ne 0 ]; then echo "❌ CMake configuration failed!" exit 1 fi # Build the project echo "🔨 Building project..." make -j$(sysctl -n hw.ncpu) if [ $? -ne 0 ]; then echo "❌ Build failed!" exit 1 fi echo "✅ Build completed successfully!" echo "" echo "🎉 DTC C/C++ IDE has been built!" echo "📁 Executable location: $(pwd)/dtc-ide.app" echo "" echo "To run the IDE:" echo " ./dtc-ide.app/Contents/MacOS/dtc-ide" echo " or" echo " open dtc-ide.app"