build-darwin.sh 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/bin/bash
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. set -euo pipefail
  9. # Limit Ninja jobs lower to avoid out of memory issues build qtwebengine
  10. export NINJAJOBS=-j12
  11. MAKE_FLAGS=-j32
  12. # Only Xcodebuilder 10.x or 11.x are known to build this version of Qt on mac successfully
  13. XCODEBUILD_VERSION=`xcodebuild -version | grep Xcode | awk '{print $2}'`
  14. XCODEBUILD_VERSION_MAJOR=`echo $XCODEBUILD_VERSION | awk -F. '{print $1}'`
  15. echo Xcodebuild version $XCODEBUILD_VERSION detected.
  16. if [ $XCODEBUILD_VERSION_MAJOR -gt "11" ]; then
  17. echo Error: Xcodebuild version $XCODEBUILD_VERSION detected. Only Xcodebuild version 10 or 11 have been tested with this version of Qt
  18. exit 1
  19. elif [ $XCODEBUILD_VERSION_MAJOR -lt "10" ]; then
  20. echo Error: Xcodebuild version $XCODEBUILD_VERSION detected. Only Xcodebuild version 10 or 11 have been tested with this version of Qt
  21. exit 1
  22. fi
  23. # TEMP_FOLDER and TARGET_INSTALL_ROOT get set from the pull_and_build_from_git.py script
  24. # Base the Tiff of the dependent tiff O3DE package (static)
  25. TIFF_PREFIX=$TEMP_FOLDER/tiff-4.2.0.15-rev3-mac/tiff
  26. TIFF_INCDIR=$TIFF_PREFIX/include
  27. TIFF_LIBDIR=$TIFF_PREFIX/lib
  28. # We need to also bring in the zlib dependency since Tiff is a static lib dependency
  29. ZLIB_PREFIX=$TEMP_FOLDER/zlib-1.2.11-rev5-mac/zlib
  30. ZLIB_INCDIR=$ZLIB_PREFIX/include
  31. ZLIB_LIBDIR=$ZLIB_PREFIX/lib
  32. BUILD_PATH=$TEMP_FOLDER/build
  33. [[ -d $BUILD_PATH ]] || mkdir $BUILD_PATH
  34. cd $BUILD_PATH
  35. echo Configuring Qt...
  36. ../src/configure \
  37. -prefix ${TARGET_INSTALL_ROOT} \
  38. -opensource \
  39. -nomake examples \
  40. -nomake tests \
  41. -confirm-license \
  42. -no-icu \
  43. -dbus \
  44. -no-separate-debug-info \
  45. -release \
  46. -force-debug-info \
  47. -qt-libpng \
  48. -qt-libjpeg \
  49. -no-feature-vnc \
  50. -no-feature-linuxfb \
  51. --tiff=system \
  52. -qt-zlib \
  53. -v \
  54. -no-cups \
  55. -no-glib \
  56. -no-feature-renameat2 \
  57. -no-feature-getentropy \
  58. -no-feature-statx \
  59. -no-egl \
  60. -I $TIFF_INCDIR \
  61. -I $ZLIB_INCDIR \
  62. -L $TIFF_LIBDIR \
  63. -L $ZLIB_LIBDIR
  64. echo Qt configured, building modules...
  65. qtarray=(qtbase qtgraphicaleffects qtimageformats qtsvg qttools qtmacextras qttranslations)
  66. for qtlib in "${qtarray[@]}"; do
  67. echo Building $qtlib...
  68. make module-$qtlib $MAKE_FLAGS
  69. echo Built $qtlib.
  70. done
  71. echo Finished building modules, installing...
  72. for qtlib in "${qtarray[@]}"; do
  73. echo Installing $qtlib...
  74. make module-$qtlib-install_subtargets
  75. echo $qtlib installed.
  76. done
  77. # The installation target on darwin is not installing the framework's header paths in the main
  78. # include folder. Create a symlink to the headers there for backwards compatibility
  79. cd $TARGET_INSTALL_ROOT/include
  80. qtframeworks=(QtConcurrent QtCore QtDBus QtDesigner QtDesignerComponents QtGui QtHelp QtMacExtras QtNetwork QtOpenGL QtPrintSupport QtQml QtQmlModels QtQmlWorkerScript QtQuick QtQuickParticles QtQuickShapes QtQuickTest QtQuickWidgets QtSql QtSvg QtTest QtUiPlugin QtWidgets QtXml QtZlib)
  81. for qtframework in "${qtframeworks[@]}"; do
  82. if [ -d $TARGET_INSTALL_ROOT/lib/$qtframework.framework/Headers ]; then
  83. echo "Linking ${TARGET_INSTALL_ROOT}/lib/${qtframework}.framework/Headers/ to ${TARGET_INSTALL_ROOT}/include/${qtframework}"
  84. ln -s ../lib/$qtframework.framework/Headers/ $qtframework
  85. else
  86. echo "Unable to find $TARGET_INSTALL_ROOT/lib/${qtframework}.framework/Headers (${qtframework}) Skipping.."
  87. fi
  88. done
  89. echo Qt installed successfully!