Skip to content

Commit

Permalink
Pass through --sysroot to host compiler (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten authored Oct 27, 2023
1 parent b138490 commit 45ee11d
Showing 1 changed file with 5 additions and 0 deletions.
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

0 comments on commit 45ee11d

Please sign in to comment.