qt.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. # Build Qt
  3. set -e
  4. OPTIONS=""
  5. for var in "$@"
  6. do
  7. if [ $var == "release" ]; then
  8. OPTIONS+="-DBUILD_SHARED_LIBS=OFF "
  9. fi
  10. if [ $var == "win-cross" ]; then
  11. OPTIONS+="-DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw-w64.cmake "
  12. fi
  13. done
  14. CORES=$(getconf _NPROCESSORS_ONLN)
  15. JOBS=$(($CORES-1))
  16. BASEDIR=$PWD/thirdparty/qt
  17. DEPLOYDIR=$BASEDIR/install
  18. QT_MAJOR=6
  19. QT_MINOR=1
  20. QT_BUGFIX=0
  21. UNAME_OUT="$(uname -s)"
  22. case "${UNAME_OUT}" in
  23. Linux*) MACHINE=Linux;;
  24. Darwin*) MACHINE=Mac;;
  25. CYGWIN*) MACHINE=Cygwin;;
  26. MINGW*) MACHINE=MinGw;;
  27. *) MACHINE="UNKNOWN:${UNAME_OUT}"
  28. esac
  29. if [ $MACHINE == "Linux" ]; then
  30. OPTIONS+="-DINPUT_xcb=yes "
  31. fi
  32. 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"
  33. mkdir -p "$BASEDIR"
  34. if [ -d "$DEPLOYDIR" ]; then
  35. rm -rf "$DEPLOYDIR"
  36. fi
  37. mkdir -p "$DEPLOYDIR"
  38. pushd "$BASEDIR"
  39. if [ ! -f qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX.tar.xz ]; then
  40. wget $URL
  41. fi
  42. if [ -d "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX" ]; then
  43. rm -rf "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX"
  44. fi
  45. tar -xf "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX.tar.xz"
  46. pushd "qt-everywhere-src-$QT_MAJOR.$QT_MINOR.$QT_BUGFIX"
  47. cmake $OPTIONS -DBUILD_qtscxml=OFF -DBUILD_qtdatavis3d=OFF -DBUILD_qtcharts=OFF\
  48. -DBUILD_qtquickcontrols2=OFF -DBUILD_qtvirtualkeyboard=OFF -DBUILD_qtshadertools=OFF\
  49. -DBUILD_qttranslations=OFF -DBUILD_qtdoc=OFF -DBUILD_qt3d=OFF -DBUILD_qtnetworkauth=OFF\
  50. -DBUILD_qt5compat=OFF -DBUILD_qtcoap=OFF -DBUILD_qtlottie=OFF -DBUILD_qtmqtt=OFF\
  51. -DBUILD_qtopcua=OFF -DBUILD_qtquick3d=OFF -DBUILD_qtquicktimeline=OFF -DBUILD_qttools=OFF\
  52. -DBUILD_qtactiveqt=OFF -DBUILD_WITH_PCH=OFF\
  53. -DCMAKE_INSTALL_PREFIX="$DEPLOYDIR"\
  54. -DQT_BUILD_EXAMPLES=FALSE -DQT_BUILD_TESTS=FALSE\
  55. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=ON -DINPUT_optimize_size=yes -G Ninja
  56. cmake --build . --parallel $JOBS
  57. cmake --install .
  58. popd