mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-02 21:58:42 +00:00
ci / gh-actions : update linux build script
The script is tested on my computer with zsh, qt 5.15.2
This commit is contained in:
parent
eb3579482d
commit
c7e0727e5d
1 changed files with 24 additions and 42 deletions
|
@ -1,85 +1,67 @@
|
||||||
|
|
||||||
echo
|
|
||||||
echo
|
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
echo check ENV
|
echo Check \& Set Environment Variables
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
# 从环境变量获取必要参数
|
# Get Qt path
|
||||||
# 例如 /home/barry/Qt5.9.6/5.9.6
|
# ENV_QT_PATH example: /home/barry/Qt5.9.6/5.9.6
|
||||||
echo ENV_QT_PATH $ENV_QT_PATH
|
echo Current ENV_QT_PATH: $ENV_QT_PATH
|
||||||
|
echo Current directory: $(pwd)
|
||||||
|
# Set variables
|
||||||
qt_cmake_path=$ENV_QT_PATH/gcc_64/lib/cmake/Qt5
|
qt_cmake_path=$ENV_QT_PATH/gcc_64/lib/cmake/Qt5
|
||||||
|
export PATH=$qt_gcc_path/bin:$PATH
|
||||||
|
|
||||||
# 获取绝对路径,保证其他目录执行此脚本依然正确
|
# Remember working directory
|
||||||
{
|
|
||||||
cd $(dirname "$0")
|
|
||||||
script_path=$(pwd)
|
|
||||||
cd -
|
|
||||||
} &> /dev/null # disable output
|
|
||||||
# 设置当前目录,cd的目录影响接下来执行程序的工作目录
|
|
||||||
old_cd=$(pwd)
|
old_cd=$(pwd)
|
||||||
cd $(dirname "$0")
|
|
||||||
|
|
||||||
# 启动参数声明
|
# Set working dir to the script's path
|
||||||
build_mode=RelWithDebInfo
|
cd $(dirname "$0")/.../
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
echo check build param[Debug/Release/MinSizeRel/RelWithDebInfo]
|
echo Check Build Parameters
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
|
echo Possible build modes: Debug/Release/MinSizeRel/RelWithDebInfo
|
||||||
|
|
||||||
# 编译参数检查
|
build_mode="$1"
|
||||||
build_mode=$(echo $1)
|
|
||||||
if [[ $build_mode != "Release" && $build_mode != "Debug" && $build_mode != "MinSizeRel" && $build_mode != "RelWithDebInfo" ]]; then
|
if [[ $build_mode != "Release" && $build_mode != "Debug" && $build_mode != "MinSizeRel" && $build_mode != "RelWithDebInfo" ]]; then
|
||||||
echo "error: unkonow build mode -- $1"
|
echo "error: unknown build mode, exiting......"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 提示
|
echo Current build mode: $build_mode
|
||||||
echo current build mode: $build_mode
|
|
||||||
|
|
||||||
# 环境变量设置
|
|
||||||
#export PATH=$qt_gcc_path/bin:$PATH
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
echo begin cmake build
|
echo CMake Build Begins
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
# 删除输出目录
|
# Remove output folder
|
||||||
output_path=$script_path../../output
|
output_path=./output
|
||||||
if [ -d "$output_path" ]; then
|
if [ -d "$output_path" ]; then
|
||||||
rm -rf $output_path
|
rm -rf $output_path
|
||||||
fi
|
fi
|
||||||
# 删除临时目录
|
|
||||||
build_path=$script_path/../build_temp
|
|
||||||
if [ -d "$build_path" ]; then
|
|
||||||
rm -rf $build_path
|
|
||||||
fi
|
|
||||||
mkdir $build_path
|
|
||||||
cd $build_path
|
|
||||||
|
|
||||||
cmake_params="-DCMAKE_PREFIX_PATH=$qt_cmake_path -DCMAKE_BUILD_TYPE=$build_mode"
|
cmake_params="-DCMAKE_PREFIX_PATH=$qt_cmake_path -DCMAKE_BUILD_TYPE=$build_mode"
|
||||||
cmake $cmake_params ../..
|
cmake $cmake_params .
|
||||||
if [ $? -ne 0 ] ;then
|
if [ $? -ne 0 ] ;then
|
||||||
echo "cmake failed"
|
echo "error: CMake failed, exiting......"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake --build . --config $build_mode -j8
|
cmake --build . --config "$build_mode" -j8
|
||||||
if [ $? -ne 0 ] ;then
|
if [ $? -ne 0 ] ;then
|
||||||
echo "cmake build failed"
|
echo "error: CMake build failed, exiting......"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
echo finish!!!
|
echo CMake Build Succeeded
|
||||||
echo ---------------------------------------------------------------
|
echo ---------------------------------------------------------------
|
||||||
|
|
||||||
# 恢复当前目录
|
# Resume current directory
|
||||||
cd $old_cd
|
cd $old_cd
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue