Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake 3.21.3, 3.21.4 and 3.22.0 support #815

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Call this function from the WORKSPACE file to initialize rules_foreign_cc de
| :------------- | :------------- | :------------- |
| <a id="rules_foreign_cc_dependencies-native_tools_toolchains"></a>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). | <code>[]</code> |
| <a id="rules_foreign_cc_dependencies-register_default_tools"></a>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. | <code>True</code> |
| <a id="rules_foreign_cc_dependencies-cmake_version"></a>cmake_version | The target version of the cmake toolchain if <code>register_default_tools</code> or <code>register_built_tools</code> is set to <code>True</code>. | <code>"3.21.2"</code> |
| <a id="rules_foreign_cc_dependencies-cmake_version"></a>cmake_version | The target version of the cmake toolchain if <code>register_default_tools</code> or <code>register_built_tools</code> is set to <code>True</code>. | <code>"3.22.0"</code> |
| <a id="rules_foreign_cc_dependencies-make_version"></a>make_version | The target version of the default make toolchain if <code>register_built_tools</code> is set to <code>True</code>. | <code>"4.3"</code> |
| <a id="rules_foreign_cc_dependencies-ninja_version"></a>ninja_version | The target version of the ninja toolchain if <code>register_default_tools</code> or <code>register_built_tools</code> is set to <code>True</code>. | <code>"1.10.2"</code> |
| <a id="rules_foreign_cc_dependencies-register_preinstalled_tools"></a>register_preinstalled_tools | If true, toolchains will be registered for the native built tools installed on the exec host | <code>True</code> |
Expand Down
2 changes: 1 addition & 1 deletion foreign_cc/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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.21.2",
cmake_version = "3.22.0",
make_version = "4.3",
ninja_version = "1.10.2",
register_preinstalled_tools = True,
Expand Down
48 changes: 17 additions & 31 deletions toolchains/built_toolchains.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ filegroup(
)
"""

_CMAKE_SRCS = {
"3.21.0": [["https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0.tar.gz"], "cmake-3.21.0", "4a42d56449a51f4d3809ab4d3b61fd4a96a469e56266e896ce1009b5768bd2ab"],
"3.21.1": [["https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1.tar.gz"], "cmake-3.21.1", "fac3915171d4dff25913975d712f76e69aef44bf738ba7b976793a458b4cfed4"],
"3.21.2": [["https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2.tar.gz"], "cmake-3.21.2", "94275e0b61c84bb42710f5320a23c6dcb2c6ee032ae7d2a616f53f68b3d21659"],
"3.21.3": [["https://github.com/Kitware/CMake/releases/download/v3.21.3/cmake-3.21.3.tar.gz"], "cmake-3.21.3", "d14d06df4265134ee42c4d50f5a60cb8b471b7b6a47da8e5d914d49dd783794f"],
"3.21.4": [["https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4.tar.gz"], "cmake-3.21.4", "d9570a95c215f4c9886dd0f0564ca4ef8d18c30750f157238ea12669c2985978"],
"3.22.0": [["https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0.tar.gz"], "cmake-3.22.0", "998c7ba34778d2dfdb3df8a695469e24b11e2bfa21fbe41b361a3f45e1c9345e"],
}

# buildifier: disable=unnamed-macro
def built_toolchains(cmake_version, make_version, ninja_version):
"""Register toolchains for built tools that will be built from source"""
Expand All @@ -25,42 +34,19 @@ def _cmake_toolchain(version):
native.register_toolchains(
"@rules_foreign_cc//toolchains:built_cmake_toolchain",
)
if "3.21.2" == version:
maybe(
http_archive,
name = "cmake_src",
build_file_content = _ALL_CONTENT,
sha256 = "94275e0b61c84bb42710f5320a23c6dcb2c6ee032ae7d2a616f53f68b3d21659",
strip_prefix = "cmake-3.21.2",
urls = [
"https://github.com/Kitware/CMake/releases/download/v3.21.2/cmake-3.21.2.tar.gz",
],
)
return

if "3.21.1" == version:
maybe(
http_archive,
name = "cmake_src",
build_file_content = _ALL_CONTENT,
sha256 = "fac3915171d4dff25913975d712f76e69aef44bf738ba7b976793a458b4cfed4",
strip_prefix = "cmake-3.21.1",
urls = [
"https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1.tar.gz",
],
)
return

if "3.21.0" == version:
if _CMAKE_SRCS.get(version):
cmake_meta = _CMAKE_SRCS[version]
urls = cmake_meta[0]
prefix = cmake_meta[1]
sha256 = cmake_meta[2]
maybe(
http_archive,
name = "cmake_src",
build_file_content = _ALL_CONTENT,
sha256 = "4a42d56449a51f4d3809ab4d3b61fd4a96a469e56266e896ce1009b5768bd2ab",
strip_prefix = "cmake-3.21.0",
urls = [
"https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0.tar.gz",
],
sha256 = sha256,
strip_prefix = prefix,
urls = urls,
)
return

Expand Down
Loading