2021-02-16 15:41:58 +00:00
|
|
|
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
2021-03-11 16:52:36 +00:00
|
|
|
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/native_tools:native_tools_toolchain.bzl", "native_tool_toolchain")
|
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain_type(
|
|
|
|
name = "make_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "built_cmake_toolchain",
|
|
|
|
toolchain = ":built_cmake",
|
|
|
|
toolchain_type = ":cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "built_ninja_toolchain",
|
|
|
|
toolchain = ":built_ninja",
|
|
|
|
toolchain_type = ":ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
toolchain(
|
|
|
|
name = "built_make_toolchain",
|
|
|
|
toolchain = ":built_make",
|
|
|
|
toolchain_type = ":make_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Preinstalled cmake will always be the default, if toolchain with more exact constraints
|
|
|
|
# is not defined before; registered from workspace_definitions.bzl#rules_foreign_cc_dependencies
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_cmake_toolchain",
|
|
|
|
toolchain = ":preinstalled_cmake",
|
|
|
|
toolchain_type = ":cmake_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Preinstalled ninja will always be the default, if toolchain with more exact constraints
|
|
|
|
# is not defined before; registered from workspace_definitions.bzl#rules_foreign_cc_dependencies
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_ninja_toolchain",
|
|
|
|
toolchain = ":preinstalled_ninja",
|
|
|
|
toolchain_type = ":ninja_toolchain",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Preinstalled make will always be the default, if toolchain with more exact constraints
|
|
|
|
# is not defined before; registered from workspace_definitions.bzl#rules_foreign_cc_dependencies
|
|
|
|
toolchain(
|
|
|
|
name = "preinstalled_make_toolchain",
|
|
|
|
toolchain = ":preinstalled_make",
|
|
|
|
toolchain_type = ":make_toolchain",
|
|
|
|
)
|
2021-02-16 15:41:58 +00:00
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_make",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "make.exe",
|
|
|
|
"//conditions:default": "make",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
make_tool(
|
|
|
|
name = "make_tool",
|
2021-03-15 17:17:59 +00:00
|
|
|
srcs = "@gnumake_src//:all_srcs",
|
2021-02-16 15:41:58 +00:00
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_make",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "$(execpath :make_tool)/bin/make.exe",
|
|
|
|
"//conditions:default": "$(execpath :make_tool)/bin/make",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
target = ":make_tool",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_cmake",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "cmake.exe",
|
|
|
|
"//conditions:default": "cmake",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
cmake_tool(
|
|
|
|
name = "cmake_tool",
|
2021-03-15 17:17:59 +00:00
|
|
|
srcs = "@cmake_src//:all_srcs",
|
2021-02-16 15:41:58 +00:00
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_cmake",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "$(execpath :cmake_tool)/bin/cmake.exe",
|
|
|
|
"//conditions:default": "$(execpath :cmake_tool)/bin/cmake",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
target = ":cmake_tool",
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "preinstalled_ninja",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
|
|
|
"@platforms//os:windows": "ninja.exe",
|
|
|
|
"//conditions:default": "ninja",
|
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
ninja_tool(
|
|
|
|
name = "ninja_tool",
|
2021-03-15 17:17:59 +00:00
|
|
|
srcs = "@ninja_build_src//:all_srcs",
|
2021-02-16 15:41:58 +00:00
|
|
|
tags = ["manual"],
|
|
|
|
)
|
|
|
|
|
|
|
|
native_tool_toolchain(
|
|
|
|
name = "built_ninja",
|
2021-03-15 17:24:49 +00:00
|
|
|
path = select({
|
2021-03-31 20:23:07 +00:00
|
|
|
"@platforms//os:windows": "$(execpath :ninja_tool)/bin/ninja.exe",
|
|
|
|
"//conditions:default": "$(execpath :ninja_tool)/bin/ninja",
|
2021-03-15 17:24:49 +00:00
|
|
|
}),
|
2021-02-16 15:41:58 +00:00
|
|
|
target = ":ninja_tool",
|
|
|
|
)
|
|
|
|
|
|
|
|
bzl_library(
|
|
|
|
name = "bzl_srcs",
|
|
|
|
srcs = glob(["**/*.bzl"]),
|
2021-03-11 16:52:36 +00:00
|
|
|
visibility = ["//:__subpackages__"],
|
|
|
|
deps = [
|
|
|
|
"//toolchains/native_tools:bzl_srcs",
|
|
|
|
],
|
2021-02-16 15:41:58 +00:00
|
|
|
)
|