-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMODULE.bazel
More file actions
36 lines (32 loc) · 1.46 KB
/
MODULE.bazel
File metadata and controls
36 lines (32 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"Your one stop shop for hermetic c/c++ toolchains in Bazel!"
module(name = "toolchains_cc")
bazel_dep(name = "rules_cc", version = "0.2.8")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "platforms", version = "1.0.0")
# TODO: improve this explanation
# Use cases
# * build c/c++ code for the host platform
# * enable overriding the host platform defaults with environment variables
# * use the default toolchain with the platform environment variables
# * enable platform transitions to allow building for different platforms
# To do this, we need to:
# 1. Detect the host platform configurations and write them to constants as part of a repo rule
# 2. Read the environment variable configurations, use host platform defaults if not set,
# and write them to constants as part of a separate repo rule
# 3. In toolchains_cc, use the constants as the default for various `constraint_setting`s
detect_host_platform = use_repo_rule("@toolchains_cc//impl:host_detect.bzl", "detect_host_platform")
detect_host_platform(
name = "toolchains_cc_host_platform_constants",
)
platform_defaults = use_repo_rule("@toolchains_cc//impl:platform_defaults.bzl", "platform_defaults")
platform_defaults(
name = "toolchains_cc_platform_defaults",
)
cxx_toolchains = use_extension("@toolchains_cc//:toolchains_cc.bzl", "cxx_toolchains")
cxx_toolchains.declare(
name = "toolchains_cc_default_toolchain",
)
use_repo(
cxx_toolchains,
"toolchains_cc_default_toolchain",
)