2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-29 12:33:51 +00:00
rules_foreign_cc/toolchains/BUILD.bazel

140 lines
3.5 KiB
Python
Raw Normal View History

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/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",
)
native_tool_toolchain(
name = "preinstalled_make",
path = select({
"@platforms//os:windows": "make.exe",
"//conditions:default": "make",
}),
)
make_tool(
name = "make_tool",
srcs = "@gnumake_src//:all_srcs",
tags = ["manual"],
)
native_tool_toolchain(
name = "built_make",
path = select({
"@platforms//os:windows": "$(execpath :make_tool)/bin/make.exe",
"//conditions:default": "$(execpath :make_tool)/bin/make",
}),
target = ":make_tool",
)
native_tool_toolchain(
name = "preinstalled_cmake",
path = select({
"@platforms//os:windows": "cmake.exe",
"//conditions:default": "cmake",
}),
)
cmake_tool(
name = "cmake_tool",
srcs = "@cmake_src//:all_srcs",
tags = ["manual"],
)
native_tool_toolchain(
name = "built_cmake",
path = select({
"@platforms//os:windows": "$(execpath :cmake_tool)/bin/cmake.exe",
"//conditions:default": "$(execpath :cmake_tool)/bin/cmake",
}),
target = ":cmake_tool",
)
native_tool_toolchain(
name = "preinstalled_ninja",
path = select({
"@platforms//os:windows": "ninja.exe",
"//conditions:default": "ninja",
}),
)
ninja_tool(
name = "ninja_tool",
srcs = "@ninja_build_src//:all_srcs",
tags = ["manual"],
)
native_tool_toolchain(
name = "built_ninja",
path = select({
"@platforms//os:windows": "$(execpath :ninja_tool)/bin/ninja.exe",
"//conditions:default": "$(execpath :ninja_tool)/bin/ninja",
}),
target = ":ninja_tool",
)
bzl_library(
name = "bzl_srcs",
srcs = glob(["**/*.bzl"]),
visibility = ["//:__subpackages__"],
deps = [
"//toolchains/native_tools:bzl_srcs",
],
)