init
This commit is contained in:
Executable
+120
@@ -0,0 +1,120 @@
|
||||
#!/bin/bash
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# HCIE Qt6 Build Script
|
||||
# Builds the Rust engine as a static library, then builds the Qt6 GUI.
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
echo "═══════════════════════════════════════════════════════════════"
|
||||
echo " HCIE Qt6 Build"
|
||||
echo "═══════════════════════════════════════════════════════════════"
|
||||
|
||||
# ── Step 1: Build Rust engine as static library ──────────────────────────────
|
||||
echo ""
|
||||
echo "▶ Step 1: Building Rust engine (hcie-engine-api)..."
|
||||
cargo build -p hcie-engine-api --release 2>&1
|
||||
|
||||
# Verify the static library exists
|
||||
ENGINE_LIB="target/release/libhcie_engine_api.a"
|
||||
if [ ! -f "$ENGINE_LIB" ]; then
|
||||
# Try debug build
|
||||
ENGINE_LIB="target/debug/libhcie_engine_api.a"
|
||||
cargo build -p hcie-engine-api 2>&1
|
||||
fi
|
||||
|
||||
if [ ! -f "$ENGINE_LIB" ]; then
|
||||
echo "ERROR: Could not find libhcie_engine_api.a"
|
||||
echo "Expected at: target/release/libhcie_engine_api.a"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Engine library: $ENGINE_LIB ($(du -h "$ENGINE_LIB" | cut -f1))"
|
||||
|
||||
# ── Step 2: Check Qt6 is available ───────────────────────────────────────────
|
||||
echo ""
|
||||
echo "▶ Step 2: Checking Qt6..."
|
||||
|
||||
if ! command -v cmake &> /dev/null; then
|
||||
echo "ERROR: cmake not found. Install it:"
|
||||
echo " Ubuntu/Debian: sudo apt install cmake"
|
||||
echo " Fedora: sudo dnf install cmake"
|
||||
echo " Arch: sudo pacman -S cmake"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for Qt6 cmake config
|
||||
QT6_FOUND=$(find /usr -name "Qt6Config.cmake" 2>/dev/null | head -1)
|
||||
if [ -z "$QT6_FOUND" ]; then
|
||||
echo "ERROR: Qt6 development packages not found."
|
||||
echo ""
|
||||
echo "Install Qt6 dev packages:"
|
||||
echo ""
|
||||
echo " Ubuntu/Debian (apt):"
|
||||
echo " sudo apt install qt6-base-dev libqt6opengl6-dev qt6-tools-dev"
|
||||
echo ""
|
||||
echo " Fedora (dnf):"
|
||||
echo " sudo dnf install qt6-qtbase-devel qt6-qtopengl-devel"
|
||||
echo ""
|
||||
echo " Arch (pacman):"
|
||||
echo " sudo pacman -S qt6-base qt6-tools qt6-declarative"
|
||||
echo ""
|
||||
echo " openSUSE (zypper):"
|
||||
echo " sudo zypper install qt6-base-devel libqt6-qtdeclarative-devel"
|
||||
echo ""
|
||||
echo " macOS (brew):"
|
||||
echo " brew install qt@6"
|
||||
echo " export CMAKE_PREFIX_PATH=$(brew --prefix qt@6)"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Qt6 found: $QT6_FOUND"
|
||||
|
||||
# ── Step 3: Copy engine lib to expected location ─────────────────────────────
|
||||
echo ""
|
||||
echo "▶ Step 3: Preparing build directory..."
|
||||
|
||||
# Ensure the engine lib is in the right place for CMake
|
||||
# CMakeLists.txt looks for ../target/release/libhcie_engine_api.a
|
||||
mkdir -p hcie-qt-app/build
|
||||
|
||||
# ── Step 4: Configure CMake ──────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "▶ Step 4: Configuring CMake..."
|
||||
|
||||
cd hcie-qt-app
|
||||
|
||||
# Auto-detect Qt6 prefix path
|
||||
QT6_PREFIX=""
|
||||
if [ -n "$CMAKE_PREFIX_PATH" ]; then
|
||||
QT6_PREFIX="-DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH"
|
||||
elif command -v qmake6 &> /dev/null; then
|
||||
QT6_PREFIX="-DCMAKE_PREFIX_PATH=$(dirname $(dirname $(readlink -f $(which qmake6))))"
|
||||
elif [ -d "/usr/lib/x86_64-linux-gnu/cmake/Qt6" ]; then
|
||||
QT6_PREFIX="-DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/cmake"
|
||||
fi
|
||||
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Release $QT6_PREFIX 2>&1
|
||||
|
||||
# ── Step 5: Build ────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "▶ Step 5: Building Qt application..."
|
||||
|
||||
cmake --build build --config Release -j$(nproc) 2>&1
|
||||
|
||||
# ── Step 6: Done ─────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "═══════════════════════════════════════════════════════════════"
|
||||
echo " BUILD SUCCESSFUL"
|
||||
echo "═══════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
echo " Run the application:"
|
||||
echo " cd hcie-qt-app && ./build/hcie-qt"
|
||||
echo ""
|
||||
echo " Or with Qt Designer (for UI editing):"
|
||||
echo " designer-qt6 ui/mainwindow.ui"
|
||||
echo ""
|
||||
Reference in New Issue
Block a user