qt.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # Build Qt
  3. set -e
  4. OPTIONS=""
  5. CMAKE_OPTIONS=""
  6. for var in "$@"
  7. do
  8. if [ $var == "release" ]; then
  9. OPTIONS+="-static "
  10. fi
  11. if [ $var == "win-cross" ]; then
  12. CMAKE_OPTIONS+="-DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw-w64.cmake"
  13. fi
  14. done
  15. CORES=$(getconf _NPROCESSORS_ONLN)
  16. JOBS=$(($CORES-1))
  17. BASEDIR=$PWD/thirdparty/qt
  18. DEPLOYDIR=$BASEDIR/install
  19. QT_MAJOR=6
  20. QT_MINOR=1
  21. QT_BUGFIX=0
  22. UNAME_OUT="$(uname -s)"
  23. case "${UNAME_OUT}" in
  24. Linux*) MACHINE=Linux;;
  25. Darwin*) MACHINE=Mac;;
  26. CYGWIN*) MACHINE=Cygwin;;
  27. MINGW*) MACHINE=MinGw;;
  28. *) MACHINE="UNKNOWN:${UNAME_OUT}"
  29. esac
  30. if [ $MACHINE == "Linux" ]; then
  31. OPTIONS+="-xcb "
  32. fi
  33. URL="https://download.qt.io/official_releases/qt/$QT_MAJOR.$QT_MINOR/$QT_MAJOR.$QT_MINOR.$QT_BUGFIX/single/qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX.tar.xz"
  34. mkdir -p "$BASEDIR"
  35. if [ -d "$DEPLOYDIR" ]; then
  36. rm -rf "$DEPLOYDIR"
  37. fi
  38. mkdir -p "$DEPLOYDIR"
  39. pushd "$BASEDIR"
  40. if [ ! -f qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX.tar.xz ]; then
  41. wget $URL
  42. fi
  43. if [ -d "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX" ]; then
  44. rm -rf "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX"
  45. fi
  46. tar -xf "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX.tar.xz"
  47. pushd "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX"
  48. ./configure $OPTIONS -ltcg -optimize-size -no-pch -prefix "$DEPLOYDIR" -release -opensource -confirm-license \
  49. -nomake examples -nomake tests -nomake tools \
  50. -skip qtscxml -skip qtdatavis3d -skip qtcharts \
  51. -skip qtquickcontrols2 -skip qtvirtualkeyboard -skip qtshadertools \
  52. -skip qttranslations -skip qtdoc -skip qt3d -skip qtnetworkauth \
  53. -skip qt5compat -skip qtcoap -skip qtlottie -skip qtmqtt \
  54. -skip qtopcua -skip qtquick3d -skip qtquicktimeline -skip qttools \
  55. -skip qtactiveqt
  56. cmake --build . --parallel $JOBS $CMAKE_OPTIONS
  57. cmake --install .
  58. popd