mirror of https://github.com/bazelbuild/rules_cc
Get toolchain working
This commit is contained in:
parent
2bdc5d9a6b
commit
87a3dd9d0e
|
@ -3,8 +3,9 @@ module(
|
|||
version = "0.0.1",
|
||||
)
|
||||
|
||||
bazel_dep(name = "platforms", version = "0.0.10")
|
||||
bazel_dep(name = "googletest", version = "1.15.2")
|
||||
bazel_dep(name = "skylib", version = "1.7.1")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.7.1")
|
||||
|
||||
bazel_dep(name = "rules_cc")
|
||||
local_path_override(module_name = "rules_cc", path = "../..")
|
||||
|
@ -28,8 +29,6 @@ http_archive(
|
|||
)
|
||||
|
||||
register_toolchains(
|
||||
[
|
||||
"//toolchain:host-linux-x86_64",
|
||||
],
|
||||
dev_dependency = True,
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "dynamic_answer.h"
|
||||
|
||||
int dynamic_answer() {
|
||||
int dynamic_answer(void) {
|
||||
return 24;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ cc_args(
|
|||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:c_compile",
|
||||
"@rules_cc//cc/toolchains/actions:cpp_compile_actions",
|
||||
]
|
||||
],
|
||||
args = [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
|
@ -23,18 +23,28 @@ cc_args(
|
|||
],
|
||||
)
|
||||
|
||||
cc_args(
|
||||
name = "no_canonical_prefixes",
|
||||
actions = [
|
||||
"@rules_cc//cc/toolchains/actions:c_compile",
|
||||
"@rules_cc//cc/toolchains/actions:cpp_compile_actions",
|
||||
],
|
||||
args = ["-no-canonical-prefixes"],
|
||||
)
|
||||
|
||||
[
|
||||
cc_toolchain(
|
||||
name = "host-{}-config".format(platform),
|
||||
name = "host-{}-config".format(platform_name),
|
||||
args = select({
|
||||
"@platforms//os:linux": [
|
||||
"@linux_sysroot//:sysroot",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}) + [
|
||||
":no_canonical_prefixes",
|
||||
":warnings",
|
||||
],
|
||||
tools = "@clang-{}//:all_tools".format(platform),
|
||||
tool_map = "@clang-{}//:all_tools".format(platform_name),
|
||||
known_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],
|
||||
enabled_features = ["@rules_cc//cc/toolchains/args:experimental_replace_legacy_action_config_features"],
|
||||
target_compatible_with = constraints,
|
||||
|
@ -44,10 +54,11 @@ cc_args(
|
|||
|
||||
[
|
||||
toolchain(
|
||||
name = "host-{}".format(platform),
|
||||
name = "host-{}".format(platform_name),
|
||||
exec_compatible_with = constraints,
|
||||
target_compatible_with = constraints,
|
||||
)
|
||||
toolchain = ":host_toolchain",
|
||||
toolchain = ":host-{}-config".format(platform_name),
|
||||
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
||||
)
|
||||
for platform_name, constraints in PLATFORMS.items()
|
||||
]
|
||||
|
|
|
@ -8,8 +8,7 @@ cc_sysroot(
|
|||
name = "sysroot",
|
||||
sysroot = ":root",
|
||||
data = [":root"],
|
||||
implicit_include_directories = [
|
||||
":usr-local-include",
|
||||
allowlist_include_directories = [
|
||||
":usr-include-x86_64-linux-gnu",
|
||||
":usr-include",
|
||||
],
|
||||
|
@ -20,17 +19,14 @@ directory(
|
|||
srcs = glob(["**/*"]),
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
name = "usr-local-include",
|
||||
path = "usr/local/include",
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
name = "usr-include-x86_64-linux-gnu",
|
||||
path = "usr/include/x86_64-linux-gnu",
|
||||
parent = ":root",
|
||||
)
|
||||
|
||||
subdirectory(
|
||||
name = "usr-include",
|
||||
path = "usr/include",
|
||||
parent = ":root",
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue