Files
spark-store/build-run-qt5.sh
2026-01-19 23:02:59 +08:00

58 lines
1.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Qt5 编译和运行脚本
set -e
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_DIR="${PROJECT_ROOT}/build/qt5-Debug"
echo "================================"
echo "Qt5 编译和运行脚本"
echo "================================"
echo ""
# 检查 Qt5 qmake
if ! command -v /usr/lib/qt5/bin/qmake &> /dev/null; then
echo "错误: 未找到 Qt5 qmake"
echo "请确保 Qt5 已安装: /usr/lib/qt5/bin/qmake"
exit 1
fi
echo "Qt5 版本:"
/usr/lib/qt5/bin/qmake --version
echo ""
# 创建构建目录
echo "创建构建目录: ${BUILD_DIR}"
rm -rf "${BUILD_DIR}"
mkdir -p "${BUILD_DIR}"
echo ""
# 生成 Makefile
echo "生成 Makefile..."
cd "${BUILD_DIR}"
/usr/lib/qt5/bin/qmake "${PROJECT_ROOT}/spark-store-project.pro" -r CONFIG+=debug
echo ""
# 编译
echo "开始编译..."
make -j$(nproc)
echo ""
echo "✓ 编译完成!"
echo ""
# 运行应用
SPARK_STORE="${BUILD_DIR}/src/spark-store"
if [ -f "${SPARK_STORE}" ]; then
echo "================================"
echo "启动 spark-storeQt5"
echo "================================"
echo ""
"${SPARK_STORE}"
else
echo "错误: spark-store 未找到"
exit 1
fi