diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 2bca821..fd6ada5 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -47,4 +47,4 @@ jobs: ENV_QT_PATH: ${{ env.qt-install-path }} run: | python ci/generate-version.py - ci/linux/build_for_ubuntu.sh release + ci/linux/build_for_ubuntu.sh RelWithDebInfo diff --git a/ci/linux/build_for_ubuntu.sh b/ci/linux/build_for_ubuntu.sh index b67c72e..b8b299a 100755 --- a/ci/linux/build_for_ubuntu.sh +++ b/ci/linux/build_for_ubuntu.sh @@ -8,7 +8,7 @@ echo --------------------------------------------------------------- # 从环境变量获取必要参数 # 例如 /home/barry/Qt5.9.6/5.9.6 echo ENV_QT_PATH $ENV_QT_PATH -qt_gcc_path=$ENV_QT_PATH/gcc_64 +qt_cmake_path=$ENV_QT_PATH/gcc_64/lib/cmake/Qt5 # 获取绝对路径,保证其他目录执行此脚本依然正确 { @@ -21,17 +21,17 @@ old_cd=$(pwd) cd $(dirname "$0") # 启动参数声明 -build_mode=debug +build_mode=RelWithDebInfo echo echo echo --------------------------------------------------------------- -echo check build param[debug/release] +echo check build param[Debug/Release/MinSizeRel/RelWithDebInfo] echo --------------------------------------------------------------- # 编译参数检查 build_mode=$(echo $1 | tr '[:upper:]' '[:lower:]') -if [[ $build_mode != "release" && $build_mode != "debug" ]]; then +if [[ $build_mode != "Release" && $build_mode != "Debug" && $build_mode != "MinSizeRel" && $build_mode != "RelWithDebInfo" ]]; then echo "error: unkonow build mode -- $1" exit 1 fi @@ -40,7 +40,7 @@ fi echo current build mode: $build_mode # 环境变量设置 -export PATH=$qt_gcc_path/bin:$PATH +#export PATH=$qt_gcc_path/bin:$PATH echo echo @@ -49,35 +49,28 @@ echo begin qmake build echo --------------------------------------------------------------- # 删除输出目录 -output_path=$script_path../../output/linux/$build_mode +output_path=$script_path../../output if [ -d "$output_path" ]; then rm -rf $output_path fi # 删除临时目录 -temp_path=$script_path/../temp -if [ -d "$temp_path" ]; then - rm -rf $temp_path +build_path=$script_path/../build_temp +if [ -d "$build_path" ]; then + rm -rf $build_path fi -mkdir $temp_path -cd $temp_path +mkdir $build_path +cd $build_path -qmake_params="-spec linux-g++" -if [ $build_mode == "debug" ]; then - qmake_params="$qmake_params CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug" -else - qmake_params="$qmake_params CONFIG+=x86_64 CONFIG+=qtquickcompiler" -fi - -# qmake ../../all.pro -spec linux-g++ CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug -qmake ../../all.pro $qmake_params +cmake_params="-DCMAKE_PREFIX_PATH=$qt_cmake_path -DCMAKE_BUILD_TYPE=$build_mode" +cmake $cmake_params ../.. if [ $? -ne 0 ] ;then - echo "qmake failed" + echo "cmake failed" exit 1 fi -make -j8 +cmake --build . --config $build_mode -j8 if [ $? -ne 0 ] ;then - echo "make failed" + echo "cmake build failed" exit 1 fi