diff --git a/docs/README.md b/docs/README.md index 07d995bc..2a1ee290 100644 --- a/docs/README.md +++ b/docs/README.md @@ -417,7 +417,7 @@ Call this function from the WORKSPACE file to initialize rules_foreign_cc de | :------------- | :------------- | :------------- | | native_tools_toolchains | pass the toolchains for toolchain types '@rules_foreign_cc//toolchains:cmake_toolchain' and '@rules_foreign_cc//toolchains:ninja_toolchain' with the needed platform constraints. If you do not pass anything, registered default toolchains will be selected (see below). | [] | | register_default_tools | If True, the cmake and ninja toolchains, calling corresponding preinstalled binaries by name (cmake, ninja) will be registered after 'native_tools_toolchains' without any platform constraints. The default is True. | True | -| cmake_version | The target version of the cmake toolchain if register_default_tools or register_built_tools is set to True. | "3.20.1" | +| cmake_version | The target version of the cmake toolchain if register_default_tools or register_built_tools is set to True. | "3.20.2" | | make_version | The target version of the default make toolchain if register_built_tools is set to True. | "4.3" | | ninja_version | The target version of the ninja toolchain if register_default_tools or register_built_tools is set to True. | "1.10.2" | | register_preinstalled_tools | If true, toolchains will be registered for the native built tools installed on the exec host | True | diff --git a/foreign_cc/repositories.bzl b/foreign_cc/repositories.bzl index 53ff080d..cbab18ca 100644 --- a/foreign_cc/repositories.bzl +++ b/foreign_cc/repositories.bzl @@ -9,7 +9,7 @@ load("//toolchains:toolchains.bzl", "built_toolchains", "prebuilt_toolchains", " def rules_foreign_cc_dependencies( native_tools_toolchains = [], register_default_tools = True, - cmake_version = "3.20.1", + cmake_version = "3.20.2", 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 4c255d22..85520bac 100644 --- a/toolchains/built_toolchains.bzl +++ b/toolchains/built_toolchains.bzl @@ -25,6 +25,19 @@ def _cmake_toolchain(version): native.register_toolchains( "@rules_foreign_cc//toolchains:built_cmake_toolchain", ) + if "3.20.2" == version: + maybe( + http_archive, + name = "cmake_src", + build_file_content = _ALL_CONTENT, + sha256 = "aecf6ecb975179eb3bb6a4a50cae192d41e92b9372b02300f9e8f1d5f559544e", + strip_prefix = "cmake-3.20.2", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz", + ], + ) + return + if "3.20.1" == version: maybe( http_archive, diff --git a/toolchains/prebuilt_toolchains.bzl b/toolchains/prebuilt_toolchains.bzl index 28817ea3..a2831f01 100644 --- a/toolchains/prebuilt_toolchains.bzl +++ b/toolchains/prebuilt_toolchains.bzl @@ -65,6 +65,110 @@ def prebuilt_toolchains(cmake_version, ninja_version): _make_toolchains() def _cmake_toolchains(version): + if "3.20.2" == version: + maybe( + http_archive, + name = "cmake-3.20.2-linux-aarch64", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-linux-aarch64.tar.gz", + ], + sha256 = "688a3ece018384966fed99a706bc8fbbbc50220393dce1531af36e640c46f601", + strip_prefix = "cmake-3.20.2-linux-aarch64", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + maybe( + http_archive, + name = "cmake-3.20.2-linux-x86_64", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-linux-x86_64.tar.gz", + ], + sha256 = "3f827544f9c82e74ddf5016461fdfcfea4ede58a26f82612f473bf6bfad8bfc2", + strip_prefix = "cmake-3.20.2-linux-x86_64", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + maybe( + http_archive, + name = "cmake-3.20.2-macos-universal", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-macos-universal.tar.gz", + ], + sha256 = "0100663380a3bd977b001183cd487412db7aad9de6859927bde97e1e6e44e645", + strip_prefix = "cmake-3.20.2-macos-universal/CMake.app/Contents", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake", + ), + ) + + maybe( + http_archive, + name = "cmake-3.20.2-windows-i386", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-windows-i386.zip", + ], + sha256 = "8ad1f1f9a1a0a0dc82107eb9a4351d91d4e72504b0343368f1569b72a5e48bc1", + strip_prefix = "cmake-3.20.2-windows-i386", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake.exe", + ), + ) + + maybe( + http_archive, + name = "cmake-3.20.2-windows-x86_64", + urls = [ + "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-windows-x86_64.zip", + ], + sha256 = "15a49e2ab81c1822d75b1b1a92f7863f58e31f6d6aac1c4103eef2b071be3112", + strip_prefix = "cmake-3.20.2-windows-x86_64", + build_file_content = _CMAKE_BUILD_FILE.format( + bin = "cmake.exe", + ), + ) + + # buildifier: leave-alone + maybe( + prebuilt_toolchains_repository, + name = "cmake_3.20.2_toolchains", + repos = { + "cmake-3.20.2-linux-aarch64": [ + "@platforms//cpu:aarch64", + "@platforms//os:linux", + ], + "cmake-3.20.2-linux-x86_64": [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ], + "cmake-3.20.2-macos-universal": [ + "@platforms//os:macos", + ], + "cmake-3.20.2-windows-i386": [ + "@platforms//cpu:x86_32", + "@platforms//os:windows", + ], + "cmake-3.20.2-windows-x86_64": [ + "@platforms//cpu:x86_64", + "@platforms//os:windows", + ], + }, + tool = "cmake", + ) + + native.register_toolchains( + "@cmake_3.20.2_toolchains//:cmake-3.20.2-linux-aarch64_toolchain", + "@cmake_3.20.2_toolchains//:cmake-3.20.2-linux-x86_64_toolchain", + "@cmake_3.20.2_toolchains//:cmake-3.20.2-macos-universal_toolchain", + "@cmake_3.20.2_toolchains//:cmake-3.20.2-windows-i386_toolchain", + "@cmake_3.20.2_toolchains//:cmake-3.20.2-windows-x86_64_toolchain", + ) + + return + if "3.20.1" == version: maybe( http_archive, diff --git a/toolchains/prebuilt_toolchains.py b/toolchains/prebuilt_toolchains.py index 2ade40ee..85789994 100755 --- a/toolchains/prebuilt_toolchains.py +++ b/toolchains/prebuilt_toolchains.py @@ -11,6 +11,7 @@ CMAKE_SHA256_URL_TEMPLATE = "https://cmake.org/files/v{minor}/cmake-{full}-SHA-2 CMAKE_URL_TEMPLATE = "https://github.com/Kitware/CMake/releases/download/v{full}/{file}" CMAKE_VERSIONS = [ + "3.20.2", "3.20.1", "3.20.0", "3.19.8",