Forráskód Böngészése

Merge topic 'rel-macos-apple-silicon'

56a075eb5d ci: update macOS package to produce universal binaries
b184cc256b ci: do not use sccache for macOS packaging
41bddf1028 ci: update to pre-built Qt 5.9.9 universal binaries for macOS packages
b201dc0d42 Utilities/Release: Add script to build Qt 5.9.9 macOS universal binaries

Acked-by: Kitware Robot <[email protected]>
Acked-by: Ben Boeckel <[email protected]>
Merge-request: !5595
Brad King 4 éve
szülő
commit
fd6c1e5a73

+ 1 - 1
.gitlab/artifacts.yml

@@ -74,7 +74,7 @@
         paths:
             # Any packages made.
             - build/cmake-*-Linux-x86_64.*
-            - build/cmake-*-Darwin-x86_64.*
+            - build/cmake-*-macos-universal.*
             # Any source packages made.
             - build/cmake-*.tar.gz
             - build/cmake-*.zip

+ 3 - 1
.gitlab/ci/configure_common.cmake

@@ -10,4 +10,6 @@ if (NOT "$ENV{CMAKE_BUILD_TYPE}" STREQUAL "")
   set(CMAKE_BUILD_TYPE "$ENV{CMAKE_BUILD_TYPE}" CACHE STRING "")
 endif ()
 
-include("${CMAKE_CURRENT_LIST_DIR}/configure_sccache.cmake")
+if (NOT configure_no_sccache)
+  include("${CMAKE_CURRENT_LIST_DIR}/configure_sccache.cmake")
+endif()

+ 7 - 3
.gitlab/ci/configure_macos_package.cmake

@@ -9,10 +9,10 @@ set(CPACK_DMG_FORMAT "UDBZ" CACHE STRING "")
 set(CMAKE_CXX_FLAGS "-stdlib=libc++" CACHE STRING "")
 set(CMAKE_C_STANDARD "11" CACHE STRING "")
 set(CMAKE_CXX_STANDARD "14" CACHE STRING "")
-set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "")
-set(CMAKE_OSX_DEPLOYMENT_TARGET "10.7" CACHE STRING "")
+set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
+set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "")
 set(CMAKE_SKIP_BOOTSTRAP_TEST "TRUE" CACHE STRING "")
-set(CPACK_SYSTEM_NAME "Darwin-x86_64" CACHE STRING "")
+set(CPACK_SYSTEM_NAME "macos-universal" CACHE STRING "")
 set(BUILD_CursesDialog "ON" CACHE BOOL "")
 set(BUILD_QtDialog "TRUE" CACHE BOOL "")
 set(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL "3" CACHE STRING "")
@@ -20,5 +20,9 @@ set(CMake_INSTALL_DEPENDENCIES "ON" CACHE BOOL "")
 set(CMAKE_SKIP_RPATH "TRUE" CACHE BOOL "")
 set(CMake_TEST_NO_FindPackageModeMakefileTest "TRUE" CACHE BOOL "")
 
+# XXX(sccache): restore sccache when it works for multiple architectures:
+# https://github.com/mozilla/sccache/issues/847
+set(configure_no_sccache 1)
+
 include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_common.cmake")
 include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")

+ 2 - 2
.gitlab/ci/download_qt.cmake

@@ -50,8 +50,8 @@ if (qt_platform STREQUAL "windows_x86")
 elseif (qt_platform STREQUAL "mac_x64")
   if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "package")
     list(APPEND qt_files
-      "qt-5.6.2-macosx10.7-x86_64.tar.xz")
-    set(qt_subdir "qt-5.6.2-macosx10.7-x86_64")
+      "qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz")
+    set(qt_subdir "qt-5.9.9-macosx10.10-x86_64-arm64")
   else ()
     set(qt_build_stamp "202009071110")
     set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}")

+ 1 - 1
.gitlab/ci/download_qt_hashes.cmake

@@ -10,4 +10,4 @@ set("5.15.1-0-202009071110qtwinextras-Windows-Windows_10-MSVC2015-Windows-Window
 
 set("5.15.1-0-202009071110qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" df2813ce7c6cb4287abd7956cd1cb9d08312e4ac1208b6cb57af4df11b8ebba1)
 
-set("qt-5.6.2-macosx10.7-x86_64.tar.xz_hash" 2b60373ea60037ce356d4c9f5a8c1df9854127a2c55118252e1a2f5a5f4e0010)
+set("qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz_hash" aa6229bc6bd01a44d18b07023417698fdf4de7a02b14e971b473d80956a57a1c)

+ 0 - 5
.gitlab/os-macos.yml

@@ -115,13 +115,8 @@
 
     script:
         - *before_script_macos
-        - .gitlab/ci/sccache.sh
-        # Allow the server to already be running.
-        - "sccache --start-server || :"
-        - sccache --show-stats
         - ctest -VV -S .gitlab/ci/ctest_configure.cmake
         - ctest -VV -S .gitlab/ci/ctest_build.cmake
-        - sccache --show-stats
         - cd build
         - cpack -G TGZ
         - cpack -G DragNDrop

+ 9 - 0
Help/release/3.19.rst

@@ -348,3 +348,12 @@ Changes made since CMake 3.19.0 include the following.
   been reverted to restore behavior from CMake 3.18 and below.
 
 * CUDA 11.1 support for Clang.
+
+3.19.2
+------
+
+* The precompiled macOS binary provided on ``cmake.org`` is now a
+  universal binary with ``x86_64`` and ``arm64`` architectures.
+  It requires macOS 10.10 or newer.
+  The package file naming pattern has been changed from
+  ``cmake-$ver-Darwin-x86_64`` to ``cmake-$ver-macos-universal``.

+ 6 - 0
Utilities/Release/README.rst

@@ -74,3 +74,9 @@ Each ``<os>/<arch>/`` directory contains the following:
   argument specifying either ``x86_64`` or ``i386``.
 
 .. _`kitware/cmake Docker Hub Repository`: https://hub.docker.com/r/kitware/cmake
+
+macOS
+-----
+
+The ``macos/`` directory contains scripts used to produce dependencies
+for building CMake binaries on macOS.

+ 132 - 0
Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash

@@ -0,0 +1,132 @@
+#!/usr/bin/env bash
+
+# Run this script on a macOS x86_64 host to generate Qt universal binaries.
+#
+# This script requires the 'makeuniversal' tool from:
+#
+#   https://github.com/fizzyade/makeuniversal
+#
+# Build it with an existing local Qt installation first.
+#
+# Set the PATH environment variable to contain the location of 'makeuniversal'.
+
+set -e
+set -x
+
+# Verify that 'makeuniversal' is available in the PATH.
+type -p makeuniversal >/dev/null
+
+# Download, verify, and extract sources.
+curl -OL https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz
+shasum -a 256 qt-everywhere-opensource-src-5.9.9.tar.xz | grep -q 5ce285209290a157d7f42ec8eb22bf3f1d76f2e03a95fc0b99b553391be01642
+tar xjf qt-everywhere-opensource-src-5.9.9.tar.xz
+
+# Build the x86_64 variant.
+mkdir qt-5.9.9-x86_64
+cd qt-5.9.9-x86_64
+../qt-everywhere-opensource-src-5.9.9/configure \
+  --prefix=/ \
+  -platform macx-clang \
+  -device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64 \
+  -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 \
+  -release \
+  -opensource -confirm-license \
+  -gui \
+  -widgets \
+  -no-gif \
+  -no-icu \
+  -no-pch \
+  -no-angle \
+  -no-opengl \
+  -no-dbus \
+  -no-harfbuzz \
+  -skip declarative \
+  -skip multimedia \
+  -skip qtcanvas3d \
+  -skip qtcharts \
+  -skip qtconnectivity \
+  -skip qtdeclarative \
+  -skip qtgamepad \
+  -skip qtlocation \
+  -skip qtmultimedia \
+  -skip qtnetworkauth \
+  -skip qtpurchasing \
+  -skip qtremoteobjects \
+  -skip qtscript \
+  -skip qtsensors \
+  -skip qtserialbus \
+  -skip qtserialport \
+  -skip qtsvg \
+  -skip qtwebchannel \
+  -skip qtwebengine \
+  -skip qtwebsockets \
+  -skip qtxmlpatterns \
+  -nomake examples \
+  -nomake tests \
+  -nomake tools
+make -j 8
+cd ..
+
+# Build the arm64 variant.
+mkdir qt-5.9.9-arm64
+cd qt-5.9.9-arm64
+../qt-everywhere-opensource-src-5.9.9/configure \
+  --prefix=/ \
+  -platform macx-clang \
+  -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 \
+  -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.10 \
+  -release \
+  -opensource -confirm-license \
+  -gui \
+  -widgets \
+  -no-gif \
+  -no-icu \
+  -no-pch \
+  -no-angle \
+  -no-opengl \
+  -no-dbus \
+  -no-harfbuzz \
+  -skip declarative \
+  -skip multimedia \
+  -skip qtcanvas3d \
+  -skip qtcharts \
+  -skip qtconnectivity \
+  -skip qtdeclarative \
+  -skip qtgamepad \
+  -skip qtlocation \
+  -skip qtmultimedia \
+  -skip qtnetworkauth \
+  -skip qtpurchasing \
+  -skip qtremoteobjects \
+  -skip qtscript \
+  -skip qtsensors \
+  -skip qtserialbus \
+  -skip qtserialport \
+  -skip qtsvg \
+  -skip qtwebchannel \
+  -skip qtwebengine \
+  -skip qtwebsockets \
+  -skip qtxmlpatterns \
+  -nomake examples \
+  -nomake tests \
+  -nomake tools
+# Some executables fail to link due to architecture mismatch.
+# Build what we can first.
+make -j 8 -k || true
+# Provide needed executables using the x86_64 variants.
+cp ../qt-5.9.9-x86_64/qtbase/bin/uic qtbase/bin/uic
+install_name_tool -add_rpath @executable_path/../../../qt-5.9.9-x86_64/qtbase/lib qtbase/bin/uic
+cp ../qt-5.9.9-x86_64/qtbase/bin/qlalr qtbase/bin/qlalr
+install_name_tool -add_rpath @executable_path/../../../qt-5.9.9-x86_64/qtbase/lib qtbase/bin/qlalr
+# Some parts still fail to build, but the parts we need can finish.
+make -j 8 -k || true
+cd ..
+
+# Combine the two builds into universal binaries.
+makeuniversal qt-5.9.9-univ qt-5.9.9-x86_64 qt-5.9.9-arm64
+cd qt-5.9.9-univ
+make install -j 8 INSTALL_ROOT=/tmp/qt-5.9.9-macosx10.10-x86_64-arm64
+cd ..
+
+# Create the final tarball containing universal binaries.
+tar cjf qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz -C /tmp qt-5.9.9-macosx10.10-x86_64-arm64