当前位置:网站首页>A case of compiling QT file qmake compiling script
A case of compiling QT file qmake compiling script
2022-07-07 10:56:00 【Taylor lance】
Compile script cases :
Reference cases :https://blog.csdn.net/worldchinalee/article/details/105269001
About qmake Manuals
Qt Manual entry
First compile qt To generate qmake
And then in qmake Create a new file under the folder qt.conf
Add content
Use qmake Some of the problems we encountered :
Qmake error: Unknown module(s) in QT: network widgets gui core
stay qmake Under the folder , That is to say bin Create a new file in the directory qt.conf
Add installation path :
[Paths]
Prefix=/home/kylin/qt-gcc_64
https://blog.csdn.net/weixin_43360707/article/details/122474111
#!/bin/bash
VERSION="release"
REBUILD="YES"
if [ -n "$1" ];then
VERSION=$1
fi
if [ -n "$2" ];then
REBUILD=$2
fi
MYQTPATH=${
PWD}/../media-depends/qt-gcc_64/release
export QMAKESPEC=$MYQTPATH/mkspecs/linux-g++
./build-tg.sh \
-q ${MYQTPATH} \
-s ${
PWD}/../crystal-media \
-b ${
PWD}/../build \
-i ${
PWD}/../install \
-d ${
PWD}/../media-depends \
-v ${VERSION} \
-r ${REBUILD} \
cp ../build/${VERSION}/engine/lib* ../install/
cp ../build/${VERSION}/server/Flow* ../install/
echo `date`
echo ${VERSION} "rebuild":${REBUILD}
# Compile and link a Qt project.
####################################################
### step 1: collect shell arguments
PROMPT=${PROMPT:-"[CI] "}
function usage () {
echo ${PROMPT}-----------------
echo ${PROMPT}"Usage:"
echo ${PROMPT}"./$(basename $0) \\"
echo ${PROMPT}" --qt <abs-dir of Qt compilers>"
echo ${PROMPT}" --build <abs-dir for building process>"
echo ${PROMPT}" --install <abs-dir for installation>"
echo ${PROMPT}" --depends <abs-dir of dependencies>"
echo ${PROMPT}" --version <debug | release>"
echo ${PROMPT}""
echo ${PROMPT}"Example:"
echo ${PROMPT}"./$(basename $0) \\"
echo ${PROMPT}" --qt \"/home/builder01/Workplace/depends/libqt\" \\"
echo ${PROMPT}" --build \"/home/builder01/Workplace/libdarknet-build\" \\"
echo ${PROMPT}" --install \"/home/builder01/Workplace/depends/libdarknet\" \\"
echo ${PROMPT}" --depends \"/home/builder01/Workplace/depends\""
echo ${PROMPT}" --version debug"
}
if [ "$1" == "" ]; then
usage
exit 1;
fi
INPUT="$0 [email protected]"
PROCESS_ARGS=$(getopt -o q:b:i:d:v:r --long qt:,build:,install:,depends:,version:,rebuild -- "[email protected]")
eval set -- "$PROCESS_ARGS"
while true; do
case "$1" in
-q|--qt) DIR_LIBQT=$2 ; shift 2 ;;
-b|--build) DIR_BUILD=$2 ; shift 2 ;;
-i|--install) DIR_INSTALL=$2 ; shift 2 ;;
-d|--depends) DIR_DEPENDS=$2 ; shift 2 ;;
-v|--version) VERSION=$2 ; shift 2 ;;
--) shift ; break ;;
*)
echo "Internal error!" ; exit 1 ;;
esac
done
### change to use qt in flow-depends,songky,2020-05-12
#DIR_LIBQT="${DIR_DEPENDS}/qt-gcc_64"
[ -z "$DIR_LIBQT" ] && PAR_ERROR=YES
[ -z "$DIR_INSTALL" ] && PAR_ERROR=YES
[ -z "$DIR_DEPENDS" ] && PAR_ERROR=YES
[ -z "$DIR_BUILD" ] && PAR_ERROR=YES
[ -z "$VERSION" ] && PAR_ERROR=YES
if [ "#$PAR_ERROR" = "#YES" ]; then
echo ${PROMPT}Parameter error!. You input is interieted as:
echo ${PROMPT}--------------------------
echo ${PROMPT}$INPUT
echo ${PROMPT}--------------------------
echo ${PROMPT} Type \"./$(basename $0)\" for help.
exit 1
fi
if [ "#${DIR_BUILD}" = "#." ] || [ "#${DIR_BUILD}" = "#./" ] ; then
SHADOW_BUILD=NO
else
SHADOW_BUILD=YES
fi
#trans git-lab viriables to project viriables
SMB_DIR=${sambaServer_flow:=---Empty---}
SMB_SERVER=${sambaServer_IP:=---Empty---}
SMB_USER=${sambaServer_user:=---Empty---}
#build different versions in individual folder
DIR_PRJ=${
PWD}
rm -fr ../${CI_PROJECT_NAME}_${VERSION}_$$
cp -a ../${CI_PROJECT_NAME} ../${CI_PROJECT_NAME}_${VERSION}_$$
mv ../${CI_PROJECT_NAME}_${VERSION}_$$ ./${CI_PROJECT_NAME}_${VERSION}
cd ${CI_PROJECT_NAME}_${VERSION}
DIR_SOURCE=${
PWD}
####################################################
### step 2: check settings
echo ""
echo ${PROMPT}"CICD Variables:----------"
echo ${PROMPT}QtLib=${DIR_LIBQT}
echo ${PROMPT}Source=${DIR_SOURCE}
echo ${PROMPT}Build=${DIR_BUILD}
echo ${PROMPT}Install=${DIR_INSTALL}
echo ${PROMPT}Depends=${DIR_DEPENDS}
echo ${PROMPT}Version=${VERSION}
echo ${PROMPT}lib_dir_check_exception=${lib_dir_check_exception}
[ ! -d ${DIR_LIBQT} ] && echo "${DIR_LIBQT} not exists!" && exit 1
[ ! -d ${DIR_SOURCE} ] && echo "${DIR_SOURCE} not exists!" && exit 1
[ ! -d ${DIR_DEPENDS} ] && echo "${DIR_DEPENDS} not exists!" && exit 1
if [ "#${VERSION,,}" = "#debug" ] ; then
VERSION=debug
else
VERSION=release
fi
rm -fr ${DIR_INSTALL}/${VERSION}
mkdir -p ${DIR_BUILD}/${VERSION}
mkdir -p ${DIR_INSTALL}/${VERSION}
# the .pro files need environment variable 'DEPENDS_ROOT' to know
# the path to the dependencies
export DEPENDS_ROOT=${DIR_DEPENDS}
####################################################
### step 3: make and run shell command lines
if [ $SHADOW_BUILD = "YES" ] ; then
# delete target files (in docker's external volume)
cmd_clear_build="rm -fr /${DIR_BUILD}/${VERSION}/*"
cmd_chg_dir="cd ${DIR_BUILD}/${VERSION}"
cmd_del_mkfile="cd ${DIR_BUILD}/${VERSION} && rm -fr \`find -name Makefile\`"
# tell .pro files the build path
export BUILD_PATH=${DIR_BUILD}/${VERSION}
else
# no need to delete target files when building in source foler
cmd_clear_build="echo Building in source folder..."
cmd_chg_dir="cd ${DIR_SOURCE} "
cmd_del_mkfile="rm -fr \`find -name Makefile\`"
# tell .pro files the build path
export BUILD_PATH=${DIR_SOURCE}
fi
# tell .pro files the intallation path
export INSTALL_PATH=${DIR_INSTALL}/${VERSION}
first_pass=YES
echo ${PROMPT} Run QMake and make...
for pro_file in $(ls ${
DIR_SOURCE}/*.pro); do
if [ $SHADOW_BUILD = "YES" ] ; then
pro_name="${DIR_SOURCE}/$(basename ${
pro_file})"
else
pro_name=""
fi
if [ $first_pass = "YES" ] ; then
# clear install directory and build caches
cmd_clear="rm -fr ${DIR_INSTALL}/${VERSION}/* && ${cmd_clear_build}"
first_pass=NO
else
cmd_clear="echo 2nd pass..."
fi
if [ $VERSION = "debug" ] ; then
// Pay special attention to the setting of installation path here
cmd_qmake="${DIR_LIBQT}/bin/qmake ${pro_name} target.path="${DIR_INSTALL}" INSTALLS+=target -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug"
# make and generate compile database for code quality check
cmd_make="compiledb make -j 12 && compiledb -n make"
else
cmd_qmake="${DIR_LIBQT}/bin/qmake ${pro_name} target.path="${DIR_INSTALL}" INSTALLS+=target -spec linux-g++ CONFIG+=qtquickcompiler"
cmd_make="make -j 12"
fi
# ${cmd_qmake} is run twice to include the built targets for installation.
build_cmd="${cmd_qmake} && ${cmd_make} && ${cmd_del_mkfile} && ${cmd_qmake} && make install"
# generate log file
cmd_log="echo Built at $(date +%y%m%d_%H%M%S) >> ${DIR_INSTALL}/${VERSION}/build-log-$(date +%y%m%d_%H%M%S).txt"
cmdline="${cmd_clear} && ${cmd_chg_dir} && ${build_cmd} && ${cmd_log}"
echo ${PROMPT} SHELL: $cmdline
eval ${cmdline}
if [ $? -eq 0 ]; then
echo ${PROMPT}"${pro_file}-${VERSION} has been successfully built."
cp ${DIR_SOURCE}/scripts/startEngine.sh ${DIR_INSTALL}/${VERSION}/
cp ${DIR_SOURCE}/scripts/run-local.sh ${DIR_INSTALL}/${VERSION}/
else
echo ${PROMPT}" Build failed."
exit 1
fi
done
##### write version info into file
releaseNotes_filename="ReleaseNotes-$(date +%y%m%d_%H%M).txt"
cmd_last_half=">> ${DIR_INSTALL}/${VERSION}/${releaseNotes_filename}"
### add components updated info
version_cmd="echo build flow $(date +%y%m%d_%H%M%S) ${cmd_last_half}"
### add code info
version_cmd="${version_cmd} && echo ' ' ${cmd_last_half}"
version_cmd="${version_cmd} && echo Code info:---------- ${cmd_last_half}"
version_cmd="${version_cmd} && echo CI_COMMIT_SHA=${CI_COMMIT_SHA} ${cmd_last_half}"
version_cmd="${version_cmd} && echo CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA} ${cmd_last_half}"
version_cmd="${version_cmd} && echo CI_COMMIT_REF_NAME=${CI_COMMIT_REF_NAME} ${cmd_last_half}"
version_cmd="${version_cmd} && echo CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH} ${cmd_last_half}"
version_cmd="${version_cmd} && echo CI_COMMIT_TAG=${CI_COMMIT_TAG} ${cmd_last_half}"
### add building env.
version_cmd="${version_cmd} && echo ' ' ${cmd_last_half}"
version_cmd="${version_cmd} && echo Building Env.: ---------- ${cmd_last_half}"
version_cmd="${version_cmd} && echo depends_dir=${DIR_DEPENDS} ${cmd_last_half}"
version_cmd="${version_cmd} && echo docker_image=${docker_image} ${cmd_last_half}"
echo ${PROMPT} "write version info command:"
echo ${PROMPT} "${version_cmd}"
echo " "
eval "${version_cmd}"
if [ $? -eq 0 ]; then
echo ${PROMPT}"Write version info to file into finished."
else
echo ${PROMPT}"Write version info to file into failed."
exit 1
fi
echo ---------------------------------------------
ls * **/*
####################################################
### step 4: zip release vesion files of branch master or branch customized-FlowDesk-by-Zhongshan-University, then copy to samba SMB_SERVER
# check if need to zip and scp new files to samba server and gitlab runners
if [[ ${zip_scp} == "yes" ]] && [[ ${VERSION} == "release" ]] ; then
echo ${PROMPT} "-----Continue to zip and scp release version to samba server-----"
else
exit 0
fi
if [[ ${CI_COMMIT_REF_NAME} = *wuan* ]] || [[ ${CI_COMMIT_REF_NAME} = "master" ]] || [[ ! -z ${CI_COMMIT_TAG} ]]; then
# auto add remote runners authenticity key
sed -i "/StrictHostKeyChecking/c StrictHostKeyCheckig no" /etc/ssh/ssh_config
# zip package
filename_suffix="$(date +%y%m%d_%H%M)_${CI_COMMIT_SHORT_SHA}.zip"
if [[ ${CI_COMMIT_REF_NAME} = master ]];then
zip_filename="master_"${filename_suffix}
elif [[ ${CI_COMMIT_REF_NAME} = *Zhongshan* ]];then
zip_filename="cc"${filename_suffix}
elif [[ ! -z ${CI_COMMIT_TAG} ]];then
zip_filename="cc_"${CI_COMMIT_TAG}"_"${filename_suffix}
fi
echo "==============${zip_filename}===================="
zip_cmd="echo =====zip job begin====="
zip_cmd="${zip_cmd} && cd ${DIR_INSTALL}"
zip_cmd="${zip_cmd} && zip -ry ${zip_filename} ./release/*"
# copy zip files to sambaServer
cp_zipfiles="echo ----- copy files to samba server -----"
cp_zipfiles="${cp_zipfiles} && sshpass -p ${sambaServer_pwd} scp ${zip_filename} ${SMB_USER}@${SMB_SERVER}:${SMB_DIR}"
zip_cmdline="${zip_cmd} && ${cp_zipfiles} && rm ${zip_filename}"
echo ${PROMPT}"zip_cmdline:----------"
echo ${zip_cmdline}
echo ----------
eval "${zip_cmdline}"
if [ $? -eq 0 ]; then
echo ${PROMPT}"zip and copy ${zip_filename} to ${SMB_SERVER}/${SMB_DIR} finished."
else
echo ${PROMPT}" zip and copy files failed."
exit 0
fi
fi
边栏推荐
- 南航 PA3.1
- Some online academic report websites and machine learning videos
- 【STM32】实战3.1—用STM32与TB6600驱动器驱动42步进电机(一)
- [installation system] U disk installation system tutorial, using UltraISO to make U disk startup disk
- 深入理解Apache Hudi异步索引机制
- BUUCTF---Reverse---reverse1
- 中级网络工程师是什么?主要是考什么,有什么用?
- What does intermediate software evaluator test
- Online hard core tools
- 2022.7.3DAY595
猜你喜欢
2021 summary and 2022 outlook
The difference between monotonicity constraint and anti monotonicity constraint
中级软件评测师考什么
Leetcode-304: two dimensional area and retrieval - matrix immutable
China Southern Airlines pa3.1
[système recommandé 01] rechub
SQL Server knowledge gathering 9: modifying data
Opencv installation and environment configuration - vs2017
What are the test preparation materials and methods for soft exam information processing technicians?
想考中级软考,一般需要多少复习时间?
随机推荐
[OneNote] can't connect to the network and can't sync the problem
Unity websocket client
想考中级软考,一般需要多少复习时间?
Leetcode-560: subarray with sum K
How to prepare for the advanced soft test (network planning designer)?
Wallhaven壁纸桌面版
The gun startles the dragon, and the crowd "locks" Zhou Zhi
多线程-异步编排
SQL Server knowledge gathering 9: modifying data
CC2530 ZigBee iar8.10.1 environment construction
Openinstall and Hupu have reached a cooperation to mine the data value of sports culture industry
Records on the use of easyflash v3.3
Galaxy Kirin desktop operating system installation postgresql13 (source code installation)
[système recommandé 01] rechub
软考信息处理技术员有哪些备考资料与方法?
Deep understanding of Apache Hudi asynchronous indexing mechanism
CAS mechanism
使用Tansformer分割三维腹部多器官--UNETR实战
书签整理-程序员常用网站导航
Unity websocket server