Skip to content
Draft
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions toolchains/qcc/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,20 @@ def _impl(ctx):
],
)

base_path = "/proc/self/cwd/"
if ctx.attr.workspace_root_hint:
base_path = ctx.attr.workspace_root_hint

sdp_env_feature = feature(
name = "sdp_env",
enabled = True,
env_sets = [
env_set(
actions = all_compile_actions + all_link_actions,
env_entries = [
env_entry(key = "QNX_HOST", value = "/proc/self/cwd/" + ctx.file.qnx_host.path),
env_entry(key = "QNX_TARGET", value = "/proc/self/cwd/" + ctx.file.qnx_target.path),

env_entry(key = "QNX_HOST", value = base_path + ctx.file.qnx_host.path),
env_entry(key = "QNX_TARGET", value = base_path + ctx.file.qnx_target.path),
env_entry(key = "QNX_CONFIGURATION_EXCLUSIVE", value = "/var/tmp/.qnx"),
env_entry(key = "QNX_SHARED_LICENSE_FILE", value = "/opt/score_qnx/license/licenses"),
],
Expand All @@ -468,7 +473,7 @@ def _impl(ctx):
]

cxx_builtin_include_directories = [
"/proc/self/cwd/{}".format(include_directory.path)
"{}{}".format(base_path, include_directory.path)
for include_directory in ctx.files.cxx_builtin_include_directories
]

Expand Down Expand Up @@ -503,5 +508,7 @@ cc_toolchain_config = rule(
"qcc_version": attr.string(default = "12.2.0"),
"gcc_variant": attr.string(mandatory = True),
"gcc_variant_cxx": attr.string(mandatory = True),
"workspace_root_hint": attr.string(),

},
)
1 change: 1 addition & 0 deletions toolchains/qcc/toolchain.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ cc_toolchain_config(
qcc_version = "12.2.0",
gcc_variant = "gcc_ntoaarch64le",
gcc_variant_cxx = "gcc_ntoaarch64le_cxx",
workspace_root_hint = "%{build_workspace_root}",

)

Expand Down
3 changes: 3 additions & 0 deletions toolchains/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
def _qcc_toolchain_impl(rctx):
sandbox_dir = rctx.workspace_root.realpath.get_child("bazel-out").realpath.get_child("..").realpath

rctx.template(
"BUILD",
rctx.attr._cc_tolchain_build,
{
"%{toolchain_sdp}": rctx.attr.sdp_repo,
"%{build_workspace_root}": str(sandbox_dir) + "/",
},
)

Expand Down
Loading