build_partial.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. qtmake="/opt/Qt5.10.1/5.10.1/gcc_64/bin/qmake"
  3. check_result()
  4. {
  5. if [ "$1" != 0 ];then
  6. echo -e "\e[33m*************************************************\e[0m"
  7. echo -e "\e[31m Please modify build error first,Exit!\e[0m"
  8. echo -e "\e[33m*************************************************\e[0m"
  9. exit 1
  10. fi
  11. }
  12. cd src/include/proto
  13. sh ./protomake.sh
  14. cd ../../../
  15. module=$1
  16. echo -e "\e[33m module name: \e[1;33m $module \e[0m"
  17. projectDir=`pwd`
  18. echo -e "project folder \e[33m$projectDir\e[0m"
  19. MAKEOPT=-j8
  20. mkdir bin
  21. outputDir=$projectDir"/bin"
  22. echo -e "output folder \e[33m$outputDir\e[0m"
  23. cd src
  24. sourceDir=`pwd`
  25. echo -e "source code folder \e[33m$sourceDir\e[0m"
  26. moduleDir=`find . -type d -name $module`
  27. if [ $moduleDir ];then
  28. moduleDir=$sourceDir${moduleDir#*.}
  29. echo -e "module code folder \e[33m$moduleDir\e[0m"
  30. cd $moduleDir
  31. moduleName=$module".pro"
  32. echo -e "\e[1;35;47m START BUILD\e[0m"
  33. $qtmake $moduleName
  34. make $MAKEOPT
  35. check_result $?
  36. make clean
  37. cp $module $outputDir
  38. rm Makefile
  39. rm .qmake.stash
  40. rm $module
  41. cd $projectDir
  42. echo -e "\e[1;33;44m Build $module Success \e[0m"
  43. sleep 1
  44. echo -e "\e[35m Start deploy\e[0m"
  45. cp $outputDir"/"$module ./
  46. bash deploy.sh $module
  47. if [ "$?" == 1 ];then
  48. exit 1
  49. fi
  50. rm $module
  51. echo -e "\e[1;33;44m Deploy $module Success \e[0m"
  52. else
  53. echo -e "\e[31m Can't find module code, exit.....\e[0m"
  54. exit
  55. fi