diff --git a/foreign_cc/built_tools/cmake_build.bzl b/foreign_cc/built_tools/cmake_build.bzl index 8a9dc1420..50225043a 100644 --- a/foreign_cc/built_tools/cmake_build.bzl +++ b/foreign_cc/built_tools/cmake_build.bzl @@ -6,7 +6,7 @@ def cmake_tool(name, srcs, **kwargs): tags = ["manual"] + kwargs.pop("tags", []) configure_make( - name = "_build_{}".format(name), + name = "{}.build".format(name), configure_command = "bootstrap", configure_options = ["--", "-DCMAKE_MAKE_PROGRAM=$$MAKE$$"], # On macOS at least -DDEBUG gets set for a fastbuild @@ -24,7 +24,7 @@ def cmake_tool(name, srcs, **kwargs): native.filegroup( name = name, - srcs = ["_build_{}".format(name)], + srcs = ["{}.build".format(name)], output_group = "gen_dir", tags = tags, ) diff --git a/toolchains/BUILD.bazel b/toolchains/BUILD.bazel index bc7b9babd..6867ce903 100644 --- a/toolchains/BUILD.bazel +++ b/toolchains/BUILD.bazel @@ -2,6 +2,7 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") load("//foreign_cc/built_tools:cmake_build.bzl", "cmake_tool") load("//foreign_cc/built_tools:make_build.bzl", "make_tool") load("//foreign_cc/built_tools:ninja_build.bzl", "ninja_tool") +load("//toolchains:toolchains.bzl", "current_autoconf_toolchain", "current_automake_toolchain", "current_cmake_toolchain", "current_m4_toolchain", "current_make_toolchain", "current_ninja_toolchain", "current_pkgconfig_toolchain") load("//toolchains/native_tools:native_tools_toolchain.bzl", "native_tool_toolchain") package(default_visibility = ["//visibility:public"]) @@ -34,6 +35,34 @@ toolchain_type( name = "automake_toolchain", ) +current_cmake_toolchain( + name = "current_cmake_toolchain", +) + +current_ninja_toolchain( + name = "current_ninja_toolchain", +) + +current_m4_toolchain( + name = "current_m4_toolchain", +) + +current_pkgconfig_toolchain( + name = "current_pkgconfig_toolchain", +) + +current_make_toolchain( + name = "current_make_toolchain", +) + +current_automake_toolchain( + name = "current_automake_toolchain", +) + +current_autoconf_toolchain( + name = "current_autoconf_toolchain", +) + toolchain( name = "built_cmake_toolchain", toolchain = ":built_cmake", @@ -106,6 +135,10 @@ make_tool( native_tool_toolchain( name = "built_make", + env = select({ + "@platforms//os:windows": {"MAKE": "$(execpath :make_tool)/bin/make.exe"}, + "//conditions:default": {"MAKE": "$(execpath :make_tool)/bin/make"}, + }), path = select({ "@platforms//os:windows": "$(execpath :make_tool)/bin/make.exe", "//conditions:default": "$(execpath :make_tool)/bin/make", @@ -138,6 +171,10 @@ native_tool_toolchain( native_tool_toolchain( name = "preinstalled_ninja", + env = select({ + "@platforms//os:windows": {"NINJA": "ninja.exe"}, + "//conditions:default": {"NINJA": "ninja"}, + }), path = select({ "@platforms//os:windows": "ninja.exe", "//conditions:default": "ninja", @@ -152,6 +189,10 @@ ninja_tool( native_tool_toolchain( name = "built_ninja", + env = select({ + "@platforms//os:windows": {"NINJA": "$(execpath :ninja_tool)/bin/ninja.exe"}, + "//conditions:default": {"NINJA": "$(execpath :ninja_tool)/bin/ninja"}, + }), path = select({ "@platforms//os:windows": "$(execpath :ninja_tool)/bin/ninja.exe", "//conditions:default": "$(execpath :ninja_tool)/bin/ninja", diff --git a/toolchains/native_tools/native_tools_toolchain.bzl b/toolchains/native_tools/native_tools_toolchain.bzl index 2cf4b31e0..36a4e5af2 100644 --- a/toolchains/native_tools/native_tools_toolchain.bzl +++ b/toolchains/native_tools/native_tools_toolchain.bzl @@ -1,7 +1,13 @@ +"""Rules for building native build tools such as ninja, make or cmake""" + +# buildifier: disable=bzl-visibility +load("//foreign_cc/private:framework.bzl", "expand_locations_and_make_variables") + # buildifier: disable=module-docstring ToolInfo = provider( doc = "Information about the native tool", fields = { + "env": "Environment variables to set when using this tool e.g. M4", "path": ( "Absolute path to the tool in case the tool is preinstalled on the machine. " + "Relative path to the tool in case the tool is built as part of a build; the path should be relative " + @@ -22,9 +28,12 @@ def _native_tool_toolchain_impl(ctx): path = None if ctx.attr.target: path = ctx.expand_location(ctx.attr.path, targets = [ctx.attr.target]) + env = expand_locations_and_make_variables(ctx, ctx.attr.env, "env", [ctx.attr.target]) else: path = ctx.expand_location(ctx.attr.path) + env = expand_locations_and_make_variables(ctx, ctx.attr.env, "env", []) return platform_common.ToolchainInfo(data = ToolInfo( + env = env, path = path, target = ctx.attr.target, )) @@ -38,6 +47,9 @@ native_tool_toolchain = rule( ), implementation = _native_tool_toolchain_impl, attrs = { + "env": attr.string_dict( + doc = "Environment variables to be set when using this tool e.g. M4", + ), "path": attr.string( mandatory = False, doc = ( diff --git a/toolchains/native_tools/tool_access.bzl b/toolchains/native_tools/tool_access.bzl index 5dc5404b6..193f07c12 100644 --- a/toolchains/native_tools/tool_access.bzl +++ b/toolchains/native_tools/tool_access.bzl @@ -2,15 +2,12 @@ rules_foreign_cc toolchains """ -load(":native_tools_toolchain.bzl", "ToolInfo") - -def access_tool(toolchain_type_, ctx, tool_name): +def access_tool(toolchain_type_, ctx): """A helper macro for getting the path to a build tool's executable Args: toolchain_type_ (str): The name of the toolchain type ctx (ctx): The rule's context object - tool_name (str): The name of the tool to query Returns: ToolInfo: A provider containing information about the toolchain's executable @@ -18,34 +15,31 @@ def access_tool(toolchain_type_, ctx, tool_name): tool_toolchain = ctx.toolchains[toolchain_type_] if tool_toolchain: return tool_toolchain.data - return ToolInfo( - path = tool_name, - target = None, - ) + fail("No toolchain found for " + toolchain_type_) def get_autoconf_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:autoconf_toolchain")), ctx, "autoconf") + return _access_and_expect_label_copied(str(Label("//toolchains:autoconf_toolchain")), ctx) def get_automake_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:automake_toolchain")), ctx, "automake") + return _access_and_expect_label_copied(str(Label("//toolchains:automake_toolchain")), ctx) def get_cmake_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:cmake_toolchain")), ctx, "cmake") + return _access_and_expect_label_copied(str(Label("//toolchains:cmake_toolchain")), ctx) def get_m4_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:m4_toolchain")), ctx, "m4") + return _access_and_expect_label_copied(str(Label("//toolchains:m4_toolchain")), ctx) def get_make_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:make_toolchain")), ctx, "make") + return _access_and_expect_label_copied(str(Label("//toolchains:make_toolchain")), ctx) def get_ninja_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:ninja_toolchain")), ctx, "ninja") + return _access_and_expect_label_copied(str(Label("//toolchains:ninja_toolchain")), ctx) def get_pkgconfig_data(ctx): - return _access_and_expect_label_copied(str(Label("//toolchains:pkgconfig_toolchain")), ctx, "pkg-config") + return _access_and_expect_label_copied(str(Label("//toolchains:pkgconfig_toolchain")), ctx) -def _access_and_expect_label_copied(toolchain_type_, ctx, tool_name): - tool_data = access_tool(toolchain_type_, ctx, tool_name) +def _access_and_expect_label_copied(toolchain_type_, ctx): + tool_data = access_tool(toolchain_type_, ctx) if tool_data.target: # This could be made more efficient by changing the # toolchain to provide the executable as a target @@ -56,11 +50,13 @@ def _access_and_expect_label_copied(toolchain_type_, ctx, tool_name): break return struct( deps = [tool_data.target], + env = tool_data.env, # as the tool will be copied into tools directory path = "$EXT_BUILD_ROOT/{}".format(cmd_file.path), ) else: return struct( deps = [], + env = tool_data.env, path = tool_data.path, ) diff --git a/toolchains/prebuilt_toolchains.bzl b/toolchains/prebuilt_toolchains.bzl index 04069d04e..b03d3682f 100644 --- a/toolchains/prebuilt_toolchains.bzl +++ b/toolchains/prebuilt_toolchains.bzl @@ -47,6 +47,7 @@ filegroup( native_tool_toolchain( name = "ninja_tool", + env = {env}, path = "$(execpath :ninja_bin)", target = ":ninja_bin", ) @@ -287,6 +288,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.22.0-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -300,6 +302,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.22.0-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -313,6 +316,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.22.0-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -326,6 +330,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.22.0-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -339,6 +344,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.22.0-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -497,6 +503,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.4-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -510,6 +517,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.4-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -523,6 +531,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.4-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -536,6 +545,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.4-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -549,6 +559,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.4-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -602,6 +613,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.3-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -615,6 +627,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.3-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -628,6 +641,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.3-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -641,6 +655,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.3-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -654,6 +669,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.3-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -707,6 +723,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.2-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -720,6 +737,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.2-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -733,6 +751,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.2-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -746,6 +765,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.2-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -759,6 +779,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.2-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -812,6 +833,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.1-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -825,6 +847,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.1-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -838,6 +861,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.1-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -851,6 +875,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.1-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -864,6 +889,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.1-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -917,6 +943,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.0-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -930,6 +957,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.0-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -943,6 +971,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.0-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -956,6 +985,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.0-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -969,6 +999,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.21.0-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1022,6 +1053,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.5-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1035,6 +1067,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.5-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1048,6 +1081,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.5-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1061,6 +1095,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.5-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1074,6 +1109,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.5-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1127,6 +1163,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.4-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1140,6 +1177,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.4-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1153,6 +1191,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.4-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1166,6 +1205,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.4-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1179,6 +1219,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.4-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1232,6 +1273,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.3-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1245,6 +1287,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.3-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1258,6 +1301,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.3-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1271,6 +1315,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.3-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1284,6 +1329,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.3-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1337,6 +1383,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.2-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1350,6 +1397,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.2-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1363,6 +1411,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.2-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1376,6 +1425,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.2-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1389,6 +1439,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.2-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1442,6 +1493,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.1-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1455,6 +1507,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.1-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1468,6 +1521,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.1-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1481,6 +1535,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.1-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1494,6 +1549,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.1-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1547,6 +1603,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.0-linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1560,6 +1617,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.0-linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1573,6 +1631,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.0-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1586,6 +1645,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.0-windows-i386", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1599,6 +1659,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.20.0-windows-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1652,6 +1713,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.8-Linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1665,6 +1727,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.8-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1678,6 +1741,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.8-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1691,6 +1755,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.8-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1704,6 +1769,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.8-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1757,6 +1823,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.7-Linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1770,6 +1837,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.7-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1783,6 +1851,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.7-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1796,6 +1865,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.7-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1809,6 +1879,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.7-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1862,6 +1933,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.6-Linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1875,6 +1947,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.6-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1888,6 +1961,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.6-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1901,6 +1975,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.6-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1914,6 +1989,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.6-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -1967,6 +2043,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.5-Linux-aarch64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1980,6 +2057,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.5-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -1993,6 +2071,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.5-macos-universal/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2006,6 +2085,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.5-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2019,6 +2099,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.19.5-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2072,6 +2153,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.18.6-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2085,6 +2167,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.18.6-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2098,6 +2181,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.18.6-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2111,6 +2195,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.18.6-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2160,6 +2245,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.17.5-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2173,6 +2259,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.17.5-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2186,6 +2273,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.17.5-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2199,6 +2287,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.17.5-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2248,6 +2337,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.16.9-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2261,6 +2351,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.16.9-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2274,6 +2365,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.16.9-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2287,6 +2379,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.16.9-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2336,6 +2429,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.15.7-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2349,6 +2443,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.15.7-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2362,6 +2457,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.15.7-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2375,6 +2471,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.15.7-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2424,6 +2521,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.14.7-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2437,6 +2535,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.14.7-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2450,6 +2549,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.14.7-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2463,6 +2563,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.14.7-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2512,6 +2613,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.13.5-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2525,6 +2627,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.13.5-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2538,6 +2641,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.13.5-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2551,6 +2655,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.13.5-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2600,6 +2705,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.12.4-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2613,6 +2719,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.12.4-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2626,6 +2733,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.12.4-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2639,6 +2747,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.12.4-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2688,6 +2797,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.11.4-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2701,6 +2811,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.11.4-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2714,6 +2825,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.11.4-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2727,6 +2839,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.11.4-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2776,6 +2889,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.10.3-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2789,6 +2903,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.10.3-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2802,6 +2917,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.10.3-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2815,6 +2931,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.10.3-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2864,6 +2981,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.9.6-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2877,6 +2995,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.9.6-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2890,6 +3009,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.9.6-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2903,6 +3023,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.9.6-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2952,6 +3073,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.8.2-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2965,6 +3087,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.8.2-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -2978,6 +3101,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.8.2-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -2991,6 +3115,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.8.2-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3040,6 +3165,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.7.2-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3053,6 +3179,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.7.2-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3066,6 +3193,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.7.2-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3079,6 +3207,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.7.2-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3128,6 +3257,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.6.3-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3141,6 +3271,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.6.3-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3154,6 +3285,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.6.3-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3167,6 +3299,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.6.3-win64-x64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3216,6 +3349,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.5.2-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3229,6 +3363,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.5.2-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3242,6 +3377,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.5.2-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3286,6 +3422,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.4.3-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3299,6 +3436,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.4.3-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3312,6 +3450,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.4.3-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3356,6 +3495,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.3.2-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3369,6 +3509,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.3.2-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3382,6 +3523,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.3.2-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3426,6 +3568,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.2.3-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3439,6 +3582,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.2.3-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3452,6 +3596,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.2.3-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3496,6 +3641,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.1.3-Darwin-x86_64/CMake.app/Contents", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3509,6 +3655,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.1.3-Linux-x86_64", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake", + env = "{}", ), ) @@ -3522,6 +3669,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.1.3-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3566,6 +3714,7 @@ def _cmake_toolchains(version, register_toolchains): strip_prefix = "cmake-3.0.2-win32-x86", build_file_content = _CMAKE_BUILD_FILE.format( bin = "cmake.exe", + env = "{}", ), ) @@ -3603,6 +3752,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3616,6 +3766,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3629,6 +3780,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja.exe", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3673,6 +3825,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3686,6 +3839,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3699,6 +3853,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja.exe", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3743,6 +3898,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3756,6 +3912,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3769,6 +3926,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja.exe", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3813,6 +3971,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3826,6 +3985,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3839,6 +3999,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja.exe", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3883,6 +4044,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3896,6 +4058,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) @@ -3909,6 +4072,7 @@ def _ninja_toolchains(version, register_toolchains): strip_prefix = "", build_file_content = _NINJA_BUILD_FILE.format( bin = "ninja.exe", + env = "{\"NINJA\": \"$(execpath :ninja_bin)\"}", ), ) diff --git a/toolchains/prebuilt_toolchains.py b/toolchains/prebuilt_toolchains.py index 0f959a778..05de528a0 100755 --- a/toolchains/prebuilt_toolchains.py +++ b/toolchains/prebuilt_toolchains.py @@ -129,6 +129,7 @@ strip_prefix = "{prefix}", build_file_content = {template}.format( bin = "{bin}", + env = "{env}", ), ) """ @@ -200,6 +201,7 @@ native_tool_toolchain( name = "ninja_tool", + env = {{env}}, path = "$(execpath :ninja_bin)", target = ":ninja_bin", ) @@ -283,6 +285,7 @@ def get_cmake_definitions() -> str: build="cmake", template="_CMAKE_BUILD_FILE", bin=bin, + env="{}", ) ) version_toolchains.update({plat_target: name}) @@ -368,6 +371,7 @@ def get_ninja_definitions() -> str: build="ninja", template="_NINJA_BUILD_FILE", bin="ninja.exe" if "win" in target else "ninja", + env="{\\\"NINJA\\\": \\\"$(execpath :ninja_bin)\\\"}", ) ) version_toolchains.update({target: name}) diff --git a/toolchains/toolchains.bzl b/toolchains/toolchains.bzl index b561682fa..1d0b0d16e 100644 --- a/toolchains/toolchains.bzl +++ b/toolchains/toolchains.bzl @@ -17,3 +17,103 @@ def preinstalled_toolchains(): str(Label("//toolchains:preinstalled_make_toolchain")), str(Label("//toolchains:preinstalled_ninja_toolchain")), ) + +def _current_toolchain_impl(ctx): + toolchain = ctx.toolchains[ctx.attr._toolchain] + + if toolchain.data.target: + return [ + toolchain, + platform_common.TemplateVariableInfo(toolchain.data.env), + DefaultInfo( + runfiles = toolchain.data.target.default_runfiles, + ), + ] + return [ + toolchain, + platform_common.TemplateVariableInfo(toolchain.data.env), + DefaultInfo(), + ] + +# These rules exist so that the current toolchain can be used in the `toolchains` attribute of +# other rules, such as genrule. It allows exposing a _toolchain after toolchain resolution has +# happened, to a rule which expects a concrete implementation of a toolchain, rather than a +# toochain_type which could be resolved to that toolchain. +# +# See https://github.com/bazelbuild/bazel/issues/14009#issuecomment-921960766 +current_cmake_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:cmake_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:cmake_toolchain")), + ], +) + +current_make_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:make_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:make_toolchain")), + ], +) + +current_ninja_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:ninja_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:ninja_toolchain")), + ], +) + +current_autoconf_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:autoconf_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:autoconf_toolchain")), + ], +) + +current_automake_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:automake_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:automake_toolchain")), + ], +) + +current_m4_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:m4_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:m4_toolchain")), + ], +) + +current_pkgconfig_toolchain = rule( + implementation = _current_toolchain_impl, + attrs = { + "_toolchain": attr.string(default = str(Label("//toolchains:pkgconfig_toolchain"))), + }, + incompatible_use_toolchain_transition = True, + toolchains = [ + str(Label("//toolchains:pkgconfig_toolchain")), + ], +)