From 92021198e532052739ac57b0dbf75c183eae41f1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 16 Dec 2020 15:24:02 -0500 Subject: [PATCH 01/22] cmSystemTools: Revert use of MOVEFILE_WRITE_THROUGH by RenameFile on Windows Revert commit d78c22aa64 (cmSystemTools: Improve RenameFile on Windows with MOVEFILE_WRITE_THROUGH, 2020-08-25, v3.19.0-rc1~243^2~3). Using this flag causes the operation to fail frequently in some environments. Drop it for now pending further investigation. Fixes: #21571 --- Source/cmSystemTools.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 97440d21a9..6a705f480d 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -952,9 +952,8 @@ bool cmMoveFile(std::wstring const& oldname, std::wstring const& newname) SetLastError(0); // Use MOVEFILE_REPLACE_EXISTING to replace an existing destination file. - // Use MOVEFILE_WRITE_THROUGH to flush the change to disk before returning. return MoveFileExW(oldname.c_str(), newname.c_str(), - MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH); + MOVEFILE_REPLACE_EXISTING); } } #endif From 2d84b9d14597713f93eccf31bbd5b70e3e1b3156 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sun, 20 Dec 2020 20:13:23 +1100 Subject: [PATCH 02/22] Help: Fix Sphinx not recognising list in XCODE_LINK_BUILD_PHASE_MODE --- Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst b/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst index 2a79bcae5b..836cc6b88a 100644 --- a/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst +++ b/Help/prop_tgt/XCODE_LINK_BUILD_PHASE_MODE.rst @@ -31,6 +31,7 @@ Possible values are: * ``KNOWN_LOCATION`` The "Link Binary With Libraries" build phase will be used to link to another target under the same conditions as with ``BUILT_ONLY`` and also: + - Imported library targets except those of type ``UNKNOWN``. - Any non-target library specified directly with a path. From 51595e5f014be2a948e2e3c3ab5a5ce165deabdf Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Tue, 22 Dec 2020 10:43:17 +1100 Subject: [PATCH 03/22] FetchContent: Relative SOURCE_DIR override cannot be a hard error Fixes: #21624 --- Modules/FetchContent.cmake | 9 ++++++++- .../ManualSourceDirectoryRelative-stderr.txt | 3 +++ .../FetchContent/ManualSourceDirectoryRelative.cmake | 1 + Tests/RunCMake/FetchContent/RunCMakeTest.cmake | 5 +++++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt create mode 100644 Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake index 40cc362142..c81b3711a5 100644 --- a/Modules/FetchContent.cmake +++ b/Modules/FetchContent.cmake @@ -1053,7 +1053,14 @@ function(FetchContent_Populate contentName) # so no population is required. The build directory may still be specified # by the declared details though. - if(NOT EXISTS "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + if(NOT IS_ABSOLUTE "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + # Don't check this directory because we don't know what location it is + # expected to be relative to. We can't make this a hard error for backward + # compatibility reasons. + message(WARNING "Relative source directory specified. This is not safe, " + "as it depends on the calling directory scope.\n" + " FETCHCONTENT_SOURCE_DIR_${contentNameUpper} --> ${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") + elseif(NOT EXISTS "${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") message(FATAL_ERROR "Manually specified source directory is missing:\n" " FETCHCONTENT_SOURCE_DIR_${contentNameUpper} --> ${FETCHCONTENT_SOURCE_DIR_${contentNameUpper}}") endif() diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt new file mode 100644 index 0000000000..3defcb402d --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative-stderr.txt @@ -0,0 +1,3 @@ + *Relative source directory specified. This is not safe, as it depends on + *the calling directory scope. ++ *FETCHCONTENT_SOURCE_DIR_WITHPROJECT --> WithProject diff --git a/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake new file mode 100644 index 0000000000..d8b42ba959 --- /dev/null +++ b/Tests/RunCMake/FetchContent/ManualSourceDirectoryRelative.cmake @@ -0,0 +1 @@ +include(ManualSourceDirectory.cmake) diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake index 3eb331f6b6..9baeab75e2 100644 --- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake +++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake @@ -21,6 +21,11 @@ run_cmake_with_options(ManualSourceDirectory run_cmake_with_options(ManualSourceDirectoryMissing -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT=${CMAKE_CURRENT_LIST_DIR}/ADirThatDoesNotExist" ) +# Need to use :STRING to prevent CMake from automatically converting it to an +# absolute path +run_cmake_with_options(ManualSourceDirectoryRelative + -D "FETCHCONTENT_SOURCE_DIR_WITHPROJECT:STRING=WithProject" +) function(run_FetchContent_DirOverrides) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/DirOverrides-build) From 3af067101959c0877d34d6e9fda3b15a4adba08a Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 21 Dec 2020 19:25:49 -0500 Subject: [PATCH 04/22] Tests: Fix ConfigSources test with empty CMAKE_BUILD_TYPE The test requires a non-empty `CMAKE_BUILD_TYPE` to function on single-config generators. Force a non-empty configuration if the test is configured explicitly with empty `-DCMAKE_BUILD_TYPE=`. --- Tests/ConfigSources/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ConfigSources/CMakeLists.txt b/Tests/ConfigSources/CMakeLists.txt index 1db00cc8af..9eed1c09b9 100644 --- a/Tests/ConfigSources/CMakeLists.txt +++ b/Tests/ConfigSources/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.0) get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(NOT _isMultiConfig AND NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build") + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build" FORCE) endif() project(ConfigSources CXX) From 595551a8053f5f466fd84e09ea6d855656708344 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 21 Dec 2020 20:31:34 -0500 Subject: [PATCH 05/22] gitlab-ci: consolidate Linux release package job spec for x86_64 --- .gitlab/os-linux.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index c69302a38a..57e4ae19b7 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -17,17 +17,12 @@ variables: GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" -.linux_package: - variables: - GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" - LAUNCHER: "scl enable devtoolset-6 rh-python36 --" - .linux_package_x86_64: - extends: .linux_package - image: "kitware/cmake:build-linux-x86_64-deps-2020-04-02@sha256:77e9ab183f34680990db9da5945473e288f0d6556bce79ecc1589670d656e157" variables: + GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" + LAUNCHER: "scl enable devtoolset-6 rh-python36 --" CMAKE_ARCH: x86_64 ### Debian From e14fb01c4149d3206dc87586101b233400a1ceba Mon Sep 17 00:00:00 2001 From: Hi Key Date: Wed, 25 Nov 2020 23:20:49 +0800 Subject: [PATCH 06/22] Utilities/Release: Add docker specs for Linux aarch64 binaries Base them on the existing `x86_64` specs. Update the centos base image from centos 6 to centos 7 to get aarch64 support. The resulting binaries require GLIBC 2.17. Fixes: #17923 --- Utilities/Release/linux/aarch64/Dockerfile | 35 +++++ .../Release/linux/aarch64/base/Dockerfile | 31 ++++ Utilities/Release/linux/aarch64/cache.txt | 44 ++++++ .../Release/linux/aarch64/deps/Dockerfile | 141 ++++++++++++++++++ .../linux/aarch64/deps/openssl-source.patch | 12 ++ .../linux/aarch64/deps/qt-install.patch | 24 +++ .../Release/linux/aarch64/test/Dockerfile | 26 ++++ .../Release/linux/aarch64/test/test-make.bash | 17 +++ .../linux/aarch64/test/test-ninja.bash | 17 +++ 9 files changed, 347 insertions(+) create mode 100644 Utilities/Release/linux/aarch64/Dockerfile create mode 100644 Utilities/Release/linux/aarch64/base/Dockerfile create mode 100644 Utilities/Release/linux/aarch64/cache.txt create mode 100644 Utilities/Release/linux/aarch64/deps/Dockerfile create mode 100644 Utilities/Release/linux/aarch64/deps/openssl-source.patch create mode 100644 Utilities/Release/linux/aarch64/deps/qt-install.patch create mode 100644 Utilities/Release/linux/aarch64/test/Dockerfile create mode 100644 Utilities/Release/linux/aarch64/test/test-make.bash create mode 100644 Utilities/Release/linux/aarch64/test/test-ninja.bash diff --git a/Utilities/Release/linux/aarch64/Dockerfile b/Utilities/Release/linux/aarch64/Dockerfile new file mode 100644 index 0000000000..4077b79dea --- /dev/null +++ b/Utilities/Release/linux/aarch64/Dockerfile @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce an image containing a portable CMake binary package for Linux/aarch64. +# Build using the CMake source directory as the build context. +# The resulting image will have an '/out' directory containing the package. + +# Keep this in sync with the `.gitlab-ci.yml` `release_linux` image. +ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-aarch64-deps-2020-12-21 +ARG FROM_IMAGE_DIGEST=@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +COPY . /opt/cmake/src/cmake + +ARG TEST=true + +RUN : \ + && mkdir -p /opt/cmake/src/cmake-build \ + && cd /opt/cmake/src/cmake-build \ + && cp ../cmake/Utilities/Release/linux/aarch64/cache.txt CMakeCache.txt \ + && source /opt/rh/devtoolset-7/enable \ + && set -x \ + && ../cmake/bootstrap --parallel=$(nproc) --docdir=doc/cmake \ + && nice make -j $(nproc) \ + && if $TEST; then \ + # Run tests that require the full build tree. + bin/ctest --output-on-failure -j 8 -R '^(CMake\.|CMakeLib\.|CMakeServerLib\.|RunCMake\.ctest_memcheck)'; \ + fi \ + && bin/cpack -G TGZ \ + && bin/cpack -G STGZ \ + && set +x \ + && mkdir /out \ + && mv cmake-*-Linux-aarch64.* /out \ + && : diff --git a/Utilities/Release/linux/aarch64/base/Dockerfile b/Utilities/Release/linux/aarch64/base/Dockerfile new file mode 100644 index 0000000000..b9c683e9ee --- /dev/null +++ b/Utilities/Release/linux/aarch64/base/Dockerfile @@ -0,0 +1,31 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce a base image with a build environment for portable CMake binaries. +# Build using the directory containing this file as its own build context. + +ARG FROM_IMAGE_NAME=centos:7 +ARG FROM_IMAGE_DIGEST=@sha256:43964203bf5d7fe38c6fca6166ac89e4c095e2b0c0a28f6c7c678a1348ddc7fa +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +RUN : \ + && yum install -y centos-release-scl \ + && yum install -y \ + ca-certificates \ + curl \ + devtoolset-7-gcc \ + devtoolset-7-gcc-c++ \ + fontconfig-devel \ + freetype-devel \ + git \ + libX11-devel \ + libxcb-devel \ + make \ + patch \ + perl \ + python3-pip \ + xz \ + which \ + && yum clean all \ + && : diff --git a/Utilities/Release/linux/aarch64/cache.txt b/Utilities/Release/linux/aarch64/cache.txt new file mode 100644 index 0000000000..89050d1f15 --- /dev/null +++ b/Utilities/Release/linux/aarch64/cache.txt @@ -0,0 +1,44 @@ +CMAKE_BUILD_TYPE:STRING=Release + +CMAKE_C_STANDARD:STRING=11 +CMAKE_CXX_STANDARD:STRING=14 + +# Require only older APIs where possible. +CMAKE_C_FLAGS:STRING=-D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 + +# Link C++ library statically. +CMAKE_EXE_LINKER_FLAGS:STRING=-static-libstdc++ -static-libgcc + +# Enable ssl support in curl +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:STRING=/opt/openssl/lib/libcrypto.a;-pthread +OPENSSL_INCLUDE_DIR:PATH=/opt/openssl/include +OPENSSL_SSL_LIBRARY:FILEPATH=/opt/openssl/lib/libssl.a + +# Enable ccmake +BUILD_CursesDialog:BOOL=ON +CURSES_FORM_LIBRARY:FILEPATH=/opt/ncurses/lib/libform.a +CURSES_INCLUDE_PATH:PATH=/opt/ncurses/include +CURSES_NCURSES_LIBRARY:FILEPATH=/opt/ncurses/lib/libncurses.a + +# Enable cmake-gui with static qt plugins +BUILD_QtDialog:BOOL=TRUE +CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL:STRING=3 +CMAKE_PREFIX_PATH:STRING=/opt/qt +CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES:STRING=/opt/qt/plugins/platforms/libqxcb.a;/opt/qt/lib/libQt5XcbQpa.a;/opt/qt/lib/libQt5ServiceSupport.a;/opt/qt/lib/libQt5EdidSupport.a;/opt/qt/lib/libQt5EventDispatcherSupport.a;/opt/qt/lib/libQt5FontDatabaseSupport.a;/opt/qt/lib/libQt5ThemeSupport.a;/opt/qt/lib/libxcb-static.a;-lxcb;-lfontconfig;-lfreetype + +# Build documentation. +SPHINX_EXECUTABLE:FILEPATH=/usr/local/bin/sphinx-build +SPHINX_HTML:BOOL=ON +SPHINX_MAN:BOOL=ON +SPHINX_QTHELP:BOOL=ON +QCOLLECTIONGENERATOR_EXECUTABLE:PATH=/opt/qt/bin/qhelpgenerator + +# We bootstrap as part of the build so skip its test. +CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE + +# Skip Qt5 tests because our Qt is static. +CMake_TEST_Qt5:BOOL=FALSE + +# CPack package file name component for this platform. +CPACK_SYSTEM_NAME:STRING=Linux-aarch64 diff --git a/Utilities/Release/linux/aarch64/deps/Dockerfile b/Utilities/Release/linux/aarch64/deps/Dockerfile new file mode 100644 index 0000000000..8d0f6fdbea --- /dev/null +++ b/Utilities/Release/linux/aarch64/deps/Dockerfile @@ -0,0 +1,141 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce an image with custom-built dependencies for portable CMake binaries. +# Build using the directory containing this file as its own build context. + +ARG FROM_IMAGE_NAME=kitware/cmake:build-linux-aarch64-base-2020-12-21 +ARG FROM_IMAGE_DIGEST=@sha256:c8d9fa279ef09c26e74ff28770ae0db1f4cb75ef53b782ace604daba71a41f65 +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +# Sphinx +RUN : \ + && pip3 install sphinx==2.1.2 \ + && : + +# Qt +# Version 5.12.0 was the last to bundle xkbcommon. +COPY qt-install.patch /opt/qt/src/ +RUN : \ + && mkdir -p /opt/qt/src/qt-build \ + && cd /opt/qt/src \ + && curl -OL https://download.qt.io/archive/qt/5.12/5.12.0/single/qt-everywhere-src-5.12.0.tar.xz \ + && sha512sum qt-everywhere-src-5.12.0.tar.xz | grep -q 0dd03d2645fb6dac5b58c8caf92b4a0a6900131f1ccfb02443a0df4702b5da0458f4c45e758d1b929ec709b0f4b36900df2fd60a058af9cc8c1a0748b6d57aae \ + && tar xJf qt-everywhere-src-5.12.0.tar.xz \ + && cd qt-build \ + && source /opt/rh/devtoolset-7/enable \ + && ../qt-everywhere-src-5.12.0/configure \ + -prefix /opt/qt \ + -static \ + -release \ + -c++std c++11 \ + -opensource -confirm-license \ + -gui \ + -widgets \ + -xcb \ + -fontconfig \ + -sql-sqlite \ + -qt-doubleconversion \ + -qt-libjpeg \ + -qt-libpng \ + -qt-pcre \ + -qt-sqlite \ + -qt-xcb \ + -qt-xkbcommon \ + -qt-zlib \ + -system-freetype \ + -no-accessibility \ + -no-compile-examples \ + -no-cups \ + -no-dbus \ + -no-directfb \ + -no-egl \ + -no-eglfs \ + -no-evdev \ + -no-gbm \ + -no-gif \ + -no-glib \ + -no-gtk \ + -no-harfbuzz \ + -no-iconv \ + -no-icu \ + -no-journald \ + -no-kms \ + -no-libinput \ + -no-libproxy \ + -no-linuxfb \ + -no-ltcg \ + -no-mirclient \ + -no-mtdev \ + -no-opengl \ + -no-openssl \ + -no-pch \ + -no-sql-mysql \ + -no-sql-psql \ + -no-sql-sqlite2 \ + -no-syslog \ + -no-system-proxies \ + -no-tslib \ + -no-use-gold-linker \ + -skip declarative \ + -skip multimedia \ + -skip qtcanvas3d \ + -skip qtconnectivity \ + -skip qtdeclarative \ + -skip qtlocation \ + -skip qtmultimedia \ + -skip qtsensors \ + -skip qtserialport \ + -skip qtsvg \ + -skip qtwayland \ + -skip qtwebchannel \ + -skip qtwebengine \ + -skip qtwebsockets \ + -skip qtwinextras \ + -skip qtxmlpatterns \ + -nomake examples \ + -nomake tests \ + && make install -j $(nproc) \ + && cd /opt/qt \ + && patch -p1 -i src/qt-install.patch \ + && cd /opt \ + && rm -rf /opt/qt/src \ + && : + +# Curses +RUN : \ + && mkdir -p /opt/ncurses/src/ncurses-build \ + && cd /opt/ncurses/src \ + && curl -O https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz \ + && sha512sum ncurses-6.1.tar.gz | grep -q e308af43f8b7e01e98a55f4f6c4ee4d1c39ce09d95399fa555b3f0cdf5fd0db0f4c4d820b4af78a63f6cf6d8627587114a40af48cfc066134b600520808a77ee \ + && tar xzf ncurses-6.1.tar.gz \ + && cd ncurses-build \ + && source /opt/rh/devtoolset-7/enable \ + && ../ncurses-6.1/configure \ + --prefix=/opt/ncurses \ + --with-terminfo-dirs=/etc/terminfo:/lib/terminfo:/usr/share/terminfo \ + --with-default-terminfo-dir=/usr/share/terminfo \ + --without-shared \ + && make -j $(nproc) \ + && make install.libs install.includes \ + && cd /opt \ + && rm -rf /opt/ncurses/src \ + && : + +# OpenSSL +COPY openssl-source.patch /opt/openssl/src/ +RUN : \ + && mkdir -p /opt/openssl/src \ + && cd /opt/openssl/src \ + && curl -O https://www.openssl.org/source/openssl-1.1.1f.tar.gz \ + && sha512sum openssl-1.1.1f.tar.gz | grep -q b00bd9b5ad5298fbceeec6bb19c1ab0c106ca5cfb31178497c58bf7e0e0cf30fcc19c20f84e23af31cc126bf2447d3e4f8461db97bafa7bd78f69561932f000c \ + && tar xzf openssl-1.1.1f.tar.gz \ + && cd openssl-1.1.1f \ + && patch -p1 -i ../openssl-source.patch \ + && source /opt/rh/devtoolset-7/enable \ + && ./Configure --prefix=/opt/openssl linux-elf no-asm no-shared -D_POSIX_C_SOURCE=199506L -D_POSIX_SOURCE=1 -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 \ + && make install_dev -j $(nproc) \ + && cd /opt \ + && rm -rf /opt/openssl/src \ + && : diff --git a/Utilities/Release/linux/aarch64/deps/openssl-source.patch b/Utilities/Release/linux/aarch64/deps/openssl-source.patch new file mode 100644 index 0000000000..c81fe2f88c --- /dev/null +++ b/Utilities/Release/linux/aarch64/deps/openssl-source.patch @@ -0,0 +1,12 @@ +# enable pthread APIs disabled by our _POSIX_SOURCE definitions +--- openssl-source/crypto/threads_pthread.c.orig ++++ openssl-source/crypto/threads_pthread.c +@@ -6,6 +6,8 @@ + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ ++#undef _POSIX_C_SOURCE ++#undef _POSIX_SOURCE + + #include + #include "internal/cryptlib.h" diff --git a/Utilities/Release/linux/aarch64/deps/qt-install.patch b/Utilities/Release/linux/aarch64/deps/qt-install.patch new file mode 100644 index 0000000000..792aefd397 --- /dev/null +++ b/Utilities/Release/linux/aarch64/deps/qt-install.patch @@ -0,0 +1,24 @@ +# Add Qt Core dependencies missing from static Qt build. +--- qt-install/lib/cmake/Qt5Core/Qt5CoreConfig.cmake.orig ++++ qt-install/lib/cmake/Qt5Core/Qt5CoreConfig.cmake +@@ -111,7 +111,7 @@ + list(REMOVE_DUPLICATES Qt5Core_COMPILE_DEFINITIONS) + list(REMOVE_DUPLICATES Qt5Core_EXECUTABLE_COMPILE_FLAGS) + +- set(_Qt5Core_LIB_DEPENDENCIES "") ++ set(_Qt5Core_LIB_DEPENDENCIES "${_qt5Core_install_prefix}/lib/libqtpcre2.a") + + + add_library(Qt5::Core STATIC IMPORTED) +# Add Qt Gui dependencies missing from static Qt build. +--- qt-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake.orig ++++ qt-install/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake +@@ -111,7 +111,7 @@ + list(REMOVE_DUPLICATES Qt5Gui_COMPILE_DEFINITIONS) + list(REMOVE_DUPLICATES Qt5Gui_EXECUTABLE_COMPILE_FLAGS) + +- set(_Qt5Gui_LIB_DEPENDENCIES "Qt5::Core") ++ set(_Qt5Gui_LIB_DEPENDENCIES "Qt5::Core;${_qt5Gui_install_prefix}/lib/libqtlibpng.a") + + + add_library(Qt5::Gui STATIC IMPORTED) diff --git a/Utilities/Release/linux/aarch64/test/Dockerfile b/Utilities/Release/linux/aarch64/test/Dockerfile new file mode 100644 index 0000000000..03674fbbcc --- /dev/null +++ b/Utilities/Release/linux/aarch64/test/Dockerfile @@ -0,0 +1,26 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +# Produce a base image with a test environment for packaged CMake binaries. +# Build using the directory containing this file as its own build context. + +ARG FROM_IMAGE_NAME=debian:10 +ARG FROM_IMAGE_DIGEST=@sha256:ab0ba5b78bfe01d61ac4f9919cd0e7bef8beefa0a77d3d710bfc8630d96804b8 +ARG FROM_IMAGE=$FROM_IMAGE_NAME$FROM_IMAGE_DIGEST +FROM $FROM_IMAGE + +RUN : \ + && apt-get update \ + && apt-get install -y \ + dpkg \ + file \ + gcc \ + g++ \ + gfortran \ + qt5-default \ + make \ + ninja-build \ + && apt-get clean \ + && : + +COPY test-make.bash test-ninja.bash / diff --git a/Utilities/Release/linux/aarch64/test/test-make.bash b/Utilities/Release/linux/aarch64/test/test-make.bash new file mode 100644 index 0000000000..10d30c38a3 --- /dev/null +++ b/Utilities/Release/linux/aarch64/test/test-make.bash @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +set -e +set -x +mkdir -p /opt/cmake/src/cmake-make +cd /opt/cmake/src/cmake-make +echo >CMakeCache.txt ' +CMake_TEST_IPO_WORKS_C:BOOL=ON +CMake_TEST_IPO_WORKS_CXX:BOOL=ON +CMake_TEST_IPO_WORKS_Fortran:BOOL=ON +CMake_TEST_NO_NETWORK:BOOL=ON +CMake_TEST_Qt5:BOOL=ON +' +cmake ../cmake -DCMake_TEST_HOST_CMAKE=1 -G "Unix Makefiles" +make -j $(nproc) +ctest --output-on-failure -j $(nproc) diff --git a/Utilities/Release/linux/aarch64/test/test-ninja.bash b/Utilities/Release/linux/aarch64/test/test-ninja.bash new file mode 100644 index 0000000000..fe39e2e636 --- /dev/null +++ b/Utilities/Release/linux/aarch64/test/test-ninja.bash @@ -0,0 +1,17 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +set -e +set -x +mkdir -p /opt/cmake/src/cmake-ninja +cd /opt/cmake/src/cmake-ninja +echo >CMakeCache.txt ' +CMAKE_Fortran_COMPILER:STRING= +CMake_TEST_IPO_WORKS_C:BOOL=ON +CMake_TEST_IPO_WORKS_CXX:BOOL=ON +CMake_TEST_NO_NETWORK:BOOL=ON +CMake_TEST_Qt5:BOOL=ON +' +cmake ../cmake -DCMake_TEST_HOST_CMAKE=1 -G "Ninja" +ninja +ctest --output-on-failure -j $(nproc) From 76742c4cbe7194edfbaba2950008530e4253b885 Mon Sep 17 00:00:00 2001 From: Hi Key Date: Wed, 25 Nov 2020 23:20:49 +0800 Subject: [PATCH 07/22] gitlab-ci: add jobs to make Linux release packages for aarch64 on 3.19 branch --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ .gitlab/artifacts.yml | 1 + .gitlab/ci/sccache.sh | 21 ++++++++++++++------- .gitlab/os-linux.yml | 15 +++++++++++++++ 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5550c2fc87..270ff11e0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -186,6 +186,29 @@ build:linux-x86_64-package: variables: RSYNC_DESTINATION: dev +build:linux-aarch64-package: + extends: + - .linux_package_aarch64 + - .cmake_build_linux_package + - .cmake_release_artifacts + - .linux_builder_tags_aarch64 + - .run_only_for_package + dependencies: + - prep:doc-package + needs: + - prep:doc-package + +.upload:linux-aarch64-package: + extends: + - .rsync_upload + - .run_only_for_package + dependencies: + - build:linux-aarch64-package + needs: + - build:linux-aarch64-package + variables: + RSYNC_DESTINATION: dev + # macOS builds build:macos-ninja: diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml index 589b16cee8..76ffd27713 100644 --- a/.gitlab/artifacts.yml +++ b/.gitlab/artifacts.yml @@ -74,6 +74,7 @@ paths: # Any packages made. - build/cmake-*-Linux-x86_64.* + - build/cmake-*-Linux-aarch64.* - build/cmake-*-macos-universal.* # Any source packages made. - build/cmake-*.tar.gz diff --git a/.gitlab/ci/sccache.sh b/.gitlab/ci/sccache.sh index af24710406..77bedaa2ed 100755 --- a/.gitlab/ci/sccache.sh +++ b/.gitlab/ci/sccache.sh @@ -2,21 +2,30 @@ set -e -case "$( uname -s )" in - Linux) +readonly kernel="$(uname -s)-$(uname -m)" +case $kernel in + Linux-x86_64) version="0.2.13" shatool="sha256sum" sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb" platform="x86_64-unknown-linux-musl" ;; - Darwin) + Linux-aarch64) + version="g6628e1f" + shatool="sha256sum" + sha256sum="bb88adbb5a29c166ecaa78d0593493b609a7f84d91d1228502a908f319b513f0" + platform="aarch64-unknown-linux-musl" + url="https://github.com/hwinit/sccache/releases/download/$version" + ;; + Darwin-x86_64) version="gfe63078" shatool="shasum -a 256" sha256sum="60a0302b1d7227f7ef56abd82266353f570d27c6e850c56c6448bf62def38888" platform="x86_64-apple-darwin" + url="https://paraview.org/files/dependencies" ;; *) - echo "Unrecognized platform $( uname -s )" + echo "Unrecognized platform $kernel" exit 1 ;; esac @@ -28,9 +37,7 @@ readonly platform readonly filename="sccache-$version-$platform" readonly tarball="$filename.tar.gz" -if [ "$( uname -s )" = "Darwin" ]; then - url="https://paraview.org/files/dependencies" -else +if [ -z "$url" ]; then url="https://github.com/mozilla/sccache/releases/download/$version" fi readonly url diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 57e4ae19b7..bfd164bcb1 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -25,6 +25,14 @@ LAUNCHER: "scl enable devtoolset-6 rh-python36 --" CMAKE_ARCH: x86_64 +.linux_package_aarch64: + image: "kitware/cmake:build-linux-aarch64-deps-2020-12-21@sha256:0bd7dfe4e45593b04e39cd21e44011034610cfd376900558c5ef959bb1af15af" + + variables: + GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci" + LAUNCHER: "scl enable devtoolset-7 --" + CMAKE_ARCH: aarch64 + ### Debian .debian10: @@ -155,6 +163,13 @@ - docker - linux +.linux_builder_tags_aarch64: + tags: + - cmake + - build + - docker + - linux-aarch64 + ## Linux-specific scripts .before_script_linux: &before_script_linux From 2c1127a7a99cd5d7fe534b9b938f66008c6c0a06 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 21 Dec 2020 21:06:52 -0500 Subject: [PATCH 08/22] Help: Add 3.19.3 release note for Linux aarch64 binary --- Help/release/3.19.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index 60a8eccdff..eb49c6f94e 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -385,3 +385,8 @@ Changes made since CMake 3.19.0 include the following. * The :variable:`CMAKE_ISPC_HEADER_SUFFIX` variable and corresponding :prop_tgt:`ISPC_HEADER_SUFFIX` target property were added to control the header suffix used by ``ISPC`` compiler generated headers. + +3.19.3 +------ + +* A precompiled Linux ``aarch64`` binary is now provided on ``cmake.org``. From a5b223aa7f946d774548bc22e7df6319ba6db134 Mon Sep 17 00:00:00 2001 From: Eduard Valeyev Date: Sun, 27 Dec 2020 13:54:55 -0500 Subject: [PATCH 09/22] FindMPI: remove single quotes from include path Intel OneAPI's MPI wraps include paths into single quotes, remove them when sanitizing _MPI_INCLUDE_PATH Fixes: #21634 --- Modules/FindMPI.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index b531e4740b..789a72eb39 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -646,6 +646,7 @@ function (_MPI_interrogate_compiler LANG) foreach(_MPI_INCLUDE_PATH IN LISTS MPI_ALL_INCLUDE_PATHS) string(REGEX REPLACE "^ ?${_MPI_PREPROCESSOR_FLAG_REGEX}${CMAKE_INCLUDE_FLAG_${LANG}} *" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") string(REPLACE "\"" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") + string(REPLACE "'" "" _MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}") get_filename_component(_MPI_INCLUDE_PATH "${_MPI_INCLUDE_PATH}" REALPATH) list(APPEND MPI_INCLUDE_DIRS_WORK "${_MPI_INCLUDE_PATH}") endforeach() From 5267ba9d63524479a11d71f7a4458cf95b8ef445 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sat, 26 Dec 2020 20:24:55 +0000 Subject: [PATCH 10/22] FindHDF5: Fix finding both debug and release libs Use `target_link_libraries` to set `INTERFACE_LINK_LIBRARIES` so that the `debug` and `optimized` keywords work. In commit a8e0a6b3e4 (FindHDF5: Port changes from VTK, 2020-06-10, v3.19.0-rc1~312^2~1) we added use of `HDF5_LIBRARIES`, but the value may contain `debug` and `optimized` keywords. Fixes: #21637 --- Modules/FindHDF5.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 0c1e93b09b..25f5a1f0a5 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -991,10 +991,10 @@ if (HDF5_FOUND) add_library(HDF5::HDF5 INTERFACE IMPORTED) string(REPLACE "-D" "" _hdf5_definitions "${HDF5_DEFINITIONS}") set_target_properties(HDF5::HDF5 PROPERTIES - INTERFACE_LINK_LIBRARIES "${HDF5_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIRS}" INTERFACE_COMPILE_DEFINITIONS "${_hdf5_definitions}") unset(_hdf5_definitions) + target_link_libraries(HDF5::HDF5 INTERFACE ${HDF5_LIBRARIES}) endif () foreach (hdf5_lang IN LISTS HDF5_LANGUAGE_BINDINGS) From 7b4a50d6226fa8560a2b9f98a6d8413d750265c9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Jan 2021 12:47:02 -0500 Subject: [PATCH 11/22] gitlab-ci: update macOS jobs to use Xcode 12.3 --- .gitlab/os-macos.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 8a006b1a31..7819e3f584 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -7,7 +7,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmake ci ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-12.2.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode-12.3.app/Contents/Developer" # Avoid conflicting with other projects running on the same machine. SCCACHE_SERVER_PORT: 4227 @@ -63,7 +63,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-12.2 + - xcode-12.3 - nonconcurrent .macos_builder_tags_package: @@ -71,7 +71,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-12.2 + - xcode-12.3 - nonconcurrent - finder @@ -80,7 +80,7 @@ - cmake # Since this is a bare runner, pin to a project. - macos - shell - - xcode-12.2 + - xcode-12.3 - concurrent ## macOS-specific scripts From d250b67722abcfe1bcd22511943f3e032ef1ef3d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Jan 2021 15:29:24 -0500 Subject: [PATCH 12/22] cmGlobalXCodeGenerator: Adopt pbxproj object id generation --- Source/cmGlobalXCodeGenerator.cxx | 24 ++++++++++++++++++++++-- Source/cmGlobalXCodeGenerator.h | 1 + Source/cmXCode21Object.cxx | 5 +++-- Source/cmXCode21Object.h | 2 +- Source/cmXCodeObject.cxx | 24 ++---------------------- Source/cmXCodeObject.h | 2 +- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7ee94b2942..af8b2f048d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -799,7 +799,8 @@ void cmGlobalXCodeGenerator::addObject(std::unique_ptr obj) cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( cmXCodeObject::PBXType ptype) { - auto obj = cm::make_unique(ptype, cmXCodeObject::OBJECT); + auto obj = cm::make_unique(ptype, cmXCodeObject::OBJECT, + this->GetObjectId()); auto ptr = obj.get(); this->addObject(std::move(obj)); return ptr; @@ -807,7 +808,9 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( cmXCodeObject* cmGlobalXCodeGenerator::CreateObject(cmXCodeObject::Type type) { - auto obj = cm::make_unique(cmXCodeObject::None, type); + auto obj = cm::make_unique( + cmXCodeObject::None, type, + "Temporary cmake object, should not be referred to in Xcode file"); auto ptr = obj.get(); this->addObject(std::move(obj)); return ptr; @@ -3138,6 +3141,23 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget( return i->second; } +std::string cmGlobalXCodeGenerator::GetObjectId() +{ + std::string objectId; + char cUuid[40] = { 0 }; + CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); + CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid); + CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8); + objectId = cUuid; + CFRelease(s); + CFRelease(uuid); + cmSystemTools::ReplaceString(objectId, "-", ""); + if (objectId.size() > 24) { + objectId = objectId.substr(0, 24); + } + return objectId; +} + std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, const std::string& id) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index ab5eeb2dd0..277ee8275e 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -162,6 +162,7 @@ private: const std::string& configName); cmXCodeObject* FindXCodeTarget(const cmGeneratorTarget*); + std::string GetObjectId(); std::string GetOrCreateId(const std::string& name, const std::string& id); // create cmXCodeObject from these functions so that memory can be managed diff --git a/Source/cmXCode21Object.cxx b/Source/cmXCode21Object.cxx index 1cf9a9513c..9b0dc58b20 100644 --- a/Source/cmXCode21Object.cxx +++ b/Source/cmXCode21Object.cxx @@ -4,11 +4,12 @@ #include #include +#include #include "cmSystemTools.h" -cmXCode21Object::cmXCode21Object(PBXType ptype, Type type) - : cmXCodeObject(ptype, type) +cmXCode21Object::cmXCode21Object(PBXType ptype, Type type, std::string id) + : cmXCodeObject(ptype, type, std::move(id)) { this->Version = 21; } diff --git a/Source/cmXCode21Object.h b/Source/cmXCode21Object.h index eb017447b4..f3fc43898d 100644 --- a/Source/cmXCode21Object.h +++ b/Source/cmXCode21Object.h @@ -13,7 +13,7 @@ class cmXCode21Object : public cmXCodeObject { public: - cmXCode21Object(PBXType ptype, Type type); + cmXCode21Object(PBXType ptype, Type type, std::string id); void PrintComment(std::ostream&) override; static void PrintList(std::vector> const&, std::ostream& out, PBXType t); diff --git a/Source/cmXCodeObject.cxx b/Source/cmXCodeObject.cxx index b301ab1213..d5c52756b1 100644 --- a/Source/cmXCodeObject.cxx +++ b/Source/cmXCodeObject.cxx @@ -40,7 +40,7 @@ cmXCodeObject::~cmXCodeObject() this->Version = 15; } -cmXCodeObject::cmXCodeObject(PBXType ptype, Type type) +cmXCodeObject::cmXCodeObject(PBXType ptype, Type type, std::string id) { this->Version = 15; this->Target = nullptr; @@ -48,27 +48,7 @@ cmXCodeObject::cmXCodeObject(PBXType ptype, Type type) this->IsA = ptype; - if (type == OBJECT) { - // Set the Id of an Xcode object to a unique string for each instance. - // However the Xcode user file references certain Ids: for those cases, - // override the generated Id using SetId(). - // - char cUuid[40] = { 0 }; - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid); - CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8); - this->Id = cUuid; - CFRelease(s); - CFRelease(uuid); - } else { - this->Id = - "Temporary cmake object, should not be referred to in Xcode file"; - } - - cmSystemTools::ReplaceString(this->Id, "-", ""); - if (this->Id.size() > 24) { - this->Id = this->Id.substr(0, 24); - } + this->Id = std::move(id); this->TypeValue = type; if (this->TypeValue == OBJECT) { diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 78d4727f6c..ac5be3f9e3 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -57,7 +57,7 @@ public: }; static const char* PBXTypeNames[]; virtual ~cmXCodeObject(); - cmXCodeObject(PBXType ptype, Type type); + cmXCodeObject(PBXType ptype, Type type, std::string id); Type GetType() const { return this->TypeValue; } PBXType GetIsA() const { return this->IsA; } From 2892228dc9e70aab3a724058a043068f87c860f6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Jan 2021 16:15:11 -0500 Subject: [PATCH 13/22] cmGlobalXCodeGenerator: Add infrastructure for deterministic object ids --- Source/cmGlobalXCodeGenerator.cxx | 36 ++++++++++++++++++++----------- Source/cmGlobalXCodeGenerator.h | 7 ++++-- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index af8b2f048d..419cf1e05e 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -18,6 +18,7 @@ #include "cmsys/RegularExpression.hxx" #include "cmComputeLinkInformation.h" +#include "cmCryptoHash.h" #include "cmCustomCommand.h" #include "cmCustomCommandGenerator.h" #include "cmCustomCommandLines.h" @@ -797,10 +798,10 @@ void cmGlobalXCodeGenerator::addObject(std::unique_ptr obj) } cmXCodeObject* cmGlobalXCodeGenerator::CreateObject( - cmXCodeObject::PBXType ptype) + cmXCodeObject::PBXType ptype, cm::string_view key) { auto obj = cm::make_unique(ptype, cmXCodeObject::OBJECT, - this->GetObjectId()); + this->GetObjectId(ptype, key)); auto ptr = obj.get(); this->addObject(std::move(obj)); return ptr; @@ -3141,19 +3142,28 @@ cmXCodeObject* cmGlobalXCodeGenerator::FindXCodeTarget( return i->second; } -std::string cmGlobalXCodeGenerator::GetObjectId() +std::string cmGlobalXCodeGenerator::GetObjectId(cmXCodeObject::PBXType ptype, + cm::string_view key) { std::string objectId; - char cUuid[40] = { 0 }; - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid); - CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8); - objectId = cUuid; - CFRelease(s); - CFRelease(uuid); - cmSystemTools::ReplaceString(objectId, "-", ""); - if (objectId.size() > 24) { - objectId = objectId.substr(0, 24); + if (!key.empty()) { + cmCryptoHash hash(cmCryptoHash::AlgoSHA256); + hash.Initialize(); + hash.Append(&ptype, sizeof(ptype)); + hash.Append(key); + objectId = cmSystemTools::UpperCase(hash.FinalizeHex().substr(0, 24)); + } else { + char cUuid[40] = { 0 }; + CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); + CFStringRef s = CFUUIDCreateString(kCFAllocatorDefault, uuid); + CFStringGetCString(s, cUuid, sizeof(cUuid), kCFStringEncodingUTF8); + objectId = cUuid; + CFRelease(s); + CFRelease(uuid); + cmSystemTools::ReplaceString(objectId, "-", ""); + if (objectId.size() > 24) { + objectId = objectId.substr(0, 24); + } } return objectId; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 277ee8275e..e9b38fcdc7 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -11,6 +11,8 @@ #include #include +#include + #include "cmGlobalGenerator.h" #include "cmXCodeObject.h" @@ -162,12 +164,13 @@ private: const std::string& configName); cmXCodeObject* FindXCodeTarget(const cmGeneratorTarget*); - std::string GetObjectId(); + std::string GetObjectId(cmXCodeObject::PBXType ptype, cm::string_view key); std::string GetOrCreateId(const std::string& name, const std::string& id); // create cmXCodeObject from these functions so that memory can be managed // correctly. All objects created are stored in this->XCodeObjects. - cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype); + cmXCodeObject* CreateObject(cmXCodeObject::PBXType ptype, + cm::string_view key = {}); cmXCodeObject* CreateObject(cmXCodeObject::Type type); cmXCodeObject* CreateString(const std::string& s); cmXCodeObject* CreateObjectReference(cmXCodeObject*); From b8b6573db81327fc1800d9b1a92eb97820d7f972 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Jan 2021 16:15:35 -0500 Subject: [PATCH 14/22] Xcode: Use deterministic object ids for script build phases The Xcode "new build system" only considers a script build phase up to date if it has run before, even if outputs are newer than inputs. Use a deterministic object id for script build phases associated with custom commands so that they do not need to re-run after CMake re-generates the project. Fixes: #21669 --- Source/cmGlobalXCodeGenerator.cxx | 21 +++++++++++-------- Source/cmGlobalXCodeGenerator.h | 3 ++- .../RepeatCMake-Custom-Script.cmake | 4 ++++ .../BuildDepends/RepeatCMake-Custom.cmake | 5 +++++ .../RunCMake/BuildDepends/RunCMakeTest.cmake | 17 +++++++++++++++ 5 files changed, 40 insertions(+), 10 deletions(-) create mode 100644 Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake create mode 100644 Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 419cf1e05e..df45b35230 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1729,13 +1729,13 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( if (this->XcodeBuildSystem >= BuildSystem::Twelve) { // create prebuild phase preBuildPhase = - this->CreateRunScriptBuildPhase("CMake PreBuild Rules", prebuild); + this->CreateRunScriptBuildPhase("CMake PreBuild Rules", gtgt, prebuild); // create prelink phase preLinkPhase = - this->CreateRunScriptBuildPhase("CMake PreLink Rules", prelink); + this->CreateRunScriptBuildPhase("CMake PreLink Rules", gtgt, prelink); // create postbuild phase - postBuildPhase = - this->CreateRunScriptBuildPhase("CMake PostBuild Rules", postbuild); + postBuildPhase = this->CreateRunScriptBuildPhase("CMake PostBuild Rules", + gtgt, postbuild); } else { std::vector classes; if (!gtgt->GetConfigCommonSourceFiles(classes)) { @@ -1863,7 +1863,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( } cmXCodeObject* buildPhase = - this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); + this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase, + cmStrCat(gt->GetName(), ':', sf->GetFullPath())); buildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -1922,7 +1923,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( } cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( - std::string const& name, std::vector const& commands) + std::string const& name, cmGeneratorTarget const* gt, + std::vector const& commands) { if (commands.empty()) { return nullptr; @@ -1945,7 +1947,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateRunScriptBuildPhase( } cmXCodeObject* buildPhase = - this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); + this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase, + cmStrCat(gt->GetName(), ':', name)); buildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -2913,8 +2916,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( cmGeneratorTarget* gtgt) { - cmXCodeObject* shellBuildPhase = - this->CreateObject(cmXCodeObject::PBXShellScriptBuildPhase); + cmXCodeObject* shellBuildPhase = this->CreateObject( + cmXCodeObject::PBXShellScriptBuildPhase, gtgt->GetName()); shellBuildPhase->AddAttribute("buildActionMask", this->CreateString("2147483647")); cmXCodeObject* buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST); diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index e9b38fcdc7..8ff6846e96 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -254,7 +254,8 @@ private: cmGeneratorTarget const* gt, cmCustomCommand const& cc); cmXCodeObject* CreateRunScriptBuildPhase( - std::string const& name, std::vector const& commands); + std::string const& name, cmGeneratorTarget const* gt, + std::vector const& commands); std::string ConstructScript(cmCustomCommandGenerator const& ccg); void CreateReRunCMakeFile(cmLocalGenerator* root, std::vector const& gens); diff --git a/Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake new file mode 100644 index 0000000000..3e953b349e --- /dev/null +++ b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom-Script.cmake @@ -0,0 +1,4 @@ +if(EXISTS "${CMAKE_CURRENT_BINARY_DIR}/exists-for-build2") + message(FATAL_ERROR "Custom command incorrectly re-ran after CMake re-ran!") +endif() +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/out.txt") diff --git a/Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake new file mode 100644 index 0000000000..697e485467 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/RepeatCMake-Custom.cmake @@ -0,0 +1,5 @@ +add_custom_command(OUTPUT out.txt + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_LIST_DIR}/RepeatCMake-Custom-Script.cmake + DEPENDS ${CMAKE_CURRENT_LIST_DIR}/RepeatCMake-Custom-Script.cmake + ) +add_custom_target(drive ALL DEPENDS out.txt) diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 7a68c4bd8a..6c6d548d77 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -70,6 +70,23 @@ if(RunCMake_GENERATOR MATCHES "Make") endif() endif() +function(run_RepeatCMake CASE) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build) + if(RunCMake_GENERATOR_IS_MULTI_CONFIG) + set(RunCMake_TEST_OPTIONS -DCMAKE_CONFIGURATION_TYPES=Debug) + else() + set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug) + endif() + run_cmake(${CASE}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${CASE}-build1 ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${CASE}-rerun1 ${CMAKE_COMMAND} .) + file(WRITE ${RunCMake_TEST_BINARY_DIR}/exists-for-build2 "") + run_cmake_command(${CASE}-build2 ${CMAKE_COMMAND} --build . --config Debug) +endfunction() + +run_RepeatCMake(RepeatCMake-Custom) + function(run_ReGeneration) # test re-generation of project even if CMakeLists.txt files disappeared From 3679b74a69151b246d0df329793dbeebfe9fdb66 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Jan 2021 10:42:59 -0500 Subject: [PATCH 15/22] gitlab-ci: update upload jobs to go to cmake.org Upload binaries to `cmake.org` through its own name rather than through the `public.kitware.com` alias. --- .gitlab/upload.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/upload.yml b/.gitlab/upload.yml index 6bfa763120..8b8daa106f 100644 --- a/.gitlab/upload.yml +++ b/.gitlab/upload.yml @@ -15,4 +15,4 @@ - dnf install -y --setopt=install_weak_deps=False rsync openssh-clients - chmod 400 $RSYNC_BINARY_KEY - ssh-keygen -y -f $RSYNC_BINARY_KEY > $RSYNC_BINARY_KEY.pub - - rsync -tv --recursive -e "ssh -i $RSYNC_BINARY_KEY -o StrictHostKeyChecking=no -o LogLevel=ERROR" build/ kitware@public.kitware.com:$RSYNC_DESTINATION/ + - rsync -tv --recursive -e "ssh -i $RSYNC_BINARY_KEY -o StrictHostKeyChecking=no -o LogLevel=ERROR" build/ kitware@cmake.org:$RSYNC_DESTINATION/ From 2c5f30b4721d18d2ff39595021c3ee6ec2341a8e Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Jan 2021 09:52:44 -0500 Subject: [PATCH 16/22] cmake-gui: Fix macOS styling for binaries distributed with Qt 5.10+ According to https://bugreports.qt.io/browse/QTBUG-59428, Qt 5.10 and above moved macOS style handling into a separate `qmacstyle` plugin. Install the plugin in our `CMake.app` package on macOS. Issue: #21606 --- Source/QtDialog/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 452a303a31..f7d9b77947 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -57,6 +57,9 @@ if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32)) endmacro() if(APPLE) install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS) + if(TARGET Qt5::QMacStylePlugin) + install_qt5_plugin("Qt5::QMacStylePlugin" QT_PLUGINS) + endif() file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" "[Paths]\nPlugins = ${_qt_plugin_dir}\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" From 97e238f61bf79bb4bee74175168c0f79d7a78b82 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 7 Jan 2021 16:04:31 -0500 Subject: [PATCH 17/22] Utilities/Release: Fix macOS Qt 5.9 build script umask Produce a tarball with world-readable permissions. --- Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash b/Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash index a61e114c2c..79931ecc20 100755 --- a/Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash +++ b/Utilities/Release/macos/qt-5.9.9-macosx10.10-x86_64-arm64.bash @@ -13,6 +13,8 @@ set -e set -x +umask 022 + # Verify that 'makeuniversal' is available in the PATH. type -p makeuniversal >/dev/null From bbec5a03c820a9f5a397bc3310cba9f123dcfd57 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Jan 2021 12:59:02 -0500 Subject: [PATCH 18/22] Utilities/Release: Add script to build Qt 5.15.2 macOS universal binaries These may be used to build a CMake universal binary for macOS that supports both architectures on Apple Silicon and is compatible with OS X 10.13. --- .../qt-5.15.2-macosx10.13-x86_64-arm64.bash | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100755 Utilities/Release/macos/qt-5.15.2-macosx10.13-x86_64-arm64.bash diff --git a/Utilities/Release/macos/qt-5.15.2-macosx10.13-x86_64-arm64.bash b/Utilities/Release/macos/qt-5.15.2-macosx10.13-x86_64-arm64.bash new file mode 100755 index 0000000000..bf92e627cd --- /dev/null +++ b/Utilities/Release/macos/qt-5.15.2-macosx10.13-x86_64-arm64.bash @@ -0,0 +1,125 @@ +#!/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 + +umask 022 + +# 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.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz +shasum -a 256 qt-everywhere-src-5.15.2.tar.xz | grep -q 3a530d1b243b5dec00bc54937455471aaa3e56849d2593edb8ded07228202240 +tar xjf qt-everywhere-src-5.15.2.tar.xz + +# Build the x86_64 variant. +mkdir qt-5.15.2-x86_64 +cd qt-5.15.2-x86_64 +../qt-everywhere-src-5.15.2/configure \ + --prefix=/ \ + -platform macx-clang \ + -device-option QMAKE_APPLE_DEVICE_ARCHS=x86_64 \ + -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.13 \ + -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.15.2-arm64 +cd qt-5.15.2-arm64 +../qt-everywhere-src-5.15.2/configure \ + --prefix=/ \ + -platform macx-clang \ + -device-option QMAKE_APPLE_DEVICE_ARCHS=arm64 \ + -device-option QMAKE_MACOSX_DEPLOYMENT_TARGET=10.13 \ + -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 -k +cd .. + +# Combine the two builds into universal binaries. +makeuniversal qt-5.15.2-univ qt-5.15.2-x86_64 qt-5.15.2-arm64 +cd qt-5.15.2-univ +make install -j 8 INSTALL_ROOT=/tmp/qt-5.15.2-macosx10.13-x86_64-arm64 +cd .. + +# Create the final tarball containing universal binaries. +tar cjf qt-5.15.2-macosx10.13-x86_64-arm64.tar.xz -C /tmp qt-5.15.2-macosx10.13-x86_64-arm64 From 6410425e5b036dc643ea40343899c04cf8b2fc85 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 6 Jan 2021 17:02:23 -0500 Subject: [PATCH 19/22] ci: build separate macOS packages for macOS 10.13+ and macOS 10.10+ In order to support modern macOS features like Dark Mode, we need to use Qt 5.15, which requires macOS 10.13. However, we still want to support macOS 10.10 as well, for which we need to use Qt 5.9. Build separate macOS packages for these use cases. Fixes: #21606 Issue: #20825 --- .gitlab-ci.yml | 12 ++++++++ .gitlab/artifacts.yml | 2 +- .gitlab/ci/configure_macos10.10_package.cmake | 4 +++ .gitlab/ci/configure_macos_package.cmake | 28 ++----------------- .../ci/configure_macos_package_common.cmake | 26 +++++++++++++++++ .gitlab/ci/download_qt.cmake | 6 +++- .gitlab/ci/download_qt_hashes.cmake | 1 + .gitlab/os-macos.yml | 8 ++++++ Help/release/3.19.rst | 10 +++++++ 9 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 .gitlab/ci/configure_macos10.10_package.cmake create mode 100644 .gitlab/ci/configure_macos_package_common.cmake diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 270ff11e0b..057b8fc1b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -284,6 +284,18 @@ build:macos-package: variables: RSYNC_DESTINATION: dev +build:macos10.10-package: + extends: + - .macos10.10_package + - .cmake_build_macos_package + - .cmake_release_artifacts + - .macos_builder_tags_package + - .run_only_for_package + dependencies: + - prep:doc-package + needs: + - prep:doc-package + # Windows builds build:windows-vs2019-x64-ninja: diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml index 76ffd27713..87828e1ff4 100644 --- a/.gitlab/artifacts.yml +++ b/.gitlab/artifacts.yml @@ -75,7 +75,7 @@ # Any packages made. - build/cmake-*-Linux-x86_64.* - build/cmake-*-Linux-aarch64.* - - build/cmake-*-macos-universal.* + - build/cmake-*-macos*-universal.* # Any source packages made. - build/cmake-*.tar.gz - build/cmake-*.zip diff --git a/.gitlab/ci/configure_macos10.10_package.cmake b/.gitlab/ci/configure_macos10.10_package.cmake new file mode 100644 index 0000000000..f01e6c8a48 --- /dev/null +++ b/.gitlab/ci/configure_macos10.10_package.cmake @@ -0,0 +1,4 @@ +set(CPACK_SYSTEM_NAME "macos10.10-universal" CACHE STRING "") +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_package_common.cmake") diff --git a/.gitlab/ci/configure_macos_package.cmake b/.gitlab/ci/configure_macos_package.cmake index a1dbdb9659..380e44c05e 100644 --- a/.gitlab/ci/configure_macos_package.cmake +++ b/.gitlab/ci/configure_macos_package.cmake @@ -1,28 +1,4 @@ -set(CMake_DOC_ARTIFACT_PREFIX "$ENV{CI_PROJECT_DIR}/build/install-doc" CACHE PATH "") - -# Set up install destinations as expected by the packaging scripts. -set(CMAKE_INSTALL_PREFIX "/" CACHE PATH "") -set(CMAKE_DOC_DIR "doc/cmake" CACHE STRING "") - -# Settings for CMake packages for macOS. -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;arm64" CACHE STRING "") -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "") -set(CMAKE_SKIP_BOOTSTRAP_TEST "TRUE" 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 "") -set(CMake_INSTALL_DEPENDENCIES "ON" CACHE BOOL "") -set(CMAKE_SKIP_RPATH "TRUE" CACHE BOOL "") -set(CMake_TEST_NO_FindPackageModeMakefileTest "TRUE" CACHE BOOL "") +set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "") -# 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") +include("${CMAKE_CURRENT_LIST_DIR}/configure_macos_package_common.cmake") diff --git a/.gitlab/ci/configure_macos_package_common.cmake b/.gitlab/ci/configure_macos_package_common.cmake new file mode 100644 index 0000000000..3aa8ae22a0 --- /dev/null +++ b/.gitlab/ci/configure_macos_package_common.cmake @@ -0,0 +1,26 @@ +set(CMake_DOC_ARTIFACT_PREFIX "$ENV{CI_PROJECT_DIR}/build/install-doc" CACHE PATH "") + +# Set up install destinations as expected by the packaging scripts. +set(CMAKE_INSTALL_PREFIX "/" CACHE PATH "") +set(CMAKE_DOC_DIR "doc/cmake" CACHE STRING "") + +# Settings for CMake packages for macOS. +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;arm64" CACHE STRING "") +set(CMAKE_SKIP_BOOTSTRAP_TEST "TRUE" CACHE STRING "") +set(BUILD_CursesDialog "ON" CACHE BOOL "") +set(BUILD_QtDialog "TRUE" CACHE BOOL "") +set(CMake_GUI_DISTRIBUTE_WITH_Qt_LGPL "3" CACHE STRING "") +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") diff --git a/.gitlab/ci/download_qt.cmake b/.gitlab/ci/download_qt.cmake index 4a33f121a5..76c693dc5d 100644 --- a/.gitlab/ci/download_qt.cmake +++ b/.gitlab/ci/download_qt.cmake @@ -48,7 +48,11 @@ if (qt_platform STREQUAL "windows_x86") set(qt_subdir "${qt_version}/msvc${msvc_year}_64") elseif (qt_platform STREQUAL "mac_x64") - if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "package") + if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_package") + list(APPEND qt_files + "qt-5.15.2-macosx10.13-x86_64-arm64.tar.xz") + set(qt_subdir "qt-5.15.2-macosx10.13-x86_64-arm64") + elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos10.10_package") list(APPEND qt_files "qt-5.9.9-macosx10.10-x86_64-arm64.tar.xz") set(qt_subdir "qt-5.9.9-macosx10.10-x86_64-arm64") diff --git a/.gitlab/ci/download_qt_hashes.cmake b/.gitlab/ci/download_qt_hashes.cmake index 832fa989e2..afbc081710 100644 --- a/.gitlab/ci/download_qt_hashes.cmake +++ b/.gitlab/ci/download_qt_hashes.cmake @@ -11,3 +11,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.9.9-macosx10.10-x86_64-arm64.tar.xz_hash" d4449771afa0bc6a809c14f1e6d939e7732494cf059503ae451e2bfe8fc60cc1) +set("qt-5.15.2-macosx10.13-x86_64-arm64.tar.xz_hash" 7b9463a01c8beeee5bf8d01c70deff2d08561cd20aaf6f7a2f41cf8b68ce8a6b) diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 7819e3f584..450bae72cd 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -47,6 +47,14 @@ CTEST_NO_WARNINGS_ALLOWED: 1 CMake_SKIP_INSTALL: 1 +.macos10.10_package: + extends: .macos_build + + variables: + CMAKE_CONFIGURATION: macos10.10_package + CTEST_NO_WARNINGS_ALLOWED: 1 + CMake_SKIP_INSTALL: 1 + ### External testing .macos_xcode: diff --git a/Help/release/3.19.rst b/Help/release/3.19.rst index eb49c6f94e..7ad27c89fa 100644 --- a/Help/release/3.19.rst +++ b/Help/release/3.19.rst @@ -390,3 +390,13 @@ Changes made since CMake 3.19.0 include the following. ------ * A precompiled Linux ``aarch64`` binary is now provided on ``cmake.org``. + +* Two precompiled macOS binaries are now provided on ``cmake.org``: + + * The naming pattern ``cmake-$ver-macos-universal`` is a universal + binary with ``x86_64`` and ``arm64`` architectures. It requires + macOS 10.13 or newer. + + * The naming pattern ``cmake-$ver-macos10.10-universal`` is a universal + binary with ``x86_64`` and ``arm64`` architectures. It requires + macOS 10.10 or newer. From e6e7f2cab96066b5e7f595177a59ea1461608201 Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Sun, 10 Jan 2021 12:40:56 +0200 Subject: [PATCH 20/22] cmMakefile: Don't expand bracket arguments in --trace-expand Bracket arguments are literal and shouldn't be expanded. Fixes #21671. --- Source/cmMakefile.cxx | 2 +- Tests/RunCMake/CommandLine/trace-expand.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 0e4f888f03..39468417e5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -308,7 +308,7 @@ void cmMakefile::PrintCommandTrace( args.reserve(lff.Arguments().size()); for (cmListFileArgument const& arg : lff.Arguments()) { - if (expand) { + if (expand && arg.Delim != cmListFileArgument::Bracket) { temp = arg.Value; this->ExpandVariablesInString(temp); args.push_back(temp); diff --git a/Tests/RunCMake/CommandLine/trace-expand.cmake b/Tests/RunCMake/CommandLine/trace-expand.cmake index e69de29bb2..24da02a674 100644 --- a/Tests/RunCMake/CommandLine/trace-expand.cmake +++ b/Tests/RunCMake/CommandLine/trace-expand.cmake @@ -0,0 +1 @@ +set(a [[\B]]) From e20560a2dc9668bb9fd55bea79ef7508ab72c746 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Mon, 11 Jan 2021 14:43:36 -0500 Subject: [PATCH 21/22] cmake-gui: Restore linking of Qt resources Refactoring in commit 41e223deb3 (CMake GUI: Split up into libraries, add test shim, 2020-09-14, v3.19.0-rc1~116^2~2) broke linking of Qt resources, such as the Add/Remove Entry button icons. Fixes: #21682 --- Source/QtDialog/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index f7d9b77947..0f0c39a1f1 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -132,6 +132,7 @@ qt5_wrap_cpp(MOC_SRCS WarningMessagesDialog.h ) qt5_add_resources(RC_SRCS CMakeSetup.qrc) +add_library(CMakeGUIQRCLib OBJECT ${RC_SRCS}) if (FALSE) # CMake's bootstrap binary does not support automoc set(CMAKE_AUTOMOC 1) @@ -140,8 +141,7 @@ if (FALSE) # CMake's bootstrap binary does not support automoc else () list(APPEND SRCS ${UI_SRCS} - ${MOC_SRCS} - ${RC_SRCS}) + ${MOC_SRCS}) endif () if(USE_LGPL) @@ -164,6 +164,7 @@ target_link_libraries(CMakeGUIMainLib PUBLIC CMakeGUILib) add_executable(cmake-gui WIN32 MACOSX_BUNDLE CMakeGUIExec.cxx ${MANIFEST_FILE}) target_link_libraries(cmake-gui CMakeGUIMainLib Qt5::Core) +target_sources(CMakeGUIMainLib INTERFACE $) if(WIN32) target_sources(CMakeGUIMainLib INTERFACE $ CMakeSetup.rc) endif() From 19ff734e76a35d59eb0f973197cadb1c271c766c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 13 Jan 2021 07:58:18 -0500 Subject: [PATCH 22/22] CMake 3.19.3 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 799b2fc64f..0f9f8e8636 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 19) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0)