From 37e6ae4fc005d11146f67828f42c667c29f27dd2 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Sun, 28 Mar 2021 22:53:54 +0100 Subject: [PATCH] Add CMake 3.20.0 and 3.19.7 --- foreign_cc/repositories.bzl | 2 +- toolchains/built_toolchains.bzl | 28 +++- toolchains/prebuilt_toolchains.bzl | 250 ++++++++++++++++++++++------- toolchains/prebuilt_toolchains.py | 4 +- 4 files changed, 224 insertions(+), 60 deletions(-) diff --git a/foreign_cc/repositories.bzl b/foreign_cc/repositories.bzl index 86163d3f1..d274b6ab5 100644 --- a/foreign_cc/repositories.bzl +++ b/foreign_cc/repositories.bzl @@ -12,7 +12,7 @@ load("//toolchains:toolchains.bzl", "built_toolchains", "prebuilt_toolchains", " def rules_foreign_cc_dependencies( native_tools_toolchains = [], register_default_tools = True, - cmake_version = "3.19.6", + cmake_version = "3.20.0", make_version = "4.3", ninja_version = "1.10.2", register_preinstalled_tools = True, diff --git a/toolchains/built_toolchains.bzl b/toolchains/built_toolchains.bzl index 1a571e383..255998ec5 100644 --- a/toolchains/built_toolchains.bzl +++ b/toolchains/built_toolchains.bzl @@ -25,7 +25,33 @@ def _cmake_toolchain(version): native.register_toolchains( "@rules_foreign_cc//toolchains:built_cmake_toolchain", ) - if version == "3.19.6": + if "3.20.0" == version: + maybe( + http_archive, + name = "cmake_src", + build_file_content = _ALL_CONTENT, + sha256 = "9c06b2ddf7c337e31d8201f6ebcd3bba86a9a033976a9aee207fe0c6971f4755", + strip_prefix = "cmake-3.20.0", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0.tar.gz", + ], + ) + return + + if "3.19.7" == version: + maybe( + http_archive, + name = "cmake_src", + build_file_content = _ALL_CONTENT, + sha256 = "ec87ab67c45f47c4285f204280c5cde48e1c920cfcfed1555b27fb3b1a1d20ba", + strip_prefix = "cmake-3.19.7", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7.tar.gz", + ], + ) + return + + if "3.19.6" == version: maybe( http_archive, name = "cmake_src", diff --git a/toolchains/prebuilt_toolchains.bzl b/toolchains/prebuilt_toolchains.bzl index 2e94d6862..896cc13c9 100644 --- a/toolchains/prebuilt_toolchains.bzl +++ b/toolchains/prebuilt_toolchains.bzl @@ -65,6 +65,142 @@ def prebuilt_toolchains(cmake_version, ninja_version): _make_toolchains() def _cmake_toolchains(version): + if "3.20.0" == version: + maybe( + http_archive, + name = "cmake-3.20.0-macos-universal", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-macos-universal.tar.gz", + ], + sha256 = "bca9645a17f528ffc267ac05033e25a1223dccb912d1f4bc5afcbeebad111662", + strip_prefix = "cmake-3.20.0-macos-universal/CMake.app/Contents", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + # buildifier: leave-alone + maybe( + prebuilt_toolchains_repository, + name = "cmake_3.20.0_toolchains", + repos = { + "cmake-3.20.0-macos-universal": [ + "@platforms//os:macos" + ] + }, + tool = "cmake", + ) + + native.register_toolchains( + "@cmake_3.20.0_toolchains//:cmake-3.20.0-macos-universal_toolchain", + ) + + return + + if "3.19.7" == version: + maybe( + http_archive, + name = "cmake-3.19.7-Linux-aarch64", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-Linux-aarch64.tar.gz", + ], + sha256 = "eb1cf718eca1d5bc212a0ef76d19a977b6b6481a795985b8741c31f866c88e09", + strip_prefix = "cmake-3.19.7-Linux-aarch64", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + maybe( + http_archive, + name = "cmake-3.19.7-Linux-x86_64", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-Linux-x86_64.tar.gz", + ], + sha256 = "ba4a5f46aab500e0d8d952ee735dcfb0c870d326e851addc037c99eb1ea4b66c", + strip_prefix = "cmake-3.19.7-Linux-x86_64", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + maybe( + http_archive, + name = "cmake-3.19.7-macos-universal", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-macos-universal.tar.gz", + ], + sha256 = "52036f8450fabb69bedc3c3eccc58202ae9eefe8358fa383978c7b142f931fa5", + strip_prefix = "cmake-3.19.7-macos-universal/CMake.app/Contents", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + maybe( + http_archive, + name = "cmake-3.19.7-win32-x86", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-win32-x86.zip", + ], + sha256 = "7771205d94022787bc4c3a623629d236b10bf697315e9f92c214dd8b53e8746e", + strip_prefix = "cmake-3.19.7-win32-x86", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake.exe", + ), + ) + + maybe( + http_archive, + name = "cmake-3.19.7-win64-x64", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.19.7/cmake-3.19.7-win64-x64.zip", + ], + sha256 = "e6788d6e23b3026c37fcfa7658075d6b5f9113f26fae17fe372ad4a7ee62d5fd", + strip_prefix = "cmake-3.19.7-win64-x64", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake.exe", + ), + ) + + # buildifier: leave-alone + maybe( + prebuilt_toolchains_repository, + name = "cmake_3.19.7_toolchains", + repos = { + "cmake-3.19.7-Linux-aarch64": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux" + ], + "cmake-3.19.7-Linux-x86_64": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux" + ], + "cmake-3.19.7-macos-universal": [ + "@platforms//os:macos" + ], + "cmake-3.19.7-win32-x86": [ + "@platforms//cpu:x86_32", + "@platforms//os:windows" + ], + "cmake-3.19.7-win64-x64": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows" + ] + }, + tool = "cmake", + ) + + native.register_toolchains( + "@cmake_3.19.7_toolchains//:cmake-3.19.7-Linux-aarch64_toolchain", + "@cmake_3.19.7_toolchains//:cmake-3.19.7-Linux-x86_64_toolchain", + "@cmake_3.19.7_toolchains//:cmake-3.19.7-macos-universal_toolchain", + "@cmake_3.19.7_toolchains//:cmake-3.19.7-win32-x86_toolchain", + "@cmake_3.19.7_toolchains//:cmake-3.19.7-win64-x64_toolchain", + ) + + return + if "3.19.6" == version: maybe( http_archive, @@ -138,23 +274,23 @@ def _cmake_toolchains(version): repos = { "cmake-3.19.6-Linux-aarch64": [ "@platforms//cpu:aarch64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.19.6-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.19.6-macos-universal": [ - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.19.6-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.19.6-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -242,23 +378,23 @@ def _cmake_toolchains(version): repos = { "cmake-3.19.5-Linux-aarch64": [ "@platforms//cpu:aarch64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.19.5-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.19.5-macos-universal": [ - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.19.5-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.19.5-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -333,20 +469,20 @@ def _cmake_toolchains(version): repos = { "cmake-3.18.6-Darwin-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.18.6-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.18.6-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.18.6-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -420,20 +556,20 @@ def _cmake_toolchains(version): repos = { "cmake-3.17.5-Darwin-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.17.5-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.17.5-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.17.5-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -507,20 +643,20 @@ def _cmake_toolchains(version): repos = { "cmake-3.16.9-Darwin-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.16.9-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.16.9-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.16.9-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -594,20 +730,20 @@ def _cmake_toolchains(version): repos = { "cmake-3.15.7-Darwin-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.15.7-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.15.7-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.15.7-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -681,20 +817,20 @@ def _cmake_toolchains(version): repos = { "cmake-3.14.7-Darwin-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "cmake-3.14.7-Linux-x86_64": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "cmake-3.14.7-win32-x86": [ "@platforms//cpu:x86_32", - "@platforms//os:windows", + "@platforms//os:windows" ], "cmake-3.14.7-win64-x64": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "cmake", ) @@ -758,16 +894,16 @@ def _ninja_toolchains(version): repos = { "ninja_1.10.2_linux": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "ninja_1.10.2_mac": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "ninja_1.10.2_win": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "ninja", ) @@ -827,16 +963,16 @@ def _ninja_toolchains(version): repos = { "ninja_1.10.1_linux": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "ninja_1.10.1_mac": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "ninja_1.10.1_win": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "ninja", ) @@ -896,16 +1032,16 @@ def _ninja_toolchains(version): repos = { "ninja_1.10.0_linux": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "ninja_1.10.0_mac": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "ninja_1.10.0_win": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "ninja", ) @@ -965,16 +1101,16 @@ def _ninja_toolchains(version): repos = { "ninja_1.9.0_linux": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "ninja_1.9.0_mac": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "ninja_1.9.0_win": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "ninja", ) @@ -1034,16 +1170,16 @@ def _ninja_toolchains(version): repos = { "ninja_1.8.2_linux": [ "@platforms//cpu:x86_64", - "@platforms//os:linux", + "@platforms//os:linux" ], "ninja_1.8.2_mac": [ "@platforms//cpu:x86_64", - "@platforms//os:macos", + "@platforms//os:macos" ], "ninja_1.8.2_win": [ "@platforms//cpu:x86_64", - "@platforms//os:windows", - ], + "@platforms//os:windows" + ] }, tool = "ninja", ) diff --git a/toolchains/prebuilt_toolchains.py b/toolchains/prebuilt_toolchains.py index 1a3fbd0e8..2d87bac99 100755 --- a/toolchains/prebuilt_toolchains.py +++ b/toolchains/prebuilt_toolchains.py @@ -11,6 +11,8 @@ CMAKE_URL_TEMPLATE = "https://github.com/Kitware/CMake/releases/download/v{full}/{file}" CMAKE_VERSIONS = [ + "3.20.0", + "3.19.7", "3.19.6", "3.19.5", "3.18.6", @@ -135,7 +137,7 @@ native_tool_toolchain( name = "cmake_tool", - path = "bin/{bin}", + path = "bin/{{bin}}", target = ":cmake_data", ) \"\"\"