Kylin/resource/deploy.sh

81 lines
2.4 KiB
Bash
Raw Normal View History

2023-07-21 10:47:31 +08:00
#!/bin/bash
base_path=$(pwd)
2023-12-25 18:52:51 +08:00
qt_prefix_path="/opt/Qt/6.6.1/gcc_64"
2023-07-21 10:47:31 +08:00
libraries_root="/opt/Libraries"
if [ $base_path == /home/* ] || [ -n "${DRONE}" ]; then
build_path=${base_path}/build
else
build_path=/tmp/build
fi
echo "build directory: $build_path"
2023-12-25 18:52:51 +08:00
if [ -d ${qt_prefix_path} ]; then # 先找Qt6
2023-08-13 15:05:35 +08:00
cmake_qt_parameters="-DCMAKE_PREFIX_PATH=${qt_prefix_path} \
-DQT_QMAKE_EXECUTABLE=${qt_prefix_path}/bin/qmake \
-DQT_DIR=${qt_prefix_path}/lib/cmake/Qt6 \
-DQt6_DIR=${qt_prefix_path}/lib/cmake/Qt6 \
-DQt6Core_DIR=${qt_prefix_path}/lib/cmake/Qt6Core \
-DQt6Gui_DIR=${qt_prefix_path}/lib/cmake/Qt6Gui \
-DQt6Qml_DIR=${qt_prefix_path}/lib/cmake/Qt6Qml \
-DQt6Widgets_DIR=${qt_prefix_path}/lib/cmake/Qt6Widgets \
-DQt6Quick_DIR=${qt_prefix_path}/lib/cmake/Qt6Quick \
-DQt6Svg_DIR=${qt_prefix_path}/lib/cmake/Qt6Svg "
elif [ -d "/opt/Qt/5.15.2/gcc_64" ]; then
qt_prefix_path="/opt/Qt/5.15.2/gcc_64"
cmake_qt_parameters="-DCMAKE_PREFIX_PATH=${qt_prefix_path} \
-DQT_QMAKE_EXECUTABLE=${qt_prefix_path}/bin/qmake \
-DQT_DIR=${qt_prefix_path}/lib/cmake/Qt5 \
-DQt5_DIR=${qt_prefix_path}/lib/cmake/Qt5 \
-DQt5Core_DIR=${qt_prefix_path}/lib/cmake/Qt5Core \
-DQt5Gui_DIR=${qt_prefix_path}/lib/cmake/Qt5Gui \
-DQt5Qml_DIR=${qt_prefix_path}/lib/cmake/Qt5Qml \
-DQt5Widgets_DIR=${qt_prefix_path}/lib/cmake/Qt5Widgets \
-DQt5Quick_DIR=${qt_prefix_path}/lib/cmake/Qt5Quick \
-DQt5Svg_DIR=${qt_prefix_path}/lib/cmake/Qt5Svg "
else
cmake_qt_parameters=""
2023-12-25 18:52:51 +08:00
echo "please install qt6.6.1 or qt5.15.2 ..."
2023-08-13 15:05:35 +08:00
fi
2023-07-21 10:47:31 +08:00
function cmake_scan() {
if [ ! -d ${build_path} ]; then
mkdir ${build_path}
fi
/opt/Qt/Tools/CMake/bin/cmake \
-G Ninja \
-S ${base_path} \
-B ${build_path} \
-DCMAKE_BUILD_TYPE=Debug \
2023-12-25 18:52:51 +08:00
-DBOOST_ROOT=${libraries_root}/boost_1_84_0 \
2023-08-13 15:05:35 +08:00
-DZeroMQ_ROOT=${libraries_root}/zeromq-4.3.4_debug \
${cmake_qt_parameters}
2023-07-21 10:47:31 +08:00
}
function build() {
if [ ! -f "${build_path}/CMakeCache.txt" ]; then
cmake_scan
fi
if [ $? -ne 0 ]; then
exit 1
fi
/opt/Qt/Tools/CMake/bin/cmake \
--build ${build_path} \
--target all
}
function main() {
local cmd=$1
shift 1
case $cmd in
build)
build
;;
*)
build
;;
esac
}
2023-12-25 18:52:51 +08:00
main $@