diff options
author | Brad King <brad.king@kitware.com> | 2020-06-12 14:05:28 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-12 14:05:33 (GMT) |
commit | d42011e3cf274b5a204d64360fba72552fcc6fde (patch) | |
tree | 3ee8e27c5cc12cf9343280f13e95234ab77d210c | |
parent | 01fb8d7993f2ebcc47ce8ecab1aa5144a4ca4b80 (diff) | |
parent | d7679f642762c4ea5a8e0839bbf990eb179a648a (diff) | |
download | CMake-d42011e3cf274b5a204d64360fba72552fcc6fde.zip CMake-d42011e3cf274b5a204d64360fba72552fcc6fde.tar.gz CMake-d42011e3cf274b5a204d64360fba72552fcc6fde.tar.bz2 |
Merge topic 'gitlab-ci-more-qtdialog' into release-3.18
d7679f6427 QCMakeCacheView: use non-deprecated List and Set constructions
973fc56020 gitlab-ci: test QtDialog on macOS
1a995439e5 ci: add download information for Qt on macOS
881c0b86dd gitlab-ci: test QtDialog on Windows
b8d46d5e50 ci: add a script to download Qt
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4874
-rw-r--r-- | .gitlab-ci.yml | 5 | ||||
-rw-r--r-- | .gitlab/ci/configure_macos_common.cmake | 2 | ||||
-rw-r--r-- | .gitlab/ci/configure_windows_common.cmake | 4 | ||||
-rw-r--r-- | .gitlab/ci/configure_windows_vs2019_x64_ninja.cmake | 2 | ||||
-rw-r--r-- | .gitlab/ci/download_qt.cmake | 146 | ||||
-rw-r--r-- | .gitlab/ci/download_qt_hashes.cmake | 11 | ||||
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.cxx | 17 |
7 files changed, 184 insertions, 3 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3447964..c9f94f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -209,6 +209,9 @@ - export PATH=$PWD/.gitlab:$PWD/.gitlab/cmake/bin:$PATH - cmake --version - ninja --version + # Download Qt on macOS + - "[ \"$( uname -s )\" = \"Darwin\" ] && cmake -P .gitlab/ci/download_qt.cmake" + - "[ \"$( uname -s )\" = \"Darwin\" ] && export CMAKE_PREFIX_PATH=$PWD/.gitlab/qt" .before_script_windows: &before_script_windows - Invoke-Expression -Command .gitlab/ci/cmake.ps1 @@ -217,6 +220,8 @@ - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab;$pwdpath\.gitlab\cmake\bin;$env:PATH" - cmake --version - ninja --version + - cmake -P .gitlab/ci/download_qt.cmake + - Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\qt\bin;$env:PATH" .cmake_build_unix: &cmake_build_unix stage: build diff --git a/.gitlab/ci/configure_macos_common.cmake b/.gitlab/ci/configure_macos_common.cmake index 4b86d21..3589475 100644 --- a/.gitlab/ci/configure_macos_common.cmake +++ b/.gitlab/ci/configure_macos_common.cmake @@ -6,4 +6,6 @@ set(Java_JAVA_EXECUTABLE "" CACHE FILEPATH "") set(Java_JAVAC_EXECUTABLE "" CACHE FILEPATH "") set(Java_JAR_EXECUTABLE "" CACHE FILEPATH "") +set(BUILD_QtDialog ON CACHE BOOL "") + include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_windows_common.cmake b/.gitlab/ci/configure_windows_common.cmake new file mode 100644 index 0000000..45250ac --- /dev/null +++ b/.gitlab/ci/configure_windows_common.cmake @@ -0,0 +1,4 @@ +set(BUILD_QtDialog ON CACHE BOOL "") +set(CMAKE_PREFIX_PATH "$ENV{CI_PROJECT_DIR}/.gitlab/qt" CACHE STRING "") + +include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") diff --git a/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake index e2f00dd..719c93c 100644 --- a/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake +++ b/.gitlab/ci/configure_windows_vs2019_x64_ninja.cmake @@ -1,3 +1,3 @@ set(CMake_TEST_WIX_NO_VERIFY "ON" CACHE BOOL "") -include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/configure_windows_common.cmake") diff --git a/.gitlab/ci/download_qt.cmake b/.gitlab/ci/download_qt.cmake new file mode 100644 index 0000000..c392b1c --- /dev/null +++ b/.gitlab/ci/download_qt.cmake @@ -0,0 +1,146 @@ +cmake_minimum_required(VERSION 3.12) + +# Input variables. +set(qt_version_major "5") +set(qt_version_minor "15") +set(qt_version_patch "0") +# This URL is only visible inside of Kitware's network. Please use your own Qt +# Account to obtain these files. +set(qt_url_root "https://paraview.org/files/dependencies/internal/qt") + +# Determine the ABI to fetch for Qt. +if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2015") + set(qt_platform "windows_x86") + set(msvc_year "2015") + set(qt_abi "win64_msvc${msvc_year}_64") +elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2017" OR + "$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2019") + set(qt_platform "windows_x86") + set(msvc_year "2017") + set(qt_abi "win64_msvc${msvc_year}_64") +elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos") + set(qt_platform "mac_x64") + set(qt_abi "clang_64") +else () + message(FATAL_ERROR + "Unknown ABI to use for Qt") +endif () + +# Combined version variables. +set(qt_version "${qt_version_major}.${qt_version_minor}.${qt_version_patch}") +set(qt_version_nodot "${qt_version_major}${qt_version_minor}${qt_version_patch}") + +# Files needed to download. +set(qt_files) +if (qt_platform STREQUAL "windows_x86") + if (msvc_year STREQUAL "2017") + set(qt_build_stamp "202002260536") + elseif (msvc_year STREQUAL "2015") + set(qt_build_stamp "202005150700") + else () + message(FATAL_ERROR + "Build stamp for MSVC ${msvc_year} is unknown") + endif () + + set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}") + + foreach (qt_component IN ITEMS qtbase qtwinextras) + list(APPEND qt_files + "${qt_file_name_prefix}${qt_component}-Windows-Windows_10-MSVC${msvc_year}-Windows-Windows_10-X86_64.7z") + endforeach () + + set(qt_subdir "${qt_version}/msvc${msvc_year}_64") +elseif (qt_platform STREQUAL "mac_x64") + set(qt_build_stamp "202005140805") + set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}") + + foreach (qt_component IN ITEMS qtbase) + list(APPEND qt_files + "${qt_file_name_prefix}${qt_component}-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z") + endforeach () + + set(qt_subdir "${qt_version}/clang_64") +else () + message(FATAL_ERROR + "Unknown files for ${qt_platform}") +endif () + +# Verify that we know what directory will be extracted. +if (NOT qt_subdir) + message(FATAL_ERROR + "The extracted subdirectory is not set") +endif () + +# Build up the path to the file to download. +set(qt_url_path "${qt_platform}/desktop/qt5_${qt_version_nodot}/qt.qt5.${qt_version_nodot}.${qt_abi}") +set(qt_url_prefix "${qt_url_root}/${qt_url_path}") + +# Include the file containing the hashes of the files that matter. +include("${CMAKE_CURRENT_LIST_DIR}/download_qt_hashes.cmake") + +# Download and extract each file. +foreach (qt_file IN LISTS qt_files) + # Ensure we have a hash to verify. + if (NOT DEFINED "${qt_file}_hash") + message(FATAL_ERROR + "Unknown hash for ${qt_file}") + endif () + + # Download the file. + file(DOWNLOAD + "${qt_url_prefix}/${qt_file}" + ".gitlab/${qt_file}" + STATUS download_status + EXPECTED_HASH "SHA256=${${qt_file}_hash}") + + # Check the download status. + list(GET download_status 0 res) + if (res) + list(GET download_status 1 err) + message(FATAL_ERROR + "Failed to download ${qt_file}: ${err}") + endif () + + # Extract the file. + execute_process( + COMMAND + "${CMAKE_COMMAND}" + -E tar + xf "${qt_file}" + WORKING_DIRECTORY ".gitlab" + RESULT_VARIABLE res + ERROR_VARIABLE err + ERROR_STRIP_TRAILING_WHITESPACE) + if (res) + message(FATAL_ERROR + "Failed to extract ${qt_file}: ${err}") + endif () +endforeach () + +# The Windows tarballs have some unfortunate permissions in them that prevent +# deletion when `git clean -ffdx` tries to clean up the directory. +if (qt_platform STREQUAL "windows_x86") + # Fix permissions. + file(TO_NATIVE_PATH ".gitlab/${qt_subdir}/*.*" native_qt_dir) + execute_process( + # Remove any read-only flags that aren't affected by `icacls`. + COMMAND + attrib + -r # Remove readonly flag + "${native_qt_dir}" + /d # Treat as a directory + /s # Recursive + /l # Don't dereference symlinks + RESULT_VARIABLE res + ERROR_VARIABLE err + ERROR_STRIP_TRAILING_WHITESPACE) + if (res) + message(FATAL_ERROR + "Failed to fix remove read-only flags in ${qt_file}: ${err}") + endif () +endif () + +# Move to a predictable prefix. +file(RENAME + ".gitlab/${qt_subdir}" + ".gitlab/qt") diff --git a/.gitlab/ci/download_qt_hashes.cmake b/.gitlab/ci/download_qt_hashes.cmake new file mode 100644 index 0000000..59cb597 --- /dev/null +++ b/.gitlab/ci/download_qt_hashes.cmake @@ -0,0 +1,11 @@ +# Lines can be generated by doing: +# +# sha256sum $files | awk '{ print "set(\"" $2 "_hash\" " $1 ")" }' >> $thisfile + +set("5.15.0-0-202002260536qtbase-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z_hash" c041596be8f7a16c7be9ea6757c14766ff3200ab6d56f7db8f865dbfe039fe20) +set("5.15.0-0-202002260536qtwinextras-Windows-Windows_10-MSVC2017-Windows-Windows_10-X86_64.7z_hash" 10796128fac54f146767e33f6872975ba238858547de7a9650ec4cd9581fe71a) + +set("5.15.0-0-202005150700qtbase-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 0c2653c5eca256f59c0b48b537cd633b05560e4241c0226856d2ae22ab066df4) +set("5.15.0-0-202005150700qtwinextras-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 4bca3a8d8c7611e211a82d86b3396f8a622abe7859d5052452414642ec191844) + +set("5.15.0-0-202005140805qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 04d867c81d2431f288c42c9752642759460b9468477de349368dcc8de0c8ddc4) diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 40cc89c..541d3e9 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -217,14 +217,27 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) QSet<QCMakeProperty> newProps2; if (this->ShowNewProperties) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) newProps = props.toSet(); +#else + newProps = QSet(props.begin(), props.end()); +#endif newProps2 = newProps; +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QSet<QCMakeProperty> oldProps = this->properties().toSet(); +#else + QSet<QCMakeProperty> oldProps = + QSet(this->properties().begin(), this->properties().end()); +#endif oldProps.intersect(newProps); newProps.subtract(oldProps); newProps2.subtract(newProps); } else { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) newProps2 = props.toSet(); +#else + newProps2 = QSet(props.begin(), props.end()); +#endif } bool b = this->blockSignals(true); @@ -233,8 +246,8 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) this->NewPropertyCount = newProps.size(); if (View == FlatView) { - QCMakePropertyList newP = newProps.toList(); - QCMakePropertyList newP2 = newProps2.toList(); + QCMakePropertyList newP = newProps.values(); + QCMakePropertyList newP2 = newProps2.values(); #if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) std::sort(newP.begin(), newP.end()); std::sort(newP2.begin(), newP2.end()); |