当前位置:网站首页>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
边栏推荐
- How much review time does it usually take to take the intermediate soft exam?
- P1031 [noip2002 improvement group] average Solitaire
- Unity websocket client
- Typescript interface inheritance
- Long list performance optimization scheme memo
- Records on the use of easyflash v3.3
- Mendeley -- a free document management tool that automatically inserts references into papers
- Installation and configuration of slurm resource management and job scheduling system
- What are the test preparation materials and methods for soft exam information processing technicians?
- Unity downloads files through the server address
猜你喜欢
![[recommendation system 02] deepfm, youtubednn, DSSM, MMOE](/img/d5/33765983e6b98235ca085f503a1272.png)
[recommendation system 02] deepfm, youtubednn, DSSM, MMOE

seata 1.3.0 四種模式解决分布式事務(AT、TCC、SAGA、XA)

枪出惊龙,众“锁”周之

Elegant controller layer code

PHP \ newline cannot be output

Unity script generates configurable files and loads

使用Tansformer分割三维腹部多器官--UNETR实战

ThreadLocal is not enough

单调性约束与反单调性约束的区别 monotonicity and anti-monotonicity constraint

“梦想杯”2017 年江苏省信息与未来小学生夏令营 IT 小能手 PK 之程序设计试题
随机推荐
软考信息处理技术员有哪些备考资料与方法?
Différences entre les contraintes monotones et anti - monotones
2022年7月10日“五心公益”活动通知+报名入口(二维码)
PHP \ newline cannot be output
高级软考(网络规划设计师)该如何备考?
路由器开发知识汇总
【推荐系统 02】DeepFM、YoutubeDNN、DSSM、MMOE
【STM32】实战3.1—用STM32与TB6600驱动器驱动42步进电机(一)
Get pictures through opencv, change channels and save them
Gym installation pit records
Arduino board description
Laya common script commands
长列表性能优化方案 memo
Mendeley -- a free document management tool that automatically inserts references into papers
Deeply understand the characteristics of database transaction isolation
CSAPP Bomb Lab 解析
[daiy5] jz77 print binary tree in zigzag order
1324: [example 6.6] integer interval
【OneNote】无法连接到网络,无法同步问题
gym安装踩坑记录