当前位置:网站首页>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
边栏推荐
- Network engineer test questions and answers in May of the first half of 2022
- Deeply analyze the main contents of erc-4907 agreement and think about the significance of this agreement to NFT market liquidity!
- How to successfully pass the senior system architecture designer in the second half of the year?
- CC2530 zigbee IAR8.10.1环境搭建
- MONAI版本更新到 0.9 啦,看看有什么新功能
- Deep understanding of Apache Hudi asynchronous indexing mechanism
- 【OneNote】无法连接到网络,无法同步问题
- Realize ray detection, drag the mouse to move the object and use the pulley to scale the object
- 使用 load_decathlon_datalist (MONAI)快速加载JSON数据
- What does intermediate software evaluator test
猜你喜欢

How to successfully pass the senior system architecture designer in the second half of the year?

2021 summary and 2022 outlook

Basic introduction of yarn and job submission process

CAS机制

Openinstall and Hupu have reached a cooperation to mine the data value of sports culture industry

ThreadLocal is not enough
![[installation system] U disk installation system tutorial, using UltraISO to make U disk startup disk](/img/41/3a9450a84291ba04caee65241bce5d.png)
[installation system] U disk installation system tutorial, using UltraISO to make U disk startup disk
![[OneNote] can't connect to the network and can't sync the problem](/img/28/9a02b1da0f43889989a9539c9fb6b6.png)
[OneNote] can't connect to the network and can't sync the problem

CSAPP bomb lab parsing
![P1223 queuing for water /1319: [example 6.1] queuing for water](/img/09/29f19b32f0a3c82ddb3c30d5d0b16e.png)
P1223 queuing for water /1319: [example 6.1] queuing for water
随机推荐
[actual combat] transformer architecture of the major medical segmentation challenges on the list --nnformer
BUUCTF---Reverse---reverse1
【pyqt】tableWidget里的cellWidget使用信号与槽机制
2021 summary and 2022 outlook
The difference between monotonicity constraint and anti monotonicity constraint
What are the test preparation materials and methods for soft exam information processing technicians?
Basic introduction of yarn and job submission process
Using U2 net deep network to realize -- certificate photo generation program
Mendeley -- a free document management tool that automatically inserts references into papers
Typescript interface inheritance
Find the greatest common divisor and the least common multiple (C language)
【推荐系统 01】Rechub
Unity websocket client
2022.7.4DAY596
使用 load_decathlon_datalist (MONAI)快速加载JSON数据
Deep understanding of Apache Hudi asynchronous indexing mechanism
Schnuka: working principle of robot visual grasping machine visual grasping
Elegant controller layer code
How much review time does it usually take to take the intermediate soft exam?
Is the gold content of intermediate e-commerce division in the soft exam high?