Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass through --sysroot to host compiler #185

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cuda/private/cuda_helper.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_skylib//lib:types.bzl", "types")
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
load("//cuda/private:action_names.bzl", "ACTION_NAMES")
load("//cuda/private:artifact_categories.bzl", "ARTIFACT_CATEGORIES")
load("//cuda/private:providers.bzl", "ArchSpecInfo", "CudaArchsInfo", "CudaInfo", "Stage2ArchInfo", "cuda_archs")
Expand Down Expand Up @@ -242,6 +243,8 @@ def _create_common(ctx):

merged_cc_info = cc_common.merge_cc_infos(cc_infos = [dep[CcInfo] for dep in all_cc_deps])

cc_toolchain = find_cpp_toolchain(ctx)

# gather include info
includes = merged_cc_info.compilation_context.includes.to_list()
system_includes = []
Expand Down Expand Up @@ -276,6 +279,8 @@ def _create_common(ctx):
host_defines = []
host_local_defines = [i for i in attr.host_local_defines]
host_compile_flags = attr._default_host_copts[BuildSettingInfo].value + [i for i in attr.host_copts]
if cc_toolchain.sysroot:
host_compile_flags.append("--sysroot={}".format(cc_toolchain.sysroot))
host_link_flags = []
if hasattr(attr, "host_linkopts"):
host_link_flags.extend([i for i in attr.host_linkopts])
Expand Down