当前位置:网站首页>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
边栏推荐
- Arduino receives and sends strings
- 打算参加安全方面工作,信息安全工程师怎么样,软考考试需要怎么准备?
- Multisim -- software related skills
- BUUCTF---Reverse---reverse1
- I plan to take part in security work. How about information security engineers and how to prepare for the soft exam?
- 深入理解Apache Hudi异步索引机制
- 软考中级电子商务师含金量高嘛?
- Unity websocket server
- 單調性約束與反單調性約束的區別 monotonicity and anti-monotonicity constraint
- 2021 summary and 2022 outlook
猜你喜欢
单调性约束与反单调性约束的区别 monotonicity and anti-monotonicity constraint
How to prepare for the advanced soft test (network planning designer)?
1323: [example 6.5] activity selection
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
【推薦系統 01】Rechub
1321: [example 6.3] deletion problem (noip1994)
1324: [example 6.6] integer interval
想考中级软考,一般需要多少复习时间?
I plan to take part in security work. How about information security engineers and how to prepare for the soft exam?
2022年上半年5月网络工程师试题及答案
随机推荐
Use of dotween
Five simple and practical daily development functions of chrome are explained in detail. Unlock quickly to improve your efficiency!
那些易混淆的概念(三):function和class
2022年7月10日“五心公益”活动通知+报名入口(二维码)
软考一般什么时候出成绩呢?在线蹬?
CSAPP Bomb Lab 解析
[OneNote] can't connect to the network and can't sync the problem
2022.7.4DAY596
2022年上半年5月网络工程师试题及答案
SQL Server knowledge collection 11: Constraints
Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
Unable to open kernel device '\.\vmcidev\vmx': operation completed successfully. Reboot after installing vmware workstation? Module "devicepoweron" failed to start. Failed to start the virtual machine
【OneNote】无法连接到网络,无法同步问题
中级软件评测师考什么
seata 1.3.0 四種模式解决分布式事務(AT、TCC、SAGA、XA)
Unity websocket client
Operation method of Orange Pie orangepi 4 lts development board connecting SATA hard disk through mini PCIe
P1031 [noip2002 improvement group] average Solitaire
2022.7.3DAY595
Deep understanding of Apache Hudi asynchronous indexing mechanism